:root {
  color-scheme: light;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --accent: #2563eb;
  --accent-rgb: 37 99 235;
  --page-bg: #eef2f7;
  --page-fg: #162033;
  --surface: #ffffff;
  --surface-muted: #526070;
  --border: #c6d2e1;
  --required: color-mix(in srgb, #dc2626 82%, var(--accent));
  --sidebar-bg: #0f172a;
  --sidebar-fg: #e2e8f0;
  --sidebar-muted: #94a3b8;
  --sidebar-hover: #1e293b;
  --card-shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
  background: var(--page-bg);
  color: var(--page-fg);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --page-bg: #0b1220;
  --page-fg: #e2e8f0;
  --surface: #1e293b;
  --surface-muted: #94a3b8;
  --border: #334155;
  --required: color-mix(in srgb, #f87171 78%, var(--accent));
  --sidebar-bg: #020617;
  --sidebar-hover: #1e293b;
  --card-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
}

.session-presence-banner {
  position: fixed;
  left: var(--sidebar-w, 0px);
  right: 0;
  bottom: 0;
  z-index: 35;
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1rem;
  align-items: center;
  justify-content: space-between;
  padding: 0.7rem 1rem;
  background: color-mix(in srgb, #0f766e 18%, var(--surface));
  color: var(--page-fg);
  border-top: 1px solid var(--border);
  box-shadow: 0 -6px 18px rgba(15, 23, 42, 0.12);
  font-size: 0.92rem;
}

.session-presence-banner[hidden] {
  display: none !important;
}

.session-presence-banner strong {
  margin-right: 0.35rem;
}

.session-presence-banner .session-presence-dismiss {
  margin-left: auto;
}

.account-devices-list {
  display: grid;
  gap: 0.65rem;
  margin: 0.75rem 0 1rem;
  padding: 0;
  list-style: none;
}

.account-device-item {
  display: grid;
  gap: 0.2rem;
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: color-mix(in srgb, var(--surface) 92%, var(--page-bg));
}

.account-device-item.is-current {
  border-color: color-mix(in srgb, var(--accent, #2563eb) 45%, var(--border));
  background: color-mix(in srgb, var(--accent, #2563eb) 8%, var(--surface));
}

.account-device-head {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.65rem;
  align-items: center;
}

.account-device-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.12rem 0.45rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  background: color-mix(in srgb, var(--accent, #2563eb) 18%, transparent);
  color: var(--page-fg);
}

.account-device-badge-other {
  background: color-mix(in srgb, #0f766e 16%, transparent);
}

.account-device-item small {
  color: color-mix(in srgb, var(--page-fg) 70%, transparent);
}

body.emit-doc-preview-overlay,
body.emit-nfe-preview-overlay {
  overflow: hidden;
}

button,
input,
select,
textarea {
  font: inherit;
}

:root[data-theme="dark"] input,
:root[data-theme="dark"] select,
:root[data-theme="dark"] textarea {
  background: #0f172a;
  color: var(--page-fg);
  border-color: var(--border);
}

:root[data-theme="dark"] .account-email-stripe {
  border-color: color-mix(in srgb, var(--accent) 35%, var(--border));
  background: color-mix(in srgb, var(--accent) 12%, var(--surface));
}

.shell-layout {
  --sidebar-w: 0px;
  min-height: 100vh;
}

.shell-layout.sidebar-open {
  --sidebar-w: 280px;
}

.shell-layout.sidebar-collapsed {
  --sidebar-w: 76px;
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 39;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(2px);
  transition: opacity 0.25s ease;
}

.shell-layout.sidebar-open .sidebar-overlay {
  display: block;
}

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 40;
  width: 280px;
  height: 100vh;
  max-height: none;
  padding: 24px 18px;
  background: var(--sidebar-bg);
  color: var(--sidebar-fg);
  overflow-x: hidden;
  overflow-y: auto;
  transform: translateX(-100%);
  transition:
    transform 0.25s ease,
    padding 0.2s ease,
    width 0.2s ease;
}

.shell-layout.sidebar-open .sidebar {
  transform: translateX(0);
}

.shell-layout.sidebar-collapsed .sidebar {
  width: 76px;
}

.sidebar.is-collapsed {
  padding-right: 12px;
  padding-left: 12px;
}

.sidebar-fab {
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 38;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border: none;
  border-radius: 14px;
  background: var(--sidebar-bg);
  color: var(--sidebar-fg);
  font-size: 1.3rem;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0,0,0,0.18);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.sidebar-fab:hover {
  background: #1e293b;
  transform: scale(1.06);
}

.shell-layout.sidebar-open .sidebar-fab {
  opacity: 0;
  pointer-events: none;
}

/* Previa/documento aberto: nao sobrepor o botao Voltar */
body:has(.emit-doc-grid:not(.emit-preview-collapsed)) .sidebar-fab,
body.emit-doc-preview-overlay .sidebar-fab,
body.emit-nfe-preview-overlay .sidebar-fab {
  display: none;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 8px 8px 24px;
}

.sidebar.is-collapsed .brand {
  justify-content: center;
  padding-right: 0;
  padding-left: 0;
}

.sidebar.is-collapsed .brand-mark:not(.has-custom-icon) {
  display: none;
}

.sidebar.is-collapsed .brand-mark.has-custom-icon {
  display: grid;
  width: 40px;
  height: 40px;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 14px;
  background: var(--accent);
  color: #ffffff;
  font-weight: 900;
  overflow: hidden;
  flex-shrink: 0;
}

.brand-mark .brand-mark-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
  display: block;
}

.brand strong,
.brand small {
  display: block;
}

.sidebar.is-collapsed .brand > div {
  display: none;
}

.brand small {
  margin-top: 3px;
  color: var(--sidebar-muted);
}

.sidebar-nav {
  display: grid;
  gap: 8px;
}

.sidebar-toggle {
  margin-left: auto;
  padding: 8px 10px;
  border-color: #334155;
  background: #111c31;
  color: #e2e8f0;
}

.sidebar.is-collapsed .sidebar-toggle {
  margin-left: 0;
}

.sidebar.is-collapsed .sidebar-nav {
  display: none;
}

.nav-item {
  width: 100%;
  justify-content: flex-start;
  border: 0;
  background: transparent;
  color: #cbd5e1;
  text-align: left;
}

.sidebar.is-collapsed .nav-item {
  min-height: 42px;
  padding-right: 0;
  padding-left: 0;
  font-size: 0;
}

.sidebar.is-collapsed .nav-item::first-letter {
  font-size: 0;
}

.nav-item:hover,
.nav-item.active {
  background: var(--sidebar-hover);
  color: #ffffff;
}

.nav-group {
  display: grid;
  gap: 6px;
  margin-top: 12px;
}

.nav-group-toggle {
  width: 100%;
  padding: 10px 12px 4px;
  border: 0;
  background: transparent;
  color: #94a3b8;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-align: left;
  text-transform: uppercase;
}

.nav-group-toggle::after {
  content: " ˅";
  color: #64748b;
  font-size: 0.85rem;
  letter-spacing: 0;
  text-transform: none;
}

.nav-group.is-collapsed .nav-group-toggle::after {
  content: " >";
}

.nav-group-items {
  display: grid;
  gap: 6px;
}

.nav-group.is-collapsed .nav-group-items,
.sidebar.is-collapsed .nav-group-items {
  display: none;
}

.sidebar.is-collapsed .nav-group-toggle {
  padding-right: 0;
  padding-left: 0;
  font-size: 0;
  text-align: center;
}

.sidebar.is-collapsed .nav-group-toggle::before {
  content: "+";
  font-size: 1rem;
}

.sidebar.is-collapsed .nav-group-toggle::after {
  content: "";
}

.nav-subitem {
  padding-left: 24px;
}

.sidebar.is-collapsed .sidebar-admin-panel {
  display: none;
}

.sidebar-admin-panel {
  margin-top: 20px;
  padding: 14px;
  border: 1px solid #334155;
  border-radius: 14px;
  background: #111c31;
}

.sidebar-admin-panel h2 {
  margin-bottom: 10px;
  color: #ffffff;
  font-size: 0.9rem;
}

.sidebar-admin-panel ul {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.admin-tool-list {
  display: grid;
  gap: 8px;
}

.admin-tool-list button {
  width: 100%;
  border-color: #334155;
  background: #0f172a;
  color: #e2e8f0;
  text-align: left;
}

.sidebar-admin-panel li {
  padding: 8px;
  border-radius: 10px;
  background: #0f172a;
  color: #cbd5e1;
  font-size: 0.78rem;
  overflow-wrap: anywhere;
}

.page {
  margin-left: auto;
  margin-right: auto;
  padding: 32px 20px;
  padding-top: 72px;
  width: min(1180px, calc(100% - 40px));
  max-width: 100%;
  box-sizing: border-box;
  overflow-x: clip;
  transition: margin-left 0.2s ease, width 0.2s ease;
}

.page > .hero,
.page > .card,
.page > .grid,
.page > .emit-doc-grid,
.page > .nfe-composer-surface,
.page > .emit-required-stripe,
.page > .form-steps,
.page > section.card {
  margin-inline: clamp(6px, 1.5vw, 14px);
}

.shell-layout.sidebar-collapsed .page {
  margin-left: auto;
  margin-right: auto;
  width: min(1180px, calc(100% - 32px));
}

.app-page[hidden] {
  display: none !important;
}

.hero,
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--card-shadow);
}

.hero {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: center;
  padding: 28px;
  margin-bottom: 24px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.78rem;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 12px;
  font-size: clamp(2rem, 4vw, 3.2rem);
  line-height: 1;
}

h2 {
  margin-bottom: 0;
  font-size: 1.1rem;
}

.hero p {
  max-width: 680px;
  margin-bottom: 0;
  color: var(--surface-muted);
}

.actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.hero-trailing {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
  min-width: min(360px, 100%);
}

button.secondary {
  border-color: #c6d2e1;
  background: #f8fafc;
  color: #162033;
}

button.danger-outline {
  border-color: #fca5a5;
  background: #fef2f2;
  color: #b91c1c;
}

.saved-data-library-body {
  margin-top: 12px;
  color: #334155;
  font-size: 0.94rem;
  line-height: 1.5;
}

.saved-data-library-body strong {
  color: #0f172a;
}

.saved-data-library-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.saved-items-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 12px;
  max-height: 440px;
  overflow-y: auto;
}

.saved-item-card {
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 12px 14px;
  background: #f8fafc;
}

.saved-item-meta {
  font-size: 0.85rem;
  color: #64748b;
  margin-top: 6px;
}

.saved-item-meta.subtle {
  font-size: 0.8rem;
  opacity: 0.92;
}

.doc-status-badge {
  display: inline-block;
  margin-top: 8px;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.doc-status-badge.is-authorized {
  background: #dcfce7;
  color: #166534;
}

.doc-status-badge.is-cancelled {
  background: #f1f5f9;
  color: #475569;
}

.doc-status-badge.is-rejected {
  background: #fee2e2;
  color: #991b1b;
}

.emit-rejection-detail,
.doc-history-rejection-reason {
  color: #b42318;
  font-size: 0.82rem;
  line-height: 1.35;
  margin-top: 0.35rem;
}

.doc-history-status-cell strong {
  font-weight: 600;
}

.doc-status-badge.is-pending {
  background: #fef9c3;
  color: #854d0e;
}

.saved-item-protocol {
  display: grid;
  gap: 4px;
  margin-top: 8px;
  font-size: 0.82rem;
}

.saved-item-protocol span {
  color: #64748b;
}

.saved-item-protocol strong {
  color: #0f172a;
  font-weight: 600;
  word-break: break-all;
}

.saved-item-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.saved-item-actions button {
  font-size: 0.82rem;
  padding: 8px 12px;
}

.form-inline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 4px;
}

.product-library-card.has-saved-products #productLibraryEmpty {
  display: none;
}

.company-snapshots-library.has-snapshots #companyLibraryEmpty,
.person-snapshots-library.has-snapshots #personLibraryEmpty,
.fiscal-snapshots-library.has-snapshots #fiscalLibraryEmpty {
  display: none;
}

.emit-doc-grid.emit-preview-collapsed {
  grid-template-columns: minmax(0, 1fr);
}

.emit-doc-grid.emit-preview-collapsed > .emit-preview-panel {
  display: none !important;
}

/* Documento em pagina inteira (formulario oculto), igual NF-e */
.emit-doc-grid:not(.emit-preview-collapsed) {
  display: block;
  gap: 0;
}

.emit-doc-grid:not(.emit-preview-collapsed) .form-card {
  display: none;
}

.emit-doc-grid:not(.emit-preview-collapsed) .emit-preview-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: var(--sidebar-w);
  z-index: 30;
  display: flex;
  flex-direction: column;
  width: auto;
  max-width: none;
  min-height: 100vh;
  max-height: none;
  margin: 0;
  overflow-x: hidden;
  overflow-y: auto;
  border-radius: 0;
  box-shadow: -16px 0 48px rgb(15 23 42 / 14%);
}

.emit-doc-grid:not(.emit-preview-collapsed) .emit-preview-panel .card-header,
.emit-doc-grid:not(.emit-preview-collapsed) .emit-preview-panel .summary {
  flex-shrink: 0;
}

.emit-doc-grid:not(.emit-preview-collapsed) .emit-preview-panel .danfe-preview,
.emit-doc-grid:not(.emit-preview-collapsed) .emit-preview-panel .digital-document-preview {
  flex: 1 1 auto;
  min-height: min(400px, 50vh);
  overflow: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px;
  background: #e8edf5;
}

.emit-doc-grid:not(.emit-preview-collapsed) .emit-preview-panel .empty-state {
  min-height: min(400px, 70vh);
}

.emit-doc-grid:not(.emit-preview-collapsed) .emit-preview-panel .xml-details {
  flex-shrink: 0;
  border-top: 1px solid #dbe3ef;
  background: #f8fafc;
}

.emit-preview-header {
  position: relative;
  min-height: 88px;
  padding: 52px 20px 14px 20px;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 8px 12px;
}

.emit-preview-header h2 {
  margin: 0;
  flex: 1 1 auto;
  min-width: 0;
  padding-right: 8px;
}

.emit-preview-header > span {
  flex: 0 0 auto;
  align-self: center;
}

.emit-preview-back {
  position: absolute;
  left: 20px;
  top: 50px;
  z-index: 2;
  min-width: 96px;
  height: 40px;
  padding: 0 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--page-fg);
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.02em;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  box-shadow: 0 2px 8px rgb(15 23 42 / 8%);
}

.doc-print-settings-btn {
  min-width: 40px;
  padding-inline: 10px;
  font-size: 1rem;
  line-height: 1;
}

.emit-preview-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  flex: 1 1 auto;
  justify-content: flex-end;
  align-items: center;
}

@media print {
  @page {
    size: var(--print-paper-size, A4 portrait);
    margin: var(--print-margin-mm, 3mm);
  }

  html.doc-print-mode,
  body.doc-print-mode {
    width: 210mm;
    height: 297mm;
    margin: 0 !important;
    padding: 0 !important;
    background: #ffffff !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  body.doc-print-mode * {
    visibility: hidden !important;
  }

  body.doc-print-mode [data-print-root],
  body.doc-print-mode [data-print-root] * {
    visibility: visible !important;
  }

  body.doc-print-mode [data-print-root] {
    position: fixed;
    inset: 0;
    margin: 0;
    padding: 0;
    overflow: visible;
    background: #ffffff;
    display: flex;
    justify-content: center;
    align-items: flex-start;
  }

  body.doc-print-mode .danfe-preview,
  body.doc-print-mode .digital-document-preview {
    padding: 0 !important;
    margin: 0 !important;
    background: #ffffff !important;
    border-radius: 0 !important;
    width: 100%;
  }

  body.doc-print-mode .danfe-sheet,
  body.doc-print-mode .digital-document-sheet {
    margin: 0 auto !important;
    box-shadow: none !important;
    border: var(--danfe-line, 0.55px solid #111827);
    background: #ffffff !important;
    border-radius: 0 !important;
    padding: 1px !important;
  }

  html[data-print-fit="page"] body.doc-print-mode .danfe-sheet {
    width: calc(210mm - var(--print-margin-mm, 3mm) * 2) !important;
    max-width: calc(210mm - var(--print-margin-mm, 3mm) * 2) !important;
    min-height: calc(297mm - var(--print-margin-mm, 3mm) * 2) !important;
  }

  html[data-print-fit="content"] body.doc-print-mode .danfe-sheet,
  html[data-print-fit="content"] body.doc-print-mode .digital-document-sheet {
    width: calc(210mm - var(--print-margin-mm, 3mm) * 2) !important;
    max-width: calc(210mm - var(--print-margin-mm, 3mm) * 2) !important;
    min-height: auto !important;
  }

  html[data-print-fit="cupom"] body.doc-print-mode .digital-document-sheet {
    width: var(--print-cupom-width-mm, 80mm) !important;
    max-width: var(--print-cupom-width-mm, 80mm) !important;
    min-height: auto !important;
  }
}

/* Legado: redireciona para doc-print-mode */
@media print {
  body.danfe-print-mode * {
    visibility: hidden !important;
  }

  body.danfe-print-mode #danfePreview,
  body.danfe-print-mode #danfePreview * {
    visibility: visible !important;
  }

  body.danfe-print-mode #danfePreview {
    position: absolute;
    inset: var(--print-margin-mm, 3mm);
    overflow: visible;
    padding: 0;
  }

  body.danfe-print-mode .danfe-sheet {
    width: 100% !important;
    min-height: auto !important;
    margin: 0 !important;
    box-shadow: none !important;
    border: var(--danfe-line, 0.55px solid #111827);
    border-radius: 0 !important;
    padding: 1px !important;
  }
}

.emit-preview-back:hover {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, var(--surface));
}

.emit-doc-grid:not(.emit-preview-collapsed) .emit-preview-panel .emit-preview-header {
  padding-top: 56px;
  padding-left: 20px;
  padding-right: 20px;
}

.emit-input-stack {
  position: relative;
  display: grid;
  width: 100%;
  pointer-events: none;
}

.emit-input-stack > input,
.emit-input-stack > textarea,
.emit-input-stack > select {
  grid-area: 1 / 1;
  position: relative;
  z-index: 2;
  pointer-events: auto;
}

.emit-input-stack > input.emit-example-incomplete,
.emit-input-stack > textarea.emit-example-incomplete {
  background: color-mix(in srgb, var(--surface) 72%, transparent);
}

:root[data-theme="dark"] .emit-input-stack > input.emit-example-incomplete,
:root[data-theme="dark"] .emit-input-stack > textarea.emit-example-incomplete {
  background: color-mix(in srgb, #0f172a 72%, transparent);
}

.emit-example-ghost {
  grid-area: 1 / 1;
  align-self: center;
  padding: 9px 11px;
  color: #94a3b8;
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
  z-index: 0;
  text-transform: none;
}

label > .emit-example-ghost {
  position: static;
  display: block;
  margin-top: 4px;
  padding: 0;
  font-size: 0.78rem;
  line-height: 1.35;
  white-space: normal;
}

.emit-example-ghost[hidden] {
  display: none;
}

label:has(.emit-input-stack) {
  position: relative;
}

@media (max-width: 980px) {
  .hero-trailing {
    align-items: stretch;
    width: 100%;
  }

  .hero-trailing .actions {
    justify-content: flex-start;
  }
}

button {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--page-fg);
  border-radius: 12px;
  padding: 12px 16px;
  cursor: pointer;
  font-weight: 700;
}

button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 24px;
}

.accounts-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
}

.issuer-catalog-toolbar {
  display: grid;
  gap: 12px;
  margin: 0 0 18px;
}

.issuer-catalog-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.issuer-catalog-tab {
  border: 1px solid #dbe3ef;
  background: #fff;
  color: #334155;
  border-radius: 999px;
  padding: 8px 14px;
  font-weight: 700;
  cursor: pointer;
}

.issuer-catalog-tab.is-active {
  background: var(--accent, #2563eb);
  border-color: var(--accent, #2563eb);
  color: #fff;
}

.issuer-catalog-tabs--inner .issuer-catalog-tab {
  border-radius: 10px;
}

.issuer-catalog-hint {
  margin: 0;
}

.issuer-catalog-block {
  margin-bottom: 28px;
}

.issuer-catalog-subhero {
  margin-bottom: 8px;
}

.issuer-catalog-subhero h2 {
  margin: 0 0 4px;
  font-size: 1.15rem;
}

.issuer-defaults-panel h3 {
  margin: 0 0 6px;
}

.form-grid .span-2 {
  grid-column: 1 / -1;
}

.accounts-auth-card {
  grid-column: 1 / -1;
  max-width: 520px;
}

.accounts-auth-card .auth-modal-tabs {
  margin-top: 0.75rem;
}

.accounts-auth-card .account-form {
  margin-top: 0.5rem;
}

.info-card {
  min-height: 220px;
  padding: 24px;
}

.info-card p {
  color: var(--surface-muted);
}

.layout-customize-panel {
  margin-bottom: 24px;
  padding: 28px;
}

.layout-customize-header {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
}

.layout-customize-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.layout-customize-block {
  padding: 18px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--accent) 4%, var(--surface));
}

.layout-customize-block-wide {
  grid-column: 1 / -1;
}

.layout-customize-block h3 {
  margin: 0 0 8px;
  font-size: 1.05rem;
}

.layout-palette-options {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 14px 0;
}

.layout-palette-swatch {
  width: 44px;
  height: 44px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 12px;
  background: transparent;
  cursor: pointer;
}

.layout-palette-swatch.is-selected {
  border-color: var(--page-fg);
  box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--accent);
}

.layout-palette-swatch-inner {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 10px;
  background: var(--swatch-color);
}

.layout-custom-accent-label {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
  font-weight: 600;
}

.layout-custom-accent-label input[type="color"] {
  width: 48px;
  height: 36px;
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
}

.layout-theme-toggle {
  display: inline-flex;
  gap: 8px;
  margin-top: 10px;
  padding: 4px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
}

.layout-theme-btn {
  padding: 10px 18px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--page-fg);
  font-weight: 700;
}

.layout-theme-btn.is-selected {
  background: var(--accent);
  color: #fff;
}

.layout-icon-row {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  align-items: center;
  margin-top: 14px;
}

.layout-icon-preview {
  display: grid;
  width: 72px;
  height: 72px;
  place-items: center;
  border-radius: 18px;
  background: var(--accent);
  color: #fff;
  overflow: hidden;
}

.layout-icon-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.layout-icon-placeholder {
  font-size: 2rem;
  font-weight: 900;
}

.layout-icon-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.layout-icon-upload {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}

.layout-customize-footer {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.layout-customize-footer .actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: flex-end;
}

.accounts-page-footer {
  display: flex;
  justify-content: center;
  margin-top: 8px;
  padding: 8px 0 24px;
}

@media (max-width: 720px) {
  .layout-customize-grid {
    grid-template-columns: 1fr;
  }
}

.account-form {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.account-email-stripe {
  padding: 14px 16px;
  margin: 2px 0 4px;
  border-radius: 12px;
  border: 1px solid #bfdbfe;
  background: linear-gradient(100deg, #eff6ff 0%, #f8fafc 55%, #eef2ff 100%);
}

.account-email-stripe label {
  margin: 0;
  font-weight: 800;
  color: #1e3a5f;
}

.emit-required-stripe {
  padding: 12px 14px;
  margin: 0 0 14px;
  border-radius: 12px;
  border: 2px solid var(--required);
  background: color-mix(in srgb, var(--required) 8%, var(--surface));
}

.emit-required-stripe label {
  margin: 0;
  font-weight: 700;
  color: var(--page-fg);
}

.emit-stripe-title {
  margin: 0 0 8px;
  font-weight: 800;
  color: #92400e;
  font-size: 0.92rem;
}

.nbs-typeahead-wrap,
.ncm-typeahead-wrap,
.cfop-typeahead-wrap,
.cest-typeahead-wrap,
.taxonomy-typeahead-wrap {
  position: relative;
}

.taxonomy-typeahead-field {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: stretch;
  gap: 0;
  position: relative;
}

.taxonomy-typeahead-field > input {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
  border-right: 0;
}

.taxonomy-typeahead-toggle {
  display: grid;
  place-items: center;
  min-width: 40px;
  padding: 0 10px;
  border: 1px solid #cbd5e1;
  border-left: 0;
  border-radius: 0 10px 10px 0;
  background: #f8fafc;
  color: #334155;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
}

.taxonomy-typeahead-toggle:hover,
.taxonomy-typeahead-toggle:focus-visible {
  background: #eff6ff;
  color: #1d4ed8;
}

.nbs-typeahead-list,
.taxonomy-typeahead-list {
  position: absolute;
  z-index: 40;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  margin: 0;
  padding: 6px 0;
  list-style: none;
  max-height: 280px;
  overflow-y: auto;
  border-radius: 10px;
  border: 1px solid #cbd5e1;
  background: #fff;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.12);
}

.nbs-typeahead-list li,
.taxonomy-typeahead-list li {
  padding: 8px 12px;
  cursor: pointer;
  display: grid;
  gap: 2px;
}

.nbs-typeahead-list li:hover,
.nbs-typeahead-list li:focus,
.taxonomy-typeahead-list li:hover,
.taxonomy-typeahead-list li:focus {
  background: #eff6ff;
}

.nbs-typeahead-list .nbs-code,
.taxonomy-typeahead-list .taxonomy-code {
  font-weight: 700;
  font-size: 0.82rem;
  color: #1e40af;
}

.nbs-typeahead-list .nbs-desc,
.taxonomy-typeahead-list .taxonomy-desc {
  font-size: 0.8rem;
  color: #475569;
  line-height: 1.35;
}

.nbs-typeahead-source {
  margin-top: 8px;
  font-size: 0.78rem;
}

:root[data-theme="dark"] .emit-required-stripe {
  border: 2px solid var(--required);
  background: color-mix(in srgb, var(--required) 14%, var(--surface));
  box-shadow: none;
}

:root[data-theme="dark"] .emit-required-stripe label,
:root[data-theme="dark"] .emit-stripe-title {
  color: #e2e8f0;
}

.emit-label-caption {
  display: inline-flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.2em;
  line-height: 1.25;
  pointer-events: none;
}

label.emit-field-required > select.br-municipio,
label.emit-field-required > select.br-uf {
  pointer-events: auto;
}

.emit-req-mark {
  color: var(--required);
  font-weight: 800;
  line-height: 1;
  flex: 0 0 auto;
}

label.emit-field-required {
  position: relative;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

label.emit-field-required:not(.is-field-filled) input,
label.emit-field-required:not(.is-field-filled) select,
label.emit-field-required:not(.is-field-filled) textarea {
  border-width: 2px;
  border-color: var(--required);
}

label.emit-field-required.is-field-filled {
  border: 0;
  background: transparent;
  box-shadow: none;
  padding: 0;
}

label.emit-field-required.is-field-filled .emit-req-mark {
  display: none;
}

fieldset > legend.emit-field-required {
  display: inline-flex;
  align-items: baseline;
  gap: 0.2em;
}

fieldset > legend.emit-field-required .emit-req-mark,
label.emit-field-required .emit-req-mark[hidden] {
  display: none;
}

:root[data-theme="dark"] .emit-req-mark {
  color: var(--required);
}

:root[data-theme="dark"] label.emit-field-required {
  border: 0;
  background: transparent;
  box-shadow: none;
}

:root[data-theme="dark"] label.emit-field-required:not(.is-field-filled) input,
:root[data-theme="dark"] label.emit-field-required:not(.is-field-filled) select,
:root[data-theme="dark"] label.emit-field-required:not(.is-field-filled) textarea {
  border-width: 2px;
  border-color: var(--required);
}

:root[data-theme="dark"] label.emit-field-required.is-field-filled {
  border: 0;
  background: transparent;
  box-shadow: none;
}

:root[data-theme="dark"] .nbs-typeahead-list,
:root[data-theme="dark"] .taxonomy-typeahead-list {
  background: #1e293b;
  border-color: #475569;
}

:root[data-theme="dark"] .nbs-typeahead-list li:hover,
:root[data-theme="dark"] .taxonomy-typeahead-list li:hover {
  background: #334155;
}

:root[data-theme="dark"] .taxonomy-typeahead-toggle {
  background: #0f172a;
  border-color: #475569;
  color: #e2e8f0;
}

.session-email {
  margin-top: 8px;
  color: #64748b;
}

.ui-build-stamp {
  margin: 6px 0 0;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #64748b;
}

:root[data-theme="dark"] .ui-build-stamp {
  color: #94a3b8;
}

.form-steps {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin: 22px clamp(6px, 1.5vw, 14px) 26px;
}

.form-step-button {
  padding: 10px 14px;
  border-color: #dbe3ef;
  background: #f8fafc;
  color: #1e293b;
  font-size: 0.88rem;
  font-weight: 700;
}

.form-step-button.active {
  border-color: #2563eb;
  background: #2563eb;
  color: #ffffff;
}

.form-step-panel[hidden] {
  display: none;
}

.emit-step-examples {
  margin: 0 0 0.85rem;
  padding: 0.5rem 0.65rem;
  border-left: 3px solid var(--accent, #3b6cff);
  background: color-mix(in srgb, var(--accent, #3b6cff) 8%, transparent);
}

.emit-step-examples[hidden] {
  display: none;
}

.form-note {
  margin: 12px 0 0;
  color: #64748b;
  font-size: 0.9rem;
  font-weight: 600;
}

.source-selector {
  margin-bottom: 14px;
  padding: 14px;
  border: 1px solid #dbe3ef;
  border-radius: 14px;
  background: #f8fafc;
}

.source-selector label {
  display: grid;
  gap: 8px;
  max-width: 320px;
  font-weight: 800;
}

.certificate-box {
  display: grid;
  gap: 14px;
  margin-bottom: 18px;
  padding: 16px;
  border: 1px solid #dbe3ef;
  border-radius: 14px;
  background: #f8fafc;
}

.certificate-box h3 {
  margin: 0;
  font-size: 1rem;
}

.checkbox-field {
  display: flex;
  gap: 10px;
  align-items: center;
  color: #475569;
  font-weight: 800;
}

.checkbox-field input {
  width: auto;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.modal-dialog {
  width: min(480px, calc(100% - 32px));
  border: 0;
  border-radius: 18px;
  padding: 0;
  box-shadow: 0 24px 70px rgb(15 23 42 / 28%);
}

.modal-dialog::backdrop {
  background: rgb(15 23 42 / 45%);
}

.modal-card {
  display: grid;
  gap: 14px;
  padding: 22px;
  background: #ffffff;
}

.modal-card h3 {
  margin: 0;
}

.modal-card label:not(.checkbox-field) {
  display: grid;
  gap: 8px;
  font-weight: 800;
}

.section-toggle {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  color: #162033;
}

.section-toggle::after {
  content: "Mostrar";
  color: #2563eb;
  font-size: 0.8rem;
}

.section-toggle[aria-expanded="true"]::after {
  content: "Ocultar";
}

.collapsible-section {
  padding: 16px;
  border: 1px solid #dbe3ef;
  border-radius: 14px;
  background: #f8fafc;
}

.collapsible-section[hidden] {
  display: none;
}

.collapsible-grid {
  margin-top: 0;
}

.digital-document-preview {
  padding: 18px;
  border-radius: 14px;
  background: #f8fafc;
}

.digital-document-sheet {
  position: relative;
  overflow: hidden;
  padding: 14px;
  border: 1px solid #111827;
  background: #ffffff;
}

.cpf-form {
  padding-top: 14px;
  border-top: 1px solid #dbe3ef;
}

#accountEmailForm + .form-feedback + .cpf-form {
  margin-top: 8px;
}

.form-feedback {
  min-height: 20px;
  margin: 12px 0 0;
  color: #2563eb;
  font-weight: 700;
}

.form-feedback.is-error {
  color: #b91c1c;
}

.accounts-list {
  display: grid;
  gap: 10px;
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
}

.accounts-list li {
  padding: 12px;
  border: 1px solid #dbe3ef;
  border-radius: 12px;
  background: #f8fafc;
  color: #475569;
  font-weight: 700;
}

.account-visible-fields {
  display: grid;
  gap: 8px;
  margin: 0 0 10px;
}

.account-visible-fields > div {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 8px;
  align-items: baseline;
}

.account-visible-fields dt {
  margin: 0;
  color: #64748b;
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.account-visible-fields dd {
  margin: 0;
  color: #0f172a;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.accounts-list small {
  display: block;
  margin-top: 4px;
  color: #64748b;
  font-weight: 600;
}

.users-library-card {
  grid-column: 1 / -1;
}

.library-search {
  display: grid;
  gap: 8px;
  max-width: 420px;
  margin-top: 16px;
  color: #475569;
  font-weight: 800;
}

.users-library {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.user-card {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid #dbe3ef;
  border-radius: 14px;
  background: #f8fafc;
  border-left-width: 5px;
}

.user-card-kind-real,
.user-card-role-user {
  border-left-color: #22c55e;
  border-color: #86efac;
  background: linear-gradient(135deg, #f8fafc 0%, #f0fdf4 100%);
}

.user-card-role-staff {
  border-left-color: #7c3aed;
  border-color: #c4b5fd;
  background: linear-gradient(135deg, #faf5ff 0%, #f5f3ff 55%, #ede9fe 100%);
  box-shadow: 0 8px 24px rgba(124, 58, 237, 0.08);
}

.user-card-role-admin {
  border-left-color: #2563eb;
  border-color: #93c5fd;
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
}

.user-card-kind-reserved {
  border-left-color: #2563eb;
  border-color: #93c5fd;
  background: #eff6ff;
}

.user-card-kind-test {
  border-left-color: #d97706;
  border-color: #fcd34d;
  background: #fffbeb;
}

.user-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.user-card-kind {
  display: inline-flex;
  width: fit-content;
  padding: 4px 10px;
  border-radius: 999px;
  background: #e2e8f0;
  color: #334155;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.user-card-badge-reserved {
  background: #dbeafe;
  color: #1d4ed8;
}

.user-card-badge-admin {
  background: #dbeafe;
  color: #1e40af;
}

.user-card-badge-staff {
  background: #ede9fe;
  color: #6d28d9;
  box-shadow: inset 0 0 0 1px rgba(109, 40, 217, 0.18);
}

.user-card-badge-user {
  background: #dcfce7;
  color: #15803d;
}

.user-card-badge-test {
  background: #fef3c7;
  color: #b45309;
}

.user-card-fields {
  display: grid;
  gap: 8px;
  margin: 0;
}

.user-card-fields div {
  display: grid;
  gap: 2px;
}

.user-card-fields dt {
  margin: 0;
  color: #64748b;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.user-card-fields dd {
  margin: 0;
  color: #162033;
  font-weight: 600;
  word-break: break-word;
}

.user-card-fields code {
  display: block;
  padding: 6px 8px;
  border-radius: 8px;
  background: #e2e8f0;
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.78rem;
  font-weight: 500;
  word-break: break-all;
}

.user-card-password dd code {
  font-size: 0.72rem;
}

.user-card-note {
  margin: 0;
  color: #64748b;
  font-size: 0.78rem;
  line-height: 1.45;
}

.user-card-note-staff {
  color: #5b21b6;
  font-weight: 700;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(237, 233, 254, 0.85);
  border: 1px solid #ddd6fe;
}

.user-card-staff-icon {
  color: #7c3aed;
  margin-right: 4px;
}

.user-card-note-client {
  color: #166534;
  font-weight: 600;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(220, 252, 231, 0.85);
  border: 1px solid #bbf7d0;
}

.user-role-pill {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 800;
}

.user-role-pill-admin {
  background: #dbeafe;
  color: #1d4ed8;
}

.user-role-pill-staff {
  background: #ede9fe;
  color: #6d28d9;
  box-shadow: inset 0 0 0 1px rgba(109, 40, 217, 0.2);
}

.user-role-pill-user {
  background: #dcfce7;
  color: #15803d;
}

.user-role-select-staff {
  border-color: #c4b5fd;
  background: #faf5ff;
}

.user-role-select-user {
  border-color: #86efac;
  background: #f0fdf4;
}

.user-role-select-admin {
  border-color: #93c5fd;
  background: #eff6ff;
}

.user-role-select {
  max-width: 100%;
  font: inherit;
}

.user-role-control {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.user-role-save-btn {
  font: inherit;
  padding: 4px 10px;
  cursor: pointer;
}

.user-card-id-details {
  margin: 0;
  padding: 0;
}

.user-card-id-details summary {
  cursor: pointer;
  color: #475569;
  font-size: 0.78rem;
  font-weight: 700;
  list-style: none;
}

.user-card-id-details summary::-webkit-details-marker {
  display: none;
}

.user-card-id-details summary::before {
  content: "▸ ";
  color: #64748b;
}

.user-card-id-details[open] summary::before {
  content: "▾ ";
}

.user-card-id-details dd {
  margin: 6px 0 0;
}

.user-card-id-details code {
  display: block;
  margin-top: 6px;
  padding: 6px 8px;
  border-radius: 8px;
  background: #e2e8f0;
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.78rem;
  font-weight: 500;
  word-break: break-all;
}

.users-library-toolbar {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  margin-top: 10px;
}

.users-library-summary {
  margin: 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: #f1f5f9;
  color: #334155;
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.5;
}

.users-library-filter {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  color: #475569;
  font-weight: 700;
}

.users-library-empty {
  margin: 0;
  color: #64748b;
}

.user-card strong {
  color: #162033;
  font-size: 1rem;
}

.user-card span {
  color: #475569;
  font-weight: 700;
}

.role-badge {
  display: inline-flex;
  width: fit-content;
  margin-top: 8px;
  padding: 4px 10px;
  border-radius: 999px;
  background: #dbeafe;
  color: #1d4ed8;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.role-badge-admin {
  background: #dbeafe;
  color: #1d4ed8;
}

.role-badge-staff {
  background: #ede9fe;
  color: #6d28d9;
}

.role-badge-user {
  background: #dcfce7;
  color: #15803d;
}

.card {
  min-height: 0;
  overflow: hidden;
}

.emit-doc-grid > .card {
  min-height: min(640px, 85vh);
}

.emit-doc-grid > .form-card {
  min-height: auto;
  max-height: none;
  overflow: visible;
}

.emit-doc-grid > .form-card form,
.emit-doc-grid > .form-card .nfe-form {
  overflow: visible;
}

.emit-doc-grid > .emit-preview-panel {
  overflow-x: hidden;
  overflow-y: auto;
}

.card-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 18px 20px;
  border-bottom: 1px solid #dbe3ef;
}

.card-header span {
  color: #64748b;
  font-size: 0.9rem;
}

pre {
  width: 100%;
  min-height: 12rem;
  margin: 0;
  border: 0;
  padding: 20px;
  resize: vertical;
  outline: none;
  background: #0f172a;
  color: #dbeafe;
  font-family: "Cascadia Code", Consolas, monospace;
  font-size: 0.85rem;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow: auto;
}

.nfe-form {
  display: grid;
  gap: 18px;
  padding: 18px;
}

fieldset {
  margin: 0;
  padding: 16px;
  border: 1px solid #dbe3ef;
  border-radius: 14px;
  background: #f8fafc;
}

legend {
  padding: 0 8px;
  color: #0f2744;
  font-size: 0.96rem;
  font-weight: 800;
  letter-spacing: 0.01em;
}

:root[data-theme="dark"] legend {
  color: #e2e8f0;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
  gap: 12px;
  margin-top: 12px;
}

label {
  display: grid;
  gap: 6px;
  color: #475569;
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

input,
select,
.nfe-form textarea {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 9px 11px;
  background: var(--surface);
  color: var(--page-fg);
  outline: none;
  font-size: 0.92rem;
  font-weight: 600;
  text-transform: none;
}

input::placeholder {
  color: #94a3b8;
}

.password-field {
  position: relative;
  display: block;
}

.password-field input {
  padding-right: 48px;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 8px;
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  padding: 0;
  transform: translateY(-50%);
  border: 0;
  background: transparent;
}

.eye-icon {
  position: relative;
  display: block;
  width: 18px;
  height: 10px;
  border: 2px solid #64748b;
  border-top: 0;
  border-radius: 0 0 18px 18px;
}

.eye-icon::after {
  position: absolute;
  top: 3px;
  left: 50%;
  width: 5px;
  height: 5px;
  content: "";
  transform: translateX(-50%);
  border-radius: 50%;
  background: #64748b;
  opacity: 0;
}

.password-toggle.is-visible .eye-icon {
  height: 12px;
  border-top: 2px solid #64748b;
  border-radius: 50%;
}

.password-toggle.is-visible .eye-icon::after {
  opacity: 1;
}

input:focus,
select:focus,
.nfe-form textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}

label.emit-field-required:not(.is-field-filled) input:focus,
label.emit-field-required:not(.is-field-filled) select:focus,
label.emit-field-required:not(.is-field-filled) textarea:focus {
  border-color: var(--required);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--required) 18%, transparent);
}

input[readonly] {
  background: #e2e8f0;
  color: #475569;
}

.full-field {
  margin-top: 12px;
}

.nfe-form textarea {
  min-height: 80px;
  resize: vertical;
}

.result-card {
  background: #f8fafc;
}

.danfe-preview {
  padding: 18px;
  overflow: visible;
}

/* Previa na tela: folha A4 (210 x 297 mm) com a mesma margem da impressao. */
@media screen {
  .danfe-preview:has(> .danfe-sheet:not(.danfe-sheet-simple)) {
    background: #d5dce6;
  }

  .danfe-preview:has(> .danfe-sheet:not(.danfe-sheet-simple))::after {
    content: "Previa em folha A4";
    display: block;
    margin-top: 12px;
    color: #64748b;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.01em;
    text-align: center;
  }

  .danfe-preview > .danfe-sheet:not(.danfe-sheet-simple) {
    box-sizing: border-box;
    flex: 0 0 auto;
    align-self: center;
    width: min(100%, 210mm);
    max-width: 210mm;
    aspect-ratio: 210 / 297;
    height: auto;
    min-height: 0;
    margin: 0 auto;
    padding: 3mm;
    overflow: hidden;
    border: none;
    border-radius: 0;
    background: #ffffff;
    box-shadow:
      0 18px 48px rgb(15 23 42 / 22%),
      0 0 0 1px rgb(15 23 42 / 8%);
  }

  .danfe-preview > .danfe-sheet:not(.danfe-sheet-simple)::after {
    content: "";
    position: absolute;
    inset: 3mm;
    border: var(--danfe-line, 0.55px solid #111827);
    pointer-events: none;
    z-index: 4;
  }
}

.danfe-pdf-export-host {
  position: fixed;
  left: 0;
  top: 0;
  z-index: -9999;
  width: 960px;
  background: #ffffff;
  pointer-events: none;
  opacity: 0.01;
}

.danfe-pdf-export-host .danfe-sheet {
  margin: 0;
  box-shadow: none;
}

.empty-state {
  display: grid;
  min-height: min(280px, 45vh);
  place-items: center;
  color: #64748b;
  text-align: center;
}

.danfe-sheet {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  /* ~A4 util com margem ~3mm: preenche melhor a folha sem colar na borda */
  width: 960px;
  min-height: 1355px;
  margin: 0 auto;
  padding: 3px;
  background: #ffffff;
  color: #111827;
  border: var(--danfe-line, 0.55px solid #111827);
  border-radius: 0;
  box-shadow: 0 12px 30px rgb(15 23 42 / 12%);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 9.5px;
  line-height: 1.25;
  --danfe-line: 0.55px solid #111827;
}

.danfe-watermark {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 20;
  width: 140%;
  max-width: none;
  transform: translate(-50%, -50%) rotate(-32deg);
  color: rgb(185 28 28 / 28%);
  font-size: clamp(32px, 5.6vw, 58px);
  font-weight: 800;
  letter-spacing: 0.08em;
  text-align: center;
  text-transform: uppercase;
  white-space: nowrap;
  pointer-events: none;
  user-select: none;
}

.danfe-sheet > *:not(.danfe-watermark) {
  position: relative;
  z-index: 1;
}

.danfe-watermark-fiscal {
  color: rgb(185 28 28 / 30%);
  text-shadow: 0 1px 0 rgb(255 255 255 / 45%);
}

.danfe-watermark-cancelled {
  color: rgb(185 28 28 / 32%);
}

.danfe-watermark-diagonal {
  opacity: 1;
}

.emit-homolog-prod-hint {
  display: none;
  margin: 0 0 10px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid #fcd34d;
  background: #fffbeb;
  color: #92400e;
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.35;
}

.emit-homolog-fill-alert {
  display: none;
  margin: 0 0 10px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid #fdba74;
  background: #fff7ed;
  color: #9a3412;
  font-size: 0.88rem;
  line-height: 1.4;
}

.emit-form-bands.is-homolog .emit-homolog-prod-hint,
.emit-form-bands.is-homolog .emit-homolog-fill-alert {
  display: block;
}

.emit-form-bands.is-homolog .emit-environment-band--form {
  border-color: #fdba74;
  background: #fff7ed;
}

.homolog-emit-confirm-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-top: 1.1rem;
}

.homolog-emit-confirm-actions .secondary,
.homolog-emit-confirm-actions .primary {
  min-width: 8.5rem;
}

.homolog-emit-confirm-card p {
  margin: 0.35rem 0 0;
  color: #334155;
  font-size: 0.98rem;
  line-height: 1.45;
}

.danfe-small-note {
  margin-bottom: 4px;
  text-align: center;
  font-size: 7px;
  text-transform: uppercase;
}

.danfe-canhoto {
  margin-bottom: 0;
}

.danfe-canhoto-grid {
  display: grid;
  grid-template-columns: 108px minmax(0, 1fr) 132px;
  grid-template-rows: auto auto;
  gap: 0;
  margin-bottom: 0;
}

.danfe-canhoto-main,
.danfe-canhoto-nfe,
.danfe-canhoto-field,
.danfe-box,
.danfe-section-title,
.danfe-cell,
.danfe-footer-grid > div,
.danfe-table-cells th,
.danfe-table-cells td,
.danfe-key-block {
  border: var(--danfe-line, 0.55px solid #111827);
  border-radius: 0;
  background: #ffffff;
}

.danfe-canhoto-main {
  grid-column: 1 / 3;
  grid-row: 1;
  min-height: 42px;
  padding: 2px 4px;
  font-size: 7px;
}

.danfe-canhoto-upper {
  margin: 0 0 2px;
  text-transform: uppercase;
}

.danfe-canhoto-main p {
  margin: 0;
}

.danfe-canhoto-nfe {
  grid-column: 3;
  grid-row: 1 / span 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 4px 3px;
  text-align: center;
  font-size: 8px;
  min-height: 62px;
}

.danfe-canhoto-date {
  grid-column: 1;
  grid-row: 2;
  min-width: 108px;
}

.danfe-canhoto-sign {
  grid-column: 2;
  grid-row: 2;
}

.danfe-canhoto-field {
  min-height: 24px;
  padding: 2px 3px;
}

.danfe-canhoto-date.danfe-canhoto-field {
  min-height: 24px;
}

.danfe-canhoto-sign.danfe-canhoto-field {
  min-height: 24px;
}

.danfe-canhoto-nfe strong {
  font-size: 12px;
  font-weight: 800;
  line-height: 1.1;
}

.danfe-canhoto-nfe span {
  display: block;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.25;
}

.danfe-top {
  display: grid;
  grid-template-columns: 1.45fr 0.72fr 1.2fr;
  gap: 0;
  margin-bottom: 0;
}

.danfe-box {
  min-height: 94px;
  padding: 3px;
}

.danfe-box.danfe-key-split {
  padding: 0;
  border: 0;
  background: transparent;
  min-height: 0;
}

.danfe-issuer {
  display: grid;
  gap: 2px;
  align-content: center;
  text-align: center;
}

.danfe-logo {
  margin-bottom: 4px;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.03em;
}

.danfe-title {
  display: grid;
  place-items: center;
  text-align: center;
}

.danfe-title strong {
  display: block;
  font-size: 22px;
  line-height: 1;
}

.danfe-entry-exit {
  display: grid;
  grid-template-columns: 1fr 18px;
  gap: 4px;
  align-items: center;
  margin-top: 4px;
  font-size: 7px;
  text-align: left;
}

.danfe-entry-exit span {
  display: block;
}

.danfe-op-box {
  display: grid;
  width: 18px;
  height: 18px;
  place-items: center;
  border: var(--danfe-line, 0.55px solid #111827);
  border-radius: 3px;
  font-size: 11px;
  font-weight: 700;
}

.danfe-key-split {
  display: grid;
  gap: 0;
}

.danfe-key-block {
  padding: 2px;
}

.danfe-section {
  margin-bottom: 0;
}

.danfe-section:last-child {
  margin-bottom: 0;
}

.danfe-section-products {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.danfe-section-products .danfe-table-products {
  flex: 1;
  min-height: 140px;
}

.danfe-section-products .danfe-table-products tbody {
  height: 100%;
}

.danfe-row {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 0;
  margin-bottom: 0;
}

.danfe-section .danfe-row:last-child {
  margin-bottom: 0;
}

.danfe-row-stack {
  margin-bottom: 0;
}

.danfe-section .danfe-row-stack:last-child {
  margin-bottom: 0;
}

.danfe-row-cells {
  border: 0;
  background: transparent;
  margin-top: -1px;
}

.danfe-row-cells .danfe-cell {
  margin-left: -1px;
}

.danfe-section + .danfe-section,
.danfe-section .danfe-section-title {
  margin-top: -1px;
}

.danfe-cell {
  min-height: 28px;
  padding: 3px 4px 2px;
  box-sizing: border-box;
  overflow: hidden;
  min-width: 0;
}

.danfe-sheet > .danfe-row .danfe-cell,
.danfe-sheet > .danfe-section:not(.danfe-section-products) .danfe-cell {
  min-height: 36px;
}

.danfe-row-header-fields .danfe-cell {
  min-height: 34px;
}

.danfe-section-title {
  margin-top: 0;
  margin-bottom: 0;
  padding: 3px 5px;
  background: #ffffff;
  font-size: 7px;
  font-weight: 800;
  text-transform: uppercase;
  box-sizing: border-box;
}

.danfe-tax-grid-9 {
  grid-template-columns: repeat(9, minmax(0, 1fr));
}

.danfe-cell-tax {
  min-height: 28px;
  padding: 2px 3px;
}

.danfe-cell-tax .danfe-label {
  font-size: 7px;
  line-height: 1.15;
  margin-bottom: 2px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.danfe-cell-tax .danfe-value {
  font-size: 10px;
  line-height: 1.15;
  white-space: nowrap;
}

.danfe-table {
  width: 100%;
  border-collapse: collapse;
  border-spacing: 0;
  font-size: 7px;
  table-layout: fixed;
  margin-bottom: 0;
  background: transparent;
}

.danfe-title span {
  display: block;
  margin-top: 3px;
  font-size: 9px;
  line-height: 1.25;
}

.danfe-number {
  margin-top: 4px;
  font-size: 11px;
  font-weight: 700;
}

.danfe-key {
  display: grid;
  gap: 2px;
  font-size: 7px;
}

.barcode {
  height: 42px;
  background:
    repeating-linear-gradient(
      90deg,
      #111827 0 2px,
      transparent 2px 4px,
      #111827 4px 5px,
      transparent 5px 8px
    );
}

.danfe-access-key {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-align: center;
  word-break: break-all;
}

.span-1 {
  grid-column: span 1;
}

.span-2 {
  grid-column: span 2;
}

.span-3 {
  grid-column: span 3;
}

.span-4 {
  grid-column: span 4;
}

.span-5 {
  grid-column: span 5;
}

.span-6 {
  grid-column: span 6;
}

.span-7 {
  grid-column: span 7;
}

.span-8 {
  grid-column: span 8;
}

.span-9 {
  grid-column: span 9;
}

.span-12 {
  grid-column: span 12;
}

.danfe-label {
  display: block;
  margin-bottom: 2px;
  font-size: 6.5px;
  font-weight: 700;
  line-height: 1.15;
  text-transform: uppercase;
}

.danfe-sheet > .danfe-row .danfe-label,
.danfe-sheet > .danfe-section:not(.danfe-section-products) .danfe-label {
  font-size: 8px;
}

.danfe-value {
  font-size: 9px;
  font-weight: 600;
  line-height: 1.2;
  overflow-wrap: anywhere;
  word-break: break-word;
  max-width: 100%;
}

.danfe-sheet > .danfe-row .danfe-value,
.danfe-sheet > .danfe-section:not(.danfe-section-products) .danfe-value {
  font-size: 11px;
  line-height: 1.2;
  word-break: normal;
  overflow-wrap: break-word;
}

.danfe-sheet > .danfe-section:not(.danfe-section-products) .danfe-section-title {
  font-size: 8.5px;
}

.danfe-value-block {
  display: block;
  white-space: pre-wrap;
}

.danfe-cell-right .danfe-value {
  text-align: right;
}

.danfe-table-cells {
  border: 0;
}

.danfe-table-products th:nth-child(1),
.danfe-table-products td:nth-child(1) {
  width: 7.5%;
}

.danfe-table-products th:nth-child(2),
.danfe-table-products td:nth-child(2) {
  width: 14.5%;
}

.danfe-table-products th:nth-child(3),
.danfe-table-products td:nth-child(3) {
  width: 6.5%;
}

.danfe-table-products th:nth-child(4),
.danfe-table-products td:nth-child(4),
.danfe-table-products th:nth-child(5),
.danfe-table-products td:nth-child(5) {
  width: 4.2%;
}

.danfe-table-products th:nth-child(6),
.danfe-table-products td:nth-child(6) {
  width: 6%;
}

.danfe-table-products th:nth-child(7),
.danfe-table-products td:nth-child(7) {
  width: 6%;
}

.danfe-table-products th:nth-child(8),
.danfe-table-products td:nth-child(8),
.danfe-table-products th:nth-child(9),
.danfe-table-products td:nth-child(9) {
  width: 7.2%;
}

.danfe-table-products th:nth-child(10),
.danfe-table-products td:nth-child(10) {
  width: 6.2%;
}

.danfe-table-products th:nth-child(11),
.danfe-table-products td:nth-child(11),
.danfe-table-products th:nth-child(12),
.danfe-table-products td:nth-child(12) {
  width: 7.5%;
}

.danfe-table-products th:nth-child(13),
.danfe-table-products td:nth-child(13) {
  width: 7%;
}

.danfe-table-products th:nth-child(14),
.danfe-table-products td:nth-child(14),
.danfe-table-products th:nth-child(15),
.danfe-table-products td:nth-child(15) {
  width: 4.25%;
}

.danfe-table-products {
  border-collapse: collapse;
  border-spacing: 0;
  border: var(--danfe-line, 0.55px solid #111827);
  border-radius: 0;
  overflow: hidden;
  margin-bottom: 0;
  table-layout: fixed;
  width: 100%;
}

.danfe-section .danfe-table-products th,
.danfe-section .danfe-table-products td {
  border-radius: 0;
}

.danfe-table th,
.danfe-table td {
  padding: 2px 3px;
  border: var(--danfe-line, 0.55px solid #111827);
  text-align: left;
  vertical-align: top;
  word-break: break-word;
  overflow-wrap: anywhere;
  line-height: 1.2;
  box-sizing: border-box;
}

.danfe-table-products th,
.danfe-table-products td {
  border-top: 0;
  border-bottom: 0;
  border-left: var(--danfe-line, 0.55px solid #111827);
  border-right: var(--danfe-line, 0.55px solid #111827);
  font-size: 8px;
  /* max-width:0 + table-layout:fixed impede vazamento sobre a coluna vizinha */
  max-width: 0;
  overflow: hidden;
  white-space: normal;
  hyphens: manual;
  word-break: normal;
  overflow-wrap: break-word;
}

.danfe-table-products thead th {
  border-top: var(--danfe-line, 0.55px solid #111827);
  border-bottom: var(--danfe-line, 0.55px solid #111827);
  font-size: 6.5px;
  line-height: 1.1;
  font-weight: 700;
  text-transform: uppercase;
  padding-top: 3px;
  padding-bottom: 3px;
}

.danfe-table-products td:nth-child(n + 4),
.danfe-table-products th:nth-child(n + 4) {
  text-align: center;
  white-space: nowrap;
  word-break: normal;
  overflow-wrap: normal;
}

.danfe-table-products td.right,
.danfe-table-products th:nth-child(n + 7) {
  text-align: right;
}

.danfe-table-products tbody tr.danfe-item-row-sep td {
  border-bottom: 0.55px dotted #111827 !important;
}

.danfe-table-products tbody tr:last-child td {
  border-bottom: var(--danfe-line, 0.55px solid #111827) !important;
}

.danfe-table th {
  background: #ffffff;
  font-size: 6px;
  font-weight: 700;
  text-transform: uppercase;
}

.danfe-table-empty {
  height: 8px;
}

.danfe-tax-grid-9 .danfe-cell,
.danfe-tax-grid .danfe-cell {
  min-height: 36px;
}

.danfe-payment-row .danfe-cell {
  min-height: 32px;
}

.danfe-row.danfe-recipient-row .danfe-cell {
  min-height: 32px;
}

.danfe-row.danfe-recipient-row:first-of-type .danfe-cell {
  min-height: 34px;
}

.danfe-products-table td:nth-child(2) {
  text-transform: uppercase;
}

.danfe-table .right {
  text-align: right;
}

.danfe-footer-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  min-height: 42px;
  margin-bottom: 0;
}

.danfe-footer-grid > div {
  min-height: 42px;
  padding: 2px;
}

.danfe-footer-grid > div:last-child {
  border-right: 0;
}

.xml-details {
  display: none;
}

.xml-details pre {
  min-height: 0;
}

.summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 0;
  padding: 18px 20px;
  border-bottom: 1px solid #dbe3ef;
}

.summary div {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 12px;
  min-width: 0;
}

dt {
  margin-bottom: 6px;
  color: #64748b;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
}

dd {
  margin: 0;
  overflow-wrap: anywhere;
  font-weight: 700;
}

@media (max-width: 900px) {
  .sidebar-fab {
    top: 10px;
    left: 10px;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    font-size: 1.15rem;
  }

  .sidebar {
    width: 280px;
  }

  .page {
    padding-top: 62px;
    padding-left: 12px;
    padding-right: 12px;
    width: 100%;
  }

  .shell-layout.sidebar-collapsed .page {
    margin: 0 auto;
    width: 100%;
  }

  .hero,
  .grid,
  .accounts-grid {
    display: block;
  }

  .hero {
    flex-direction: column;
    text-align: center;
    padding: 20px;
  }

  .actions {
    justify-content: center;
    margin-top: 16px;
  }

  .card {
    margin-bottom: 16px;
  }

  .summary {
    grid-template-columns: 1fr;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .page {
    padding: 54px 8px 16px;
  }

  .sidebar-fab {
    top: 8px;
    left: 8px;
    width: 38px;
    height: 38px;
    font-size: 1rem;
    border-radius: 10px;
  }

  .hero {
    padding: 16px;
    border-radius: 12px;
  }

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

  .hero h2 {
    font-size: 1.1rem;
  }

  button, .button {
    font-size: 0.85rem;
    padding: 8px 14px;
  }
}

/* NF-e emit / historico */
.nfe-emit-hero-trailing {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
}

.nfe-meta-dates {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 18px;
  font-size: 0.88rem;
  color: #475569;
  justify-content: flex-end;
}

#emitNotesPage .nfe-meta-dates,
#nfcePage .nfe-meta-dates,
#mdfePage .nfe-meta-dates,
#ctePage .nfe-meta-dates,
#nfsePage .nfe-meta-dates,
#nfeEmitMetaDates,
#nfceEmitMetaDates,
#mdfeEmitMetaDates,
#cteEmitMetaDates,
#nfseEmitMetaDates,
.nfe-meta-dates[hidden] {
  display: none !important;
}

.nfe-meta-item strong {
  font-weight: 700;
  color: #0f172a;
}

.emit-form-bands {
  margin: 0 clamp(6px, 1.5vw, 14px) 16px;
}

.emit-environment-band {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 12px;
}

.emit-environment-band--form {
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
}

.emit-environment-band__label {
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #64748b;
}

.emit-environment-band__options {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 8px;
}

.emit-environment-option {
  padding: 8px 14px;
  border: 1px solid #e2e8f0;
  border-radius: 999px;
  background: #fff;
  color: #1e293b;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.emit-environment-option:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

.emit-environment-option.is-active[data-emit-environment="homologacao"] {
  background: #fef3c7;
  border-color: #f59e0b;
  color: #92400e;
}

.emit-environment-option.is-active[data-emit-environment="producao"] {
  background: #dcfce7;
  border-color: #22c55e;
  color: #166534;
}

.emit-environment-option:focus-visible {
  outline: 2px solid #94a3b8;
  outline-offset: 2px;
}

.emit-form-bands .nfe-composer-tablist {
  margin-top: 12px;
  margin-bottom: 20px;
}

.emit-presets-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  margin-top: 8px;
}

.emit-presets-bar .form-note {
  margin: 0;
}

.nfe-history-panel {
  margin-bottom: 20px;
}

/* Endereços do destinatário: blocos expansíveis */
details.nfe-address-collapsible {
  margin-top: 14px;
  border: 1px solid #dbe3ef;
  border-radius: 14px;
  background: #fafbfd;
}

details.nfe-address-collapsible:first-of-type {
  margin-top: 10px;
}

details.nfe-address-collapsible > summary.nfe-address-collapsible-summary {
  cursor: pointer;
  padding: 12px 16px;
  font-weight: 700;
  font-size: 0.9rem;
  color: #ffffff;
  background: #1d4ed8;
  border: none;
  border-radius: 12px 12px 0 0;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  user-select: none;
}

details.nfe-address-collapsible:not([open]) > summary.nfe-address-collapsible-summary {
  border-radius: 12px;
}

details.nfe-address-collapsible summary .nfe-address-collapsible-title {
  font-weight: 800;
}

details.nfe-address-collapsible summary .nfe-address-collapsible-affordance {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  opacity: 0.95;
}

details.nfe-address-collapsible summary .nfe-address-collapsible-verb .nfe-address-verb-expanded {
  display: none;
}

details.nfe-address-collapsible[open] summary .nfe-address-collapsible-verb .nfe-address-verb-expanded {
  display: inline;
}

details.nfe-address-collapsible[open] summary .nfe-address-collapsible-verb .nfe-address-verb-collapsed {
  display: none;
}

details.nfe-address-collapsible summary .nfe-address-collapsible-chevron {
  display: inline-flex;
  font-weight: 800;
  line-height: 1;
  transform: rotate(0deg);
  transition: transform 0.18s ease;
}

details.nfe-address-collapsible[open] summary .nfe-address-collapsible-chevron {
  transform: rotate(90deg);
}

details.nfe-address-collapsible > summary::-webkit-details-marker {
  display: none;
}

details.nfe-address-collapsible .nfe-address-collapsible-body {
  padding: 0 16px 16px;
  border-top: 1px solid #e2e8f0;
  margin-top: 0;
  padding-top: 14px;
}

details.nfe-address-collapsible > summary.nfe-address-collapsible-summary:hover {
  filter: brightness(1.05);
}

details.nfe-address-collapsible > summary.nfe-address-collapsible-summary:focus-visible {
  outline: 2px solid #fcd34d;
  outline-offset: 2px;
}

.nfe-composer-tablist {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 0 clamp(6px, 1.5vw, 14px) 20px;
  padding: 0;
}

.nfe-composer-tab {
  padding: 8px 14px;
  border: 1px solid #e2e8f0;
  border-radius: 999px;
  background: #f8fafc;
  color: #1e293b;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.nfe-composer-tab:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

.nfe-composer-tab.is-active {
  background: #1e293b;
  border-color: #1e293b;
  color: #fff;
}

.nfe-composer-tab:focus-visible {
  outline: 2px solid #94a3b8;
  outline-offset: 2px;
}

.meus-dados-badge {
  display: inline-block;
  margin-right: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  vertical-align: middle;
  background: #dbeafe;
  color: #1d4ed8;
}

.saved-profile-priority {
  font-size: 0.88rem;
}

.nfe-tax-summary-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 6px 0;
  border-bottom: 1px dashed #e2e8f0;
  margin-bottom: 8px;
  font-size: 0.95rem;
}

.nfe-tax-estimates-table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
  font-size: 0.9rem;
}

.nfe-tax-estimates-table th,
.nfe-tax-estimates-table td {
  border: 1px solid #e2e8f0;
  padding: 8px 10px;
  text-align: left;
}

.nfe-tax-estimates-table th {
  background: #f8fafc;
}

.nfe-tax-estimates-table .nfe-tax-apply-cell {
  text-align: center;
}

.nfe-tax-estimates-table .nfe-tax-value-cell {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.nfe-tax-estimates-table .nfe-tax-value-cell.is-highlighted {
  color: var(--accent, #0b5fff);
  font-weight: 700;
  background: color-mix(in srgb, var(--accent, #0b5fff) 8%, transparent);
}

.nfe-tax-highlight-panel {
  margin-top: 12px;
  padding: 12px 14px;
  border: 1px solid color-mix(in srgb, var(--accent, #0b5fff) 28%, #d0d7de);
  background: color-mix(in srgb, var(--accent, #0b5fff) 6%, #fff);
}

.nfe-tax-custom-base-panel {
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px dashed var(--border);
  background: color-mix(in srgb, var(--surface-muted) 8%, var(--surface));
  display: grid;
  gap: 8px;
}

.nfe-tax-custom-base-fields {
  display: grid;
  grid-template-columns: minmax(140px, 220px) 1fr;
  gap: 12px;
  align-items: end;
}

.nfe-tax-custom-base-fields label {
  display: grid;
  gap: 4px;
  font-size: 0.9rem;
}

.nfe-tax-custom-base-derived {
  display: grid;
  gap: 4px;
  font-size: 0.9rem;
}

.nfe-tax-custom-base-derived strong {
  font-variant-numeric: tabular-nums;
}

@media (max-width: 720px) {
  .nfe-tax-custom-base-fields {
    grid-template-columns: 1fr;
  }
}

.nfe-tax-highlight-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
  margin-bottom: 8px;
}

.nfe-tax-highlight-list {
  margin: 0 0 8px;
  padding-left: 1.2rem;
}

.nfe-tax-highlight-list li {
  margin: 0.2rem 0;
}

.nfe-history-tax-list {
  display: grid;
  gap: 8px;
  margin: 8px 0 12px;
}

.nfe-history-tax-row {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 10px;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid #d8dee6;
  background: #fafbfc;
}

.nfe-history-tax-row.is-highlighted {
  border-color: color-mix(in srgb, var(--accent, #0b5fff) 40%, #d8dee6);
  background: color-mix(in srgb, var(--accent, #0b5fff) 8%, #fff);
}

.nfe-history-tax-row .nfe-history-tax-value {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.nfe-tax-estimates-table input[type="number"] {
  width: 100%;
  min-width: 4rem;
  max-width: 7rem;
}

.nfe-tax-subopt {
  margin-top: 6px;
  font-size: 0.82rem;
  font-weight: 400;
}

.nfe-tax-total-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid #e2e8f0;
  font-size: 1rem;
}

.nfe-tax-total-line span {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.nfe-tax-value-cell.nfe-tax-inactive {
  opacity: 0.5;
}

.nfe-composer-surface .nfe-fieldset,
.emit-doc-grid .form-card form .nfe-fieldset.form-step-panel {
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 16px 18px;
  margin-bottom: 24px;
}

.emit-doc-grid .form-card form .nfe-fieldset:not(.form-step-panel) {
  margin-bottom: 22px;
}

.emit-doc-grid .emit-doc-card-hint.form-note {
  margin: 0;
  align-self: center;
  text-align: right;
}

@media (max-width: 640px) {
  .emit-doc-grid .emit-doc-card-hint.form-note {
    text-align: left;
  }
}

.nfe-recipient-search {
  position: relative;
  display: block;
  width: 100%;
}

.nfe-recipient-search input {
  width: 100%;
}

.nfe-autocomplete {
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  z-index: 10;
  margin: 4px 0 0;
  padding: 4px 0;
  list-style: none;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgb(15 23 42 / 12%);
  max-height: 220px;
  overflow: auto;
}

.nfe-autocomplete li button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 12px;
  border: none;
  background: transparent;
  cursor: pointer;
  font: inherit;
}

.nfe-autocomplete li button:hover {
  background: #f1f5f9;
}

.nfe-item-grid {
  display: grid;
  grid-template-columns: minmax(120px, 1.4fr) repeat(5, minmax(72px, auto)) auto;
  gap: 8px;
  align-items: end;
  margin-bottom: 8px;
}

.nfe-item-tax-row {
  display: grid;
  grid-template-columns: minmax(140px, 0.9fr) minmax(200px, 1.4fr) minmax(160px, 1fr);
  gap: 8px;
  align-items: end;
  margin-bottom: 12px;
}

.nfe-item-sit-hint {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.35;
  align-self: center;
}

.nfe-item-ncm-hint {
  margin: 0 0 8px;
  font-size: 0.82rem;
  line-height: 1.35;
  color: #475569;
}

.nfe-authorize-block-hint {
  margin: 0.35rem 0 0.75rem;
  color: #b45309;
}

#sendButton.is-blocked,
#sendButton:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  filter: grayscale(0.15);
  pointer-events: none;
}

.nfe-cfop-tp-hint.is-error {
  color: #b91c1c;
  font-weight: 600;
}

.nfe-cfop-mismatch {
  border-color: #dc2626 !important;
  box-shadow: 0 0 0 1px color-mix(in srgb, #dc2626 35%, transparent);
}

.nfe-item-product-q {
  text-transform: uppercase;
}

@media (max-width: 980px) {
  .nfe-item-grid,
  .nfe-item-tax-row {
    grid-template-columns: 1fr;
  }
}

.nfe-item-search-cell {
  position: relative;
}

.nfe-item-suggest {
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  z-index: 9;
}

.nfe-line-totals {
  margin: 10px 0;
  font-size: 0.92rem;
}

.nfe-final-actions {
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.emit-composer-final-actions {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid #e2e8f0;
}

.nfe-fieldset.nfe-optional {
  margin-top: 12px;
}

.nfe-gta-grid {
  margin-top: 10px;
}

.nfe-final-actions .nfe-obs-inline {
  flex: 1 1 220px;
}

.nfe-post-emit-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px dashed #e2e8f0;
}

.danfe-sheet-simple {
  padding: 20px;
  font-size: 12px;
}

.nfe-subsection-title {
  margin: 12px 0 8px;
  font-size: 0.95rem;
  font-weight: 600;
}

.checkbox-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 20px;
  margin-top: 8px;
}

.nfe-person-type {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  align-items: center;
}

.form-label-inline {
  font-size: 0.82rem;
  font-weight: 600;
  color: #64748b;
}

.nfe-compact-row {
  max-width: 220px;
}

.nfe-defaults-snapshots-library.has-snapshots #nfeDefaultsLibraryEmpty {
  display: none;
}

/* ── Home Page ─────────────────────────────────── */

.page:has(#homePage:not([hidden])) {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
  min-height: 100vh;
  min-height: 100dvh;
}

#homePage.home-page:not([hidden]) {
  display: block;
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  box-sizing: border-box;
}

#homePage.home-page[hidden] {
  display: none !important;
}

.home-page-inset {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  box-sizing: border-box;
  background: var(--sidebar-bg);
  padding: 0 clamp(14px, 2vw, 22px) clamp(14px, 2vw, 22px);
}

.home-header-band {
  padding: clamp(24px, 6vh, 72px) clamp(16px, 4vw, 48px) clamp(20px, 4vh, 48px);
  background: linear-gradient(165deg, #0f172a 0%, #1e3a8a 48%, #2563eb 100%);
  box-shadow: 0 10px 40px rgba(15, 23, 42, 0.18);
}

.home-hero {
  display: grid;
  grid-template-rows: 1fr auto;
  flex: 1;
  width: 100%;
  min-height: 0;
  padding: clamp(24px, 4vh, 40px) clamp(20px, 3vw, 40px) clamp(16px, 2.5vh, 28px);
  background: var(--page-bg);
  box-sizing: border-box;
}

.home-brand {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: clamp(16px, 2.5vw, 24px);
  margin: 0 auto;
  max-width: 1080px;
  width: 100%;
  text-align: left;
}

.home-brand-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 6px;
  min-width: 0;
}

.home-brand-mark {
  display: grid;
  flex-shrink: 0;
  width: 72px;
  height: 72px;
  place-items: center;
  border-radius: 20px;
  background: #2563eb;
  color: #fff;
  font-size: 2rem;
  font-weight: 900;
  box-shadow: 0 8px 30px rgba(37, 99, 235, 0.25);
  overflow: hidden;
}

.home-brand-mark .brand-mark-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
}

.home-brand h1 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 2.75rem);
  color: #f8fafc;
  letter-spacing: -0.03em;
  line-height: 1.1;
  text-shadow: 0 2px 18px rgba(15, 23, 42, 0.35);
}

.home-brand p {
  margin: 0;
  color: #dbeafe;
  font-size: clamp(1rem, 1.8vw, 1.15rem);
  max-width: 520px;
  line-height: 1.45;
}

:root[data-theme="dark"] .home-header-band {
  background: linear-gradient(165deg, #020617 0%, #172554 52%, #1d4ed8 100%);
}

:root[data-theme="dark"] .home-brand h1 {
  color: #f8fafc;
}

:root[data-theme="dark"] .home-brand p {
  color: #bfdbfe;
}

.home-actions-frame {
  grid-row: 1;
  align-self: start;
  justify-self: center;
  width: min(96%, 1080px);
  margin: 0 auto clamp(20px, 4vh, 40px);
  padding: clamp(18px, 2.5vw, 28px) clamp(20px, 3vw, 32px);
  border: 3px solid #334155;
  border-radius: 4px;
  background: transparent;
  box-sizing: border-box;
}

:root[data-theme="dark"] .home-actions-frame {
  border-color: #64748b;
}

.home-actions {
  display: flex;
  flex-direction: column;
  gap: 22px;
  width: 100%;
}

.home-actions-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.home-actions-group-title {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #475569;
}

.home-actions-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 14px;
  width: 100%;
}

.home-actions-row--emit,
.home-actions-row--settings,
.home-actions-row--misc {
  display: flex;
}

.home-action-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1 1 148px;
  min-width: min(100%, 132px);
  max-width: 220px;
  gap: 6px;
  padding: 22px 14px;
  border: 1px solid #dbe3ef;
  border-radius: 16px;
  background: #fff;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
  box-shadow: 0 4px 16px rgba(22, 32, 51, 0.06);
  text-align: center;
  box-sizing: border-box;
}

.home-action-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 32px rgba(22, 32, 51, 0.12);
  border-color: #2563eb;
}

.home-action-icon {
  font-size: 1.6rem;
  line-height: 1;
}

.home-action-card strong {
  font-size: 0.88rem;
  color: #0f172a;
}

.home-emitter-balloon {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: grid;
  place-items: center;
  padding: 1.25rem;
  background: rgba(15, 23, 42, 0.45);
}

.home-emitter-balloon[hidden] {
  display: none !important;
}

.home-emitter-balloon-card {
  position: relative;
  width: min(420px, 100%);
  padding: 1.5rem 1.35rem 1.35rem;
  border-radius: 18px;
  background: var(--surface, #fff);
  border: 1px solid var(--border, #dbe3ef);
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.22);
  text-align: center;
}

.home-emitter-balloon-back {
  position: absolute;
  top: 0.7rem;
  left: 0.7rem;
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 999px;
  border: 1px solid var(--border, #dbe3ef);
  background: color-mix(in srgb, var(--surface, #fff) 88%, #e2e8f0);
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
}

.home-emitter-balloon-card h2 {
  margin: 0.35rem 0 0.5rem;
  font-size: 1.35rem;
}

.home-emitter-balloon-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  justify-content: center;
  margin-top: 1.1rem;
}

.home-emitter-balloon-choice {
  flex: 1 1 150px;
  max-width: 200px;
  min-width: 140px;
}

.home-emitter-balloon-choice.home-action-card {
  margin: 0;
}

.recipient-doc-box {
  margin: 0 0 1rem;
  padding: 0.9rem 1rem 1rem;
  border: 1px solid var(--border, #dbe3ef);
  border-radius: 12px;
  background: color-mix(in srgb, var(--surface, #fff) 94%, #e2e8f0);
}

.recipient-doc-box legend {
  padding: 0 0.35rem;
  font-weight: 700;
}

.emit-presets-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem 0.75rem;
  align-items: end;
}

.emit-presets-picker label {
  display: grid;
  gap: 0.25rem;
  font-size: 0.82rem;
  min-width: 120px;
}

.emit-preset-name-field {
  min-width: min(100%, 240px);
  flex: 1 1 240px;
}

.emit-preset-combo {
  position: relative;
}

.emit-preset-combo input[type="search"] {
  width: 100%;
  box-sizing: border-box;
}

.emit-preset-combo-list {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  z-index: 40;
  margin: 0;
  padding: 0.35rem 0;
  list-style: none;
  max-height: 220px;
  overflow: auto;
  border: 1px solid var(--border, #dbe3ef);
  border-radius: 10px;
  background: var(--surface, #fff);
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.14);
}

.emit-preset-combo-list[hidden] {
  display: none !important;
}

.emit-preset-combo-option {
  padding: 0.55rem 0.75rem;
  cursor: pointer;
  font-size: 0.88rem;
}

.emit-preset-combo-option:hover,
.emit-preset-combo-option.is-selected {
  background: color-mix(in srgb, var(--accent, #2563eb) 12%, transparent);
}

.emit-preset-combo-empty {
  padding: 0.55rem 0.75rem;
  color: #64748b;
  font-size: 0.85rem;
}

.home-action-card small {
  font-size: 0.72rem;
  color: #94a3b8;
}

.home-session-info {
  grid-row: 2;
  justify-self: center;
  margin: clamp(12px, 2vh, 24px) 0 0;
  color: #64748b;
  font-size: 0.88rem;
  text-align: center;
}

.home-session-info a {
  color: #2563eb;
  cursor: pointer;
  text-decoration: underline;
  background: none;
  border: none;
  font: inherit;
}

@media (max-width: 1100px) {
  .home-action-card {
    max-width: none;
  }
}

@media (max-width: 900px) {
  .home-action-card {
    flex-basis: calc(50% - 8px);
    max-width: none;
  }
}

@media (max-width: 600px) {
  .home-header-band {
    padding: clamp(40px, 9vh, 72px) 14px clamp(24px, 5vh, 40px);
  }

  .home-hero {
    padding: 16px 12px 12px;
  }

  .home-brand {
    gap: 14px;
  }

  .home-actions-frame {
    width: 100%;
    padding: 14px 12px;
    border-width: 2px;
    border-radius: 4px;
  }

  .home-actions-row--emit,
  .home-actions-row--settings,
  .home-actions-row--misc {
    gap: 12px;
  }

  .home-action-card {
    flex-basis: calc(50% - 8px);
    max-width: none;
    padding: 16px 10px;
  }

  .home-brand-mark {
    width: 56px;
    height: 56px;
    font-size: 1.6rem;
    border-radius: 16px;
  }

  .home-brand h1 {
    font-size: 1.6rem;
  }

  .home-brand p {
    font-size: 0.92rem;
  }

  .home-action-card {
    padding: 16px 10px;
  }

  .home-action-card strong {
    font-size: 0.8rem;
  }
}

@media (max-width: 380px) {
  .home-action-card {
    flex-basis: 100%;
    max-width: none;
  }

  .home-brand {
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
  }
}

/* ── Dashboard ─────────────────────────────────── */

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.dash-card {
  text-align: center;
  padding: 20px 14px;
}

.dash-card h3 {
  margin: 0 0 8px;
  font-size: 0.82rem;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.dash-big-number {
  display: block;
  font-size: 2rem;
  font-weight: 800;
  color: #0f172a;
  line-height: 1.1;
}

.dash-card small {
  color: #94a3b8;
  font-size: 0.75rem;
}

.dash-card-alert .dash-big-number {
  color: #dc2626;
}

.dashboard-charts {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

.dashboard-charts .card {
  padding: 20px;
}

.dashboard-charts h3 {
  margin: 0 0 12px;
  font-size: 0.95rem;
  color: #0f172a;
}

.dash-chart-area {
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.dash-chart-placeholder {
  color: #94a3b8;
  font-size: 0.85rem;
}

.dash-bar-chart {
  width: 100%;
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 180px;
}

.dash-bar {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.dash-bar-fill {
  width: 100%;
  max-width: 40px;
  background: #2563eb;
  border-radius: 4px 4px 0 0;
  min-height: 2px;
  transition: height 0.3s ease;
}

.dash-bar-label {
  font-size: 0.65rem;
  color: #64748b;
  text-align: center;
  white-space: nowrap;
}

.dash-bar-value {
  font-size: 0.7rem;
  font-weight: 600;
  color: #0f172a;
}

.dash-totals-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.dash-totals-group + .dash-totals-group {
  margin-top: 18px;
}

.dash-totals-group h4 {
  margin: 0 0 10px;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #64748b;
}

.dash-totals-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: #f8fafc;
  border-radius: 8px;
}

.dash-totals-item strong {
  font-size: 0.88rem;
  color: #0f172a;
}

.dash-totals-item span {
  font-size: 0.85rem;
  color: #2563eb;
  font-weight: 600;
}

.dashboard-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 18px;
}

.dashboard-tab {
  border: 1px solid #dbe3ef;
  background: #fff;
  color: #334155;
  border-radius: 999px;
  padding: 8px 14px;
  font-weight: 700;
  cursor: pointer;
}

.dashboard-tab.is-active {
  background: var(--accent, #2563eb);
  border-color: var(--accent, #2563eb);
  color: #fff;
}

.dashboard-recent {
  margin-top: 16px;
  padding: 20px;
}

.dashboard-recent-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.dashboard-recent-head h3,
.dashboard-charts h3 {
  margin: 0;
}

.dash-recent-list {
  display: grid;
  gap: 8px;
}

.dash-recent-item {
  display: grid;
  gap: 2px;
  padding: 10px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #f8fafc;
}

.dash-recent-item strong {
  color: #0f172a;
}

.dash-recent-item span {
  color: #64748b;
  font-size: 0.82rem;
}

/* ── Document History ──────────────────────────── */

.doc-history-controls {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  align-items: flex-end;
}

.doc-history-controls select,
.doc-history-controls input {
  padding: 8px 12px;
  border: 1px solid #dbe3ef;
  border-radius: 8px;
  font-size: 0.88rem;
  background: #fff;
}

.doc-history-controls input[type="checkbox"] {
  width: auto;
  padding: 0;
  border: 0;
  background: transparent;
}

.doc-history-filter-row,
.doc-history-fields {
  flex: 1 0 100%;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  align-items: flex-end;
}

.doc-history-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  font-size: 0.88rem;
  cursor: pointer;
}

.doc-history-fields label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0;
  font-size: 0.78rem;
  color: #475569;
}

.doc-history-fields label[hidden] {
  display: none !important;
}

.doc-history-controls input[type="search"] {
  min-width: 180px;
}

.doc-history-month-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin: -4px 0 16px;
}

.doc-history-month-row input[type="month"] {
  min-width: 150px;
  padding: 8px 12px;
  border: 1px solid #dbe3ef;
  border-radius: 8px;
  font-size: 0.88rem;
  background: #fff;
}

.doc-history-export-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin: 0 0 16px;
  padding: 14px 16px;
  border: 1px solid #c7d7f0;
  border-radius: 12px;
  background: #f3f7ff;
}

.doc-history-export-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 220px;
}

.doc-history-export-text strong {
  font-size: 0.92rem;
  color: #0f172a;
}

.doc-history-export-text span {
  font-size: 0.8rem;
  color: #64748b;
}

.doc-history-export-bar select {
  padding: 8px 12px;
  border: 1px solid #dbe3ef;
  border-radius: 8px;
  font-size: 0.88rem;
  background: #fff;
  min-width: 160px;
}

.doc-history-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.doc-history-table th,
.doc-history-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid #e2e8f0;
}

.doc-history-table th {
  background: #f8fafc;
  color: #64748b;
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.doc-history-table td.empty-state {
  text-align: center;
  color: #94a3b8;
  padding: 40px;
}

.doc-history-table .doc-actions {
  display: flex;
  gap: 6px;
}

.doc-history-table .doc-actions button {
  padding: 4px 10px;
  font-size: 0.76rem;
  border-radius: 6px;
  border: 1px solid #dbe3ef;
  background: #fff;
  cursor: pointer;
  transition: background 0.15s;
}

.doc-history-table .doc-actions button:hover {
  background: #f1f5f9;
}

.doc-history-pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  margin-top: 16px;
}

.doc-history-pagination button {
  padding: 6px 14px;
  border-radius: 8px;
  border: 1px solid #dbe3ef;
  background: #fff;
  cursor: pointer;
}

.doc-history-pagination button:disabled {
  opacity: 0.4;
  cursor: default;
}

/* ── Certificates Page ─────────────────────────── */

.certs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

.certs-list,
.certs-alerts-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cert-item {
  padding: 12px;
  border-radius: 10px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
}

.cert-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.cert-item-header strong {
  font-size: 0.88rem;
  color: #0f172a;
}

.cert-badge {
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 600;
}

.cert-badge-ok {
  background: #dcfce7;
  color: #166534;
}

.cert-badge-warn {
  background: #fef9c3;
  color: #854d0e;
}

.cert-badge-expired {
  background: #fecaca;
  color: #991b1b;
}

.cert-item small {
  display: block;
  color: #64748b;
  font-size: 0.78rem;
}

.cert-item-actions {
  margin-top: 8px;
  display: flex;
  gap: 6px;
}

.cert-item-actions button {
  padding: 4px 10px;
  font-size: 0.76rem;
  border-radius: 6px;
  border: 1px solid #dbe3ef;
  background: #fff;
  cursor: pointer;
}

@media (max-width: 900px) {
  .dashboard-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .dashboard-charts {
    grid-template-columns: 1fr;
  }
  .doc-history-controls {
    flex-direction: column;
  }
  .doc-history-controls input[type="search"] {
    min-width: auto;
    width: 100%;
  }
  .certs-grid {
    grid-template-columns: 1fr;
  }
}

/* Welcome modal for first-time visitors */
.onboarding-overlay {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgb(15 23 42 / 52%);
  backdrop-filter: blur(4px);
}

.onboarding-overlay[hidden] {
  display: none !important;
}

.onboarding-dialog {
  position: relative;
  width: min(100%, 460px);
  padding: 28px 28px 24px;
  border-radius: 20px;
  border: 1px solid #dbe3ef;
  background: #ffffff;
  box-shadow: 0 28px 70px rgb(15 23 42 / 22%);
}

.onboarding-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 999px;
  background: #f1f5f9;
  color: #334155;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}

.onboarding-close:hover {
  background: #e2e8f0;
}

.onboarding-back {
  position: absolute;
  top: 12px;
  left: 12px;
  border: 0;
  border-radius: 999px;
  background: #f1f5f9;
  color: #334155;
  font-size: 0.88rem;
  font-weight: 600;
  padding: 8px 12px;
  cursor: pointer;
}

.onboarding-back:hover {
  background: #e2e8f0;
}

.onboarding-dialog--auth {
  width: min(100%, 520px);
}

.onboarding-dialog--auth .auth-modal-tabs {
  margin-top: 0.5rem;
}

.onboarding-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  margin-bottom: 12px;
  border-radius: 14px;
  background: linear-gradient(145deg, #2563eb, #1d4ed8);
  color: #ffffff;
  font-size: 1.5rem;
  font-weight: 800;
}

.onboarding-dialog h2 {
  margin: 0 0 10px;
  font-size: 1.55rem;
  line-height: 1.2;
}

.onboarding-dialog p {
  margin: 0 0 20px;
  color: #475569;
  line-height: 1.5;
}

.onboarding-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.onboarding-actions .ghost {
  border: 0;
  background: transparent;
  color: #475569;
  font-weight: 600;
  padding: 10px 12px;
  cursor: pointer;
}

.onboarding-actions .ghost:hover {
  color: #1e293b;
  background: #f8fafc;
  border-radius: 10px;
}

.nfse-summary-inline {
  margin-top: 8px;
  padding: 0;
  border-bottom: 0;
}

/* Auth + planos flow modals */
body.flow-modal-open,
body.onboarding-open {
  overflow: hidden;
}

.flow-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1250;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgb(15 23 42 / 52%);
  backdrop-filter: blur(4px);
}

.flow-modal-overlay[hidden] {
  display: none !important;
}

.flow-modal-dialog {
  position: relative;
  width: min(100%, 460px);
  max-height: min(92vh, 900px);
  overflow: auto;
  padding: 24px 24px 20px;
  border-radius: 20px;
  border: 1px solid #dbe3ef;
  background: #ffffff;
  box-shadow: 0 28px 70px rgb(15 23 42 / 22%);
}

.flow-modal-dialog--planos {
  width: min(100%, 760px);
}

.planos-page-card {
  max-width: 960px;
}

.planos-page-card .planos-portal--compact {
  padding: 0.25rem 0;
}

.subscription-checkout-card {
  max-width: 720px;
}

.subscription-plan-summary {
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border, #c6d2e1);
}

.subscription-plan-summary h2 {
  margin: 0.15rem 0 0.35rem;
}

.subscription-plan-price {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--accent, #2563eb);
}

.subscription-payment-box {
  margin-bottom: 1.25rem;
  padding: 1rem 1.1rem;
  border-radius: 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
}

.subscription-payment-box h3 {
  margin: 0 0 0.5rem;
}

.subscription-payment-options {
  margin: 0.75rem 0;
  padding-left: 1.2rem;
}

.subscription-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.flow-modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 999px;
  background: #f1f5f9;
  color: #334155;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}

.flow-modal-close:hover {
  background: #e2e8f0;
}

.auth-modal-tabs {
  display: flex;
  gap: 0.35rem;
  margin: 1rem 0;
  padding: 4px;
  border-radius: 999px;
  background: #f1f5f9;
}

.auth-modal-tab {
  flex: 1;
  border: 0;
  background: transparent;
  padding: 0.55rem 0.75rem;
  border-radius: 999px;
  font-weight: 600;
  cursor: pointer;
  color: #64748b;
}

.auth-modal-tab.is-active {
  background: #ffffff;
  color: #0f172a;
  box-shadow: 0 1px 3px rgb(15 23 42 / 12%);
}

.auth-modal-panel[hidden] {
  display: none !important;
}

.flow-modal-footer {
  margin-top: 1.25rem;
  display: flex;
  justify-content: flex-end;
}

.planos-modal-head h2 {
  margin: 0 0 0.35rem;
}

.planos-modal-head .planos-header-lead {
  margin: 0;
  color: var(--muted, #526070);
}

.planos-modal-reason {
  margin: 0.75rem 0 0;
  padding: 0.65rem 0.85rem;
  border-radius: 10px;
  background: #fff7ed;
  border: 1px solid #fdba74;
  color: #9a3412;
  font-size: 0.92rem;
}

.history-search-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: min(100%, 520px);
  margin-top: 16px;
  padding: 4px 14px 4px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.04);
}

.history-search-chevron {
  flex-shrink: 0;
  width: 0.45rem;
  height: 0.45rem;
  margin-left: 4px;
  border-right: 2px solid #64748b;
  border-bottom: 2px solid #64748b;
  transform: rotate(45deg);
  translate: 0 -2px;
}

.history-search-bar input[type="search"] {
  flex: 1;
  min-width: 0;
  min-height: 38px;
  border: 0;
  background: transparent;
  padding: 8px 4px;
  font-weight: 600;
  font-size: 0.92rem;
}

.history-search-bar input[type="search"]:focus {
  outline: none;
}

.history-search-bar:focus-within {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.nfe-items-summary {
  margin-top: 12px;
  font-weight: 700;
  color: #334155;
}

.nfe-composer-tablist {
  justify-content: flex-start;
}

.hero {
  flex-wrap: wrap;
}

.hero h1 {
  overflow-wrap: anywhere;
}

.nfe-emit-hero-trailing {
  min-width: 0;
}

.shell-layout {
  overflow-x: clip;
}

@media (max-width: 720px) {
  .history-search-bar {
    max-width: 100%;
  }

  .nfe-composer-tablist {
    gap: 8px;
  }

  .home-action-card {
    min-width: min(100%, 120px);
  }
}
