@import url("https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&display=swap");

:root {
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-soft: #eff6ff;
  --primary-soft-text: #2563eb;
  --bg-body: #f1f5f9;
  --bg-card: #ffffff;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-nav: #475569;
  --border: #e2e8f0;
  --dark-rail: #1f2537;
  --dark-rail-border: #2f3751;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Manrope", sans-serif;
  background: var(--bg-body);
  color: var(--text-main);
  font-size: 0.9rem;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

.menu-curtain {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.28);
  z-index: 30;
}

.app-shell {
  display: grid;
  grid-template-columns: 64px 260px 1fr;
  min-height: 100vh;
  transition: grid-template-columns 0.22s ease;
}

.icon-rail {
  background: var(--dark-rail);
  border-right: 1px solid var(--dark-rail-border);
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 12px 8px;
}

.rail-item {
  width: 40px;
  height: 40px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  color: #c2cde3;
  text-decoration: none;
  transition: 0.15s ease;
}

.rail-item:hover {
  background: #2d3550;
  color: #fff;
}

.rail-item.active {
  background: #ef3340;
  color: #fff;
}

.rail-item .material-symbols-outlined {
  font-size: 21px;
}

.rail-item.rail-spacer {
  margin-top: 6px;
}

.sidebar {
  width: 260px;
  height: 100vh;
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  position: sticky;
  top: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
  transition: transform 0.22s ease, opacity 0.18s ease, width 0.22s ease;
  transform-origin: left center;
}

body.menu-collapsed .app-shell {
  grid-template-columns: 64px 0 1fr;
}

body.menu-collapsed .sidebar {
  width: 0;
  opacity: 0;
  transform: translateX(-24px);
  pointer-events: none;
  border-right: 0;
  overflow: hidden;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  height: 64px;
  min-height: 64px;
  padding: 0 15px;
  border-bottom: 1px solid #f1f5f9;
}

.sidebar-brand-main {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-icon {
  font-size: 28px;
  color: #3b82f6;
  flex-shrink: 0;
}

.brand-title {
  margin: 0;
  font-size: 1.12rem;
  font-weight: 800;
  color: #1e293b;
  text-transform: uppercase;
}

.brand-subtitle {
  margin: 0;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.sidebar-hide-btn {
  width: 36px;
  min-width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid #dbe3ef;
  color: #64748b;
}

.sidebar-hide-btn .material-symbols-outlined {
  font-size: 18px;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 10px 12px;
  overflow-y: auto;
}

.nav-section {
  font-size: 0.69rem;
  font-weight: 800;
  color: #94a3b8;
  margin: 16px 0 6px 12px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  color: var(--text-nav);
  text-decoration: none;
  border-radius: 8px;
  margin-bottom: 2px;
  transition: 0.2s;
  font-weight: 500;
  font-size: 0.97rem;
  min-height: 44px;
}

.nav-item .material-symbols-outlined {
  font-size: 21px;
  min-width: 22px;
}

.nav-item:hover {
  background: #f8fafc;
  color: #1e293b;
}

.nav-item.active {
  background: var(--primary-soft);
  color: var(--primary-soft-text);
  font-weight: 700;
}

.nav-item-danger {
  color: #ef4444;
}

.nav-item-danger:hover {
  background: #fef2f2;
}

.content-shell {
  padding: 22px 22px 28px;
  min-width: 0;
  max-width: 100%;
  overflow-x: hidden;
}

.content-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  gap: 14px;
}

.page-title {
  margin: 0;
  color: #0f172a;
  font-size: 2rem;
  font-weight: 700;
}

.page-subtitle {
  margin: 4px 0 0;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.btn {
  height: 38px;
  border: 0;
  border-radius: 6px;
  padding: 0 16px;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.85rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 4px 6px -1px rgba(79, 70, 229, 0.2);
}

.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-ghost {
  background: #f8fafc;
  color: #334155;
  border: 1px solid #cbd5e1;
}

.btn-ghost:hover {
  background: #eef2f7;
}

.menu-toggle-btn {
  min-width: 104px;
}

.btn-danger-soft {
  background: #fff1f2;
  color: #be123c;
  border: 1px solid #fecdd3;
  height: 34px;
  padding: 0 12px;
}

.btn-danger-soft:hover {
  background: #ffe4e6;
}

.page-card {
  margin-top: 12px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  min-width: 0;
  max-width: 100%;
}

.card-header {
  padding: 14px 16px;
  border-bottom: 1px solid #e7edf5;
}

.card-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: #22314a;
}

.section-subtitle {
  margin: 4px 0 0;
  color: #70819b;
  font-size: 0.85rem;
}

.card-content {
  padding: 14px 16px;
  min-width: 0;
  max-width: 100%;
}

.contas-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
}

.contas-tabs {
  display: flex;
  gap: 0;
  flex-wrap: wrap;
  border-bottom: 1px solid #dbe3ef;
  margin-bottom: 18px;
}

.contas-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  text-decoration: none;
  color: #475569;
  border: 1px solid transparent;
  border-bottom: 0;
  border-radius: 10px 10px 0 0;
  margin-bottom: -1px;
  font-weight: 600;
}

.contas-tab.active {
  background: #fff;
  color: #1e293b;
  border-color: #dbe3ef;
}

.contas-tab .material-symbols-outlined {
  font-size: 19px;
}

.contas-create {
  margin: 4px 0 18px;
  padding: 14px 16px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #f8fbff;
}

.toolbar-main-search {
  max-width: 420px;
}

.filter-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.52);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 1000;
}

.filter-modal-backdrop[hidden] {
  display: none !important;
}

.filter-modal {
  width: min(980px, 100%);
  max-height: 88vh;
  overflow: auto;
  background: #fff;
  border-radius: 16px;
  border: 1px solid #dbe3ef;
  box-shadow: 0 28px 80px rgba(15, 23, 42, 0.25);
  padding: 18px;
}

.filter-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 16px;
}

body.modal-open {
  overflow: hidden;
}

.contas-board-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.contas-inline-form {
  margin: 0;
}

.contas-sync-btn {
  white-space: nowrap;
}

.contas-subfilters {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  align-items: center;
  gap: 8px;
  margin: 0;
}

.contas-subfilters-group {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  margin: 0;
}

.contas-subfilters-inline {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: nowrap;
  gap: 8px;
  width: min(100%, 980px);
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 2px;
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 #eef2f7;
}

.contas-subfilter {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid #d6dee8;
  background: #fff;
  color: #64748b;
  text-decoration: none;
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1;
}

.contas-subfilter-compact {
  min-height: 30px;
  padding: 0 10px;
  font-size: 0.75rem;
  white-space: nowrap;
}

.contas-subfilters-divider {
  display: inline-block;
  width: 1px;
  min-width: 1px;
  height: 18px;
  background: #dbe3ef;
  margin: 0 2px;
}

.contas-subfilter.active {
  background: #eef2ff;
  border-color: #a5b4fc;
  color: #4338ca;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

@media (max-width: 1100px) {
  .contas-subfilters-inline {
    width: 100%;
    justify-content: flex-start;
  }
}

.contas-table-wrap {
  width: 100%;
  max-width: 100%;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #fff;
  overflow: visible;
}

.contas-table-scroll {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: visible;
  scrollbar-gutter: stable both-edges;
  padding-bottom: 2px;
}

.contas-table {
  width: 100%;
  min-width: 1680px;
  border-collapse: collapse;
}

.contas-table-scroll::-webkit-scrollbar {
  height: 12px;
}

.contas-table-scroll::-webkit-scrollbar-track {
  background: #eef2f7;
  border-radius: 999px;
}

.contas-table-scroll::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 999px;
  border: 2px solid #eef2f7;
}

.contas-table-scroll::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

.contas-table th,
.contas-table td {
  padding: 12px 14px;
  border-bottom: 1px solid #edf2f7;
  text-align: left;
  vertical-align: top;
  font-size: 0.84rem;
}

.contas-table th {
  background: #f8fafc;
  color: #64748b;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0.01em;
}

.contas-col-acoes {
  width: 52px;
  min-width: 52px;
  text-align: center !important;
}

.contas-col-acoes .material-symbols-outlined {
  font-size: 18px;
  color: #64748b;
}

.contas-table tbody tr:nth-child(odd) {
  background: #fbfdff;
}

.contas-empty {
  text-align: center !important;
  color: #64748b;
  padding: 24px !important;
}

.contas-action-btn {
  width: 32px;
  min-width: 32px;
  height: 32px;
  padding: 0;
  background: #f8fafc;
  color: #475569;
  border: 1px solid #d6dee8;
  border-radius: 10px;
}

.contas-actions-menu {
  position: relative;
  min-width: 32px;
}

.contas-actions-menu summary {
  list-style: none;
}

.contas-actions-menu summary::-webkit-details-marker {
  display: none;
}

.contas-actions-list {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 20;
  min-width: 180px;
  margin: 0;
  padding: 8px;
  list-style: none;
  background: #ffffff;
  border: 1px solid #d6dee8;
  border-radius: 12px;
  box-shadow: 0 18px 36px rgba(15, 23, 42, 0.14);
}

.contas-actions-list.is-floating {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1000;
}

.contas-actions-menu.menu-open-up .contas-actions-list:not(.is-floating) {
  top: auto;
  bottom: calc(100% + 8px);
}

.contas-action-item {
  width: 100%;
  justify-content: flex-start;
  padding: 0 12px;
  background: #fff;
  color: #334155;
  border: 0;
  font-weight: 500;
}

.contas-actions-list form {
  margin: 0;
}

.contas-action-item-danger {
  color: #b91c1c;
  font-weight: 500;
}

.contas-action-item-danger:hover {
  background: #fef2f2;
  color: #991b1b;
}

.contas-actions-list li + li {
  margin-top: 8px;
}

.contas-action-empty {
  padding: 8px 10px;
  color: #64748b;
  font-size: 0.84rem;
}

.contas-action-btn .material-symbols-outlined {
  font-size: 20px;
}

.conta-pi-chip {
  display: inline-flex;
  align-items: center;
  min-height: auto;
  padding: 0;
  background: transparent;
  color: #334155;
  border-radius: 0;
  font-weight: 600;
  white-space: nowrap;
}

.conta-vencimento {
  color: #ef4444;
  font-weight: 500;
}

.conta-observacao-tooltip {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: transparent;
  color: #2563eb;
  cursor: help;
}

.conta-observacao-tooltip .material-symbols-outlined {
  font-size: 18px;
}

.comissao-liberada-indicador {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  background: transparent;
  color: #3b82f6;
}

.comissao-liberada-indicador .material-symbols-outlined {
  font-size: 22px;
}

.coluna-comissao-liberada {
  text-align: center !important;
}

.conta-observacao-balao {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 10px);
  transform: translateX(-50%);
  min-width: 220px;
  max-width: 320px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #0f172a;
  color: #fff;
  font-size: 0.8rem;
  line-height: 1.45;
  box-shadow: 0 18px 36px rgba(15, 23, 42, 0.24);
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
  transition: opacity 0.16s ease, transform 0.16s ease, visibility 0.16s ease;
  white-space: normal;
  z-index: 25;
}

.conta-observacao-balao::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 100%;
  transform: translateX(-50%);
  border-width: 6px;
  border-style: solid;
  border-color: #0f172a transparent transparent transparent;
}

.conta-observacao-tooltip:hover .conta-observacao-balao,
.conta-observacao-tooltip:focus-visible .conta-observacao-balao {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(-2px);
}

.nfse-info-box {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 16px 18px;
  margin-bottom: 18px;
  border-radius: 14px;
  border: 1px solid #cfe8d8;
  background: #f4fbf7;
  color: #1f5137;
}

.nfse-info-box .material-symbols-outlined {
  font-size: 24px;
}

.nfse-info-box-warning {
  border-color: #f3d29b;
  background: #fff8ec;
  color: #8a5a00;
}

.nfse-homologacao-btn {
  border-color: #f5d089 !important;
  background: #fff7e8 !important;
  color: #8a5a00 !important;
}

.recibo-paper {
  width: min(1120px, 100%);
  margin: 0 auto;
  min-height: 1480px;
  background: #fff;
  color: #111827;
  padding: 64px 76px 44px;
  border: 1px solid #dbe3ef;
  box-shadow: 0 22px 50px rgba(15, 23, 42, 0.08);
}

.recibo-top {
  display: flex;
  justify-content: center;
  margin-bottom: 86px;
}

.recibo-logo {
  max-width: 360px;
  max-height: 120px;
  object-fit: contain;
}

.recibo-logo-placeholder,
.recibo-stamp-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #94a3b8;
  border: 1px dashed #cbd5e1;
  border-radius: 12px;
  background: #f8fafc;
}

.recibo-logo-placeholder {
  width: 280px;
  height: 90px;
}

.recibo-body {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1rem;
  line-height: 1.8;
  text-align: justify;
}

.recibo-body p {
  margin: 0;
  font-size: 1rem;
}

.recibo-date-line {
  margin-top: 110px;
  text-align: center;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1rem;
}

.recibo-signature-area {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 32px;
  margin-top: 96px;
  min-height: 220px;
}

.recibo-signature-block {
  width: 42%;
}

.recibo-signature-image {
  max-width: 280px;
  max-height: 110px;
  object-fit: contain;
  display: block;
}

.recibo-signature-line {
  width: 280px;
  border-bottom: 1px solid #94a3b8;
  margin-bottom: 12px;
}

.recibo-signature-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-family: Georgia, "Times New Roman", serif;
}

.recibo-stamp-block {
  width: 34%;
  display: flex;
  justify-content: flex-end;
}

.recibo-stamp-image {
  max-width: 320px;
  max-height: 220px;
  object-fit: contain;
}

.recibo-stamp-placeholder {
  width: 260px;
  height: 180px;
}

.recibo-footer {
  margin-top: 92px;
  text-align: center;
  font-family: Georgia, "Times New Roman", serif;
}

.recibo-footer p {
  margin: 4px 0;
}

.pi-paper {
  width: min(980px, 100%);
  margin: 0 auto;
  background: #fff;
  color: #111827;
  padding: 28px 28px 34px;
  border: 1px solid #dbe3ef;
  box-shadow: 0 22px 50px rgba(15, 23, 42, 0.08);
  font-family: "Times New Roman", Georgia, serif;
}

.pi-paper-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.pi-logo-wrap {
  width: 100%;
  display: flex;
  justify-content: flex-end;
}

.pi-logo {
  max-width: 180px;
  max-height: 54px;
  object-fit: contain;
}

.pi-logo-placeholder {
  width: 180px;
  height: 54px;
  border: 1px dashed #cbd5e1;
  color: #94a3b8;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.82rem;
}

.pi-paper-header h1 {
  margin: 0;
  font-size: 1.08rem;
  text-align: center;
}

.pi-section {
  margin-top: 16px;
}

.pi-section h3 {
  margin: 0;
  text-align: center;
  font-size: 1rem;
}

.pi-table {
  width: 100%;
  border-collapse: collapse;
}

.pi-table th,
.pi-table td {
  border: 1px solid #4b5563;
  padding: 4px 6px;
  font-size: 0.86rem;
  line-height: 1.25;
  vertical-align: top;
}

.pi-table th {
  width: 26%;
  text-align: left;
  white-space: nowrap;
}

.pi-grid-table td {
  width: 33.33%;
}

.pi-parcelas-table th {
  width: auto;
}

.pi-empty {
  text-align: center;
  color: #64748b;
}

.pi-date-line {
  margin-top: 24px;
  text-align: right;
}

.pi-date-line p {
  margin: 0;
  font-size: 0.96rem;
}

.pi-signatures {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 40px;
  margin-top: 58px;
}

.pi-signature-block {
  text-align: center;
}

.pi-signature-line {
  border-top: 1px solid #9ca3af;
  margin-bottom: 6px;
}

.pi-signature-block p,
.pi-signature-block span {
  margin: 0;
  display: block;
  font-size: 0.85rem;
}

.pi-footer {
  margin-top: 30px;
  text-align: center;
}

.pi-footer p {
  margin: 0;
  font-size: 0.84rem;
  line-height: 1.35;
}

.empresa-logo-upload {
  display: flex;
  align-items: flex-start;
  gap: 18px;
  margin-top: 12px;
}

.empresa-logo-preview-wrap {
  width: 220px;
  height: 120px;
  border: 1px dashed #cbd5e1;
  border-radius: 14px;
  background: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.empresa-logo-preview {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.empresa-logo-placeholder {
  color: #94a3b8;
  font-size: 0.9rem;
  text-align: center;
  padding: 12px;
}

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

.nfse-status-grid,
.nfse-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-top: 18px;
}

.nfse-status-card,
.nfse-summary-card {
  padding: 18px;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  background: #ffffff;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.05);
}

.nfse-status-card {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.nfse-status-card .material-symbols-outlined {
  color: #4f46e5;
}

.nfse-summary-card h3 {
  margin: 0 0 12px;
  font-size: 1rem;
  color: #1e293b;
}

.nfse-summary-card p {
  margin: 0 0 8px;
  color: #475569;
}

.nfse-service-description {
  margin: 0;
  color: #475569;
  line-height: 1.7;
  white-space: pre-wrap;
}

.nfse-preview-sheet {
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  border: 1px solid #dbe3ef;
  border-radius: 18px;
  padding: 24px;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.08);
  transition: box-shadow 0.25s ease, border-color 0.25s ease, transform 0.25s ease;
}

.nfse-preview-sheet-highlight {
  border-color: #4f46e5;
  box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.12), 0 22px 48px rgba(79, 70, 229, 0.16);
  transform: translateY(-2px);
}

.nfse-preview-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  padding-bottom: 18px;
  border-bottom: 1px solid #e2e8f0;
}

.nfse-preview-kicker {
  margin: 0 0 6px;
  color: #4f46e5;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.nfse-preview-header h3 {
  margin: 0;
  font-size: 1.35rem;
  color: #0f172a;
}

.nfse-preview-subtitle {
  margin: 6px 0 0;
  color: #64748b;
  font-size: 0.9rem;
}

.nfse-preview-badge {
  min-width: 150px;
  padding: 14px 16px;
  border-radius: 14px;
  background: #eef2ff;
  border: 1px solid #c7d2fe;
  color: #312e81;
}

.nfse-preview-badge span {
  display: block;
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 4px;
}

.nfse-preview-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  margin-top: 18px;
  border: 1px solid #dbe3ef;
  border-radius: 14px;
  overflow: hidden;
}

.nfse-preview-strip div {
  padding: 14px 16px;
  background: #eef4ff;
  border-right: 1px solid #dbe3ef;
}

.nfse-preview-strip div:last-child {
  border-right: 0;
}

.nfse-preview-strip span,
.nfse-preview-table span {
  display: block;
  margin-bottom: 6px;
  color: #64748b;
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.nfse-preview-strip strong,
.nfse-preview-table strong {
  color: #0f172a;
  font-size: 0.96rem;
}

.nfse-preview-panel {
  margin-top: 16px;
  padding: 18px;
  border-radius: 14px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
}

.nfse-preview-panel h4 {
  margin: 0 0 12px;
  color: #0f172a;
  font-size: 0.98rem;
}

.nfse-preview-table {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.nfse-preview-table-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.nfse-preview-table div {
  padding: 14px;
  border-radius: 12px;
  background: #f8fbff;
  border: 1px solid #e6edf7;
}

.nfse-preview-description-box {
  padding: 16px 18px;
  border-radius: 12px;
  background: #f8fbff;
  border: 1px solid #e6edf7;
}

.nfse-preview-description-box p {
  margin: 0;
  color: #475569;
  line-height: 1.7;
  white-space: pre-wrap;
}

.nfse-preview-footer {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px dashed #cbd5e1;
}

.nfse-preview-footer p {
  margin: 0;
  color: #64748b;
  font-size: 0.82rem;
}

@media print {
  .sidebar,
  .icon-rail,
  .content-header,
  .nfse-info-box,
  .nfse-summary-grid,
  .form-actions,
  form[action^="/fiscal/nfse/"],
  .section-subtitle {
    display: none !important;
  }

  .app-shell,
  .content-shell,
  .page-card,
  .card-content {
    display: block !important;
    background: #fff !important;
    box-shadow: none !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
  }

  .nfse-preview-sheet {
    box-shadow: none !important;
    border: 1px solid #000 !important;
    border-radius: 0 !important;
    padding: 14mm !important;
    background: #fff !important;
  }

  .nfse-preview-strip,
  .nfse-preview-panel,
  .nfse-preview-table div,
  .nfse-preview-description-box {
    break-inside: avoid;
  }

  .recibo-no-print,
  .sidebar,
  .icon-rail,
  .content-header {
    display: none !important;
  }

  .recibo-screen-shell,
  .recibo-paper {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    box-shadow: none !important;
    border: 0 !important;
  }

  .pi-no-print,
  .sidebar,
  .icon-rail,
  .content-header {
    display: none !important;
  }

  .pi-screen-shell,
  .pi-paper {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    box-shadow: none !important;
    border: 0 !important;
  }
}

.kpi-grid {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.contas-kpi-grid {
  align-items: stretch;
}

.contas-grid-action-btn {
  min-height: 36px !important;
  padding: 0 14px !important;
  font-size: 0.8rem !important;
}

.contas-create-modal-backdrop {
  display: flex;
}

.contas-create-modal {
  width: min(920px, calc(100vw - 40px));
}

.kpi-box {
  background: #fff;
  border-radius: 8px;
  border: 1px solid var(--border);
  padding: 16px 20px;
  flex: 1;
  min-width: 200px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  border-left: 4px solid #cbd5e1;
}

.kpi-box.total {
  border-left-color: #3b82f6;
}

.kpi-box.ativos {
  border-left-color: #10b981;
}

.kpi-box.inativos {
  border-left-color: #ef4444;
}

.kpi-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}

.kpi-box.total .kpi-icon {
  background: #eff6ff;
  color: #3b82f6;
}

.kpi-box.ativos .kpi-icon {
  background: #dcfce7;
  color: #10b981;
}

.kpi-box.inativos .kpi-icon {
  background: #fef2f2;
  color: #ef4444;
}

.kpi-label {
  margin: 0;
  font-size: 12px;
  color: #64748b;
  font-weight: 700;
  text-transform: uppercase;
}

.kpi-value {
  margin: 3px 0 0;
  font-size: 26px;
  font-weight: 800;
  color: #0f172a;
  line-height: 1;
  display: block;
}

.kpi-hint {
  margin: 4px 0 0;
  color: #6f7f9b;
  font-size: 0.77rem;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}

.date-range-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.date-range-fields input {
  min-width: 0;
}

.field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
  margin-bottom: 6px;
  text-transform: uppercase;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  min-height: 38px;
  padding: 0 12px;
  background: #fff;
  font-size: 0.83rem;
  color: #22324c;
  font-family: inherit;
}

.field textarea {
  padding: 10px 12px;
  min-height: 90px;
}

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

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--primary);
}

.form-actions {
  margin-top: 14px;
  display: flex;
  justify-content: flex-end;
  gap: 14px;
  flex-wrap: wrap;
}

@media (max-width: 720px) {
  .date-range-fields {
    grid-template-columns: 1fr;
  }
}

.card-actions-bottom {
  margin-top: auto;
  padding-top: 8px;
}

.toolbar {
  background: white;
  padding: 16px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  margin-bottom: 16px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  align-items: end;
}

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

.entity-card {
  background: white;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  transition: transform 0.2s, box-shadow 0.2s;
}

.entity-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  border-color: #cbd5e1;
}

.entity-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.entity-title {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.25;
  color: #0f172a;
  font-weight: 800;
}

.badge {
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.66rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.badge-success {
  color: #16a34a;
  background: #dcfce7;
}

.badge-warning {
  color: #9a3412;
  background: #ffedd5;
}

.badge-info {
  color: #1f4d86;
  background: #dce9ff;
}

.badge-danger {
  color: #b91c1c;
  background: #fee2e2;
}

.entity-meta {
  margin-top: 4px;
  display: grid;
  gap: 4px;
  color: #475569;
  font-size: 0.84rem;
}

.entity-meta strong {
  color: #0f172a;
}

.segmented-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  overflow: hidden;
}

.segmented-toggle label {
  position: relative;
  cursor: pointer;
}

.segmented-toggle input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.segmented-toggle span {
  display: block;
  text-align: center;
  padding: 10px 12px;
  background: #fff;
  color: #475569;
  font-weight: 700;
}

.segmented-toggle input:checked + span {
  background: #64748b;
  color: #fff;
}

.chip-check-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip-check {
  position: relative;
  cursor: pointer;
}

.chip-check input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.chip-check span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  padding: 7px 12px;
  color: #334155;
  font-weight: 600;
  background: #fff;
}

.chip-check input:checked + span {
  border-color: #4f46e5;
  background: #eef2ff;
  color: #3730a3;
}

.repeat-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(130px, 1fr));
  gap: 10px;
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px dashed #d8e0ef;
}

.pedido-section {
  padding: 14px 0;
  border-bottom: 1px solid #e7edf5;
}

.pedido-section-grid-dupla {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  align-items: start;
}

.pedido-section-card {
  border-bottom: 0;
  padding: 14px 0;
  min-width: 0;
}

.pedido-section:last-of-type {
  border-bottom: 0;
}

.pedido-section-title {
  margin: 0 0 10px;
  color: #1e3a8a;
  font-size: 0.9rem;
  text-transform: none;
  letter-spacing: 0.03em;
}

form[action^="/pedidos"] .field label,
form[action^="/pedidos/"] .field label {
  text-transform: none;
}

form[action^="/pedidos"] .financeiro-parcelas-table th,
form[action^="/pedidos/"] .financeiro-parcelas-table th {
  text-transform: none;
}

.pedido-section-head {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.pedido-section-head .pedido-section-title {
  margin-bottom: 0;
}

.pedido-section-hint {
  margin: 4px 0 0;
  color: #64748b;
  font-size: 0.83rem;
}

.pedido-financeiro-head {
  justify-content: space-between;
  align-items: flex-start;
}

.pedido-financeiro-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.pedido-financeiro-trigger {
  background: #16a34a;
  color: #fff;
  border: 1px solid #15803d;
}

.pedido-financeiro-trigger:hover {
  background: #15803d;
}

.pedido-financeiro-cancel {
  background: #fff1f2;
  color: #be123c;
  border: 1px solid #fecdd3;
}

.pedido-financeiro-cancel:hover:not(:disabled) {
  background: #ffe4e6;
}

.pedido-financeiro-cancel:disabled {
  background: #f8fafc;
  color: #94a3b8;
  border-color: #cbd5e1;
  cursor: not-allowed;
}

.pedido-grid-dados-gerais {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  align-items: start;
}

.pedido-field-email {
  grid-column: span 2;
}

.pedido-field-valor {
  min-width: 0;
}

.pedido-field-descricao {
  grid-column: 1 / -1;
}

.pedido-field-descricao textarea {
  min-height: 120px;
}

.pedido-grid-financeiro {
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 14px;
  align-items: start;
  padding: 16px;
  border: 1px solid #dbe5f1;
  border-radius: 14px;
  background: linear-gradient(180deg, #fcfdff 0%, #f8fbff 100%);
}

.pedido-financeiro-tipo-venda {
  grid-column: span 2;
}

.pedido-financeiro-tipo-venc {
  grid-column: span 2;
}

.pedido-financeiro-empresa,
.pedido-financeiro-conta,
.pedido-financeiro-pagamento {
  grid-column: span 2;
}

.pedido-financeiro-conta-paga,
.pedido-financeiro-liberar {
  grid-column: span 3;
}

.pedido-grid-financeiro .field input[readonly] {
  background: #f8fafc;
  color: #334155;
  font-weight: 700;
}

.pedido-financeiro-modal-backdrop {
  z-index: 60;
}

.pedido-financeiro-modal {
  width: min(1180px, calc(100vw - 32px));
}

.pedido-financeiro-modal-actions {
  margin-top: 18px;
  margin-bottom: 0;
}

.financeiro-parcelas {
  margin-top: 18px;
  padding: 14px;
  border: 1px solid #dbe5f1;
  border-radius: 10px;
  background: #f8fbff;
}

.financeiro-parcelas-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.financeiro-parcelas-header h4 {
  margin: 0;
  font-size: 0.95rem;
  color: #22314a;
}

.financeiro-parcelas-table-wrap {
  overflow-x: auto;
}

.financeiro-parcelas-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

.financeiro-parcelas-table th,
.financeiro-parcelas-table td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid #e2e8f0;
  font-size: 0.84rem;
  white-space: nowrap;
}

.financeiro-parcelas-table th {
  color: #475569;
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: #eef4fb;
}

.financeiro-date-input {
  width: 100%;
  max-width: 210px;
  height: 36px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 0 10px;
  background: #fff;
  color: #1e293b;
  font: inherit;
}

.financeiro-liberacao-inline {
  display: grid;
  grid-template-columns: 210px 18px;
  align-items: center;
  column-gap: 14px;
  width: 242px;
}

.financeiro-liberacao-header {
  display: grid;
  grid-template-columns: 210px 18px;
  align-items: center;
  column-gap: 14px;
  width: 242px;
}

.financeiro-liberacao-col {
  text-align: left !important;
  vertical-align: middle;
  min-width: 250px;
}

.financeiro-hoje-check {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: #16a34a;
  cursor: pointer;
}

.copy-link-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: center;
}

.copy-link-row .btn {
  white-space: nowrap;
}

.repeat-lines {
  display: grid;
  gap: 10px;
  margin-bottom: 10px;
}

.repeat-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(130px, 190px) auto;
  gap: 12px;
  align-items: end;
  padding: 12px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: linear-gradient(180deg, #fbfdff 0%, #f8fbff 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.repeat-line-action {
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  gap: 8px;
  padding-bottom: 1px;
  min-width: 0;
}

.repeat-line-wide {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
}

.repeat-line-body {
  min-width: 0;
}

.repeat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.repeat-remove-btn {
  width: 40px;
  min-width: 40px;
  padding: 0;
}

.repeat-inline-add-btn {
  width: 40px;
  min-width: 40px;
  padding: 0;
  border: 1px solid #bbf7d0;
  background: #ecfdf5;
  color: #15803d;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.repeat-inline-add-btn:hover {
  background: #dcfce7;
  border-color: #86efac;
  color: #166534;
}

.repeat-inline-add-btn .material-symbols-outlined,
.repeat-remove-btn .material-symbols-outlined {
  font-size: 18px;
}

@media (max-width: 1200px) {
  .pedido-grid-dados-gerais {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .pedido-grid-financeiro {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .pedido-field-email,
  .pedido-field-descricao {
    grid-column: 1 / -1;
  }

  .pedido-financeiro-tipo-venda,
  .pedido-financeiro-tipo-venc,
  .pedido-financeiro-empresa,
  .pedido-financeiro-conta,
  .pedido-financeiro-pagamento,
  .pedido-financeiro-conta-paga,
  .pedido-financeiro-liberar {
    grid-column: auto;
  }

  .repeat-grid {
    grid-template-columns: repeat(2, minmax(150px, 1fr));
  }

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

  .repeat-line {
    grid-template-columns: 1fr 1fr auto;
  }

  .repeat-line-wide {
    grid-template-columns: 1fr;
  }

  .pedido-section-grid-dupla {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .pedido-financeiro-head {
    align-items: stretch;
  }
}

@media (max-width: 720px) {
  .pedido-grid-dados-gerais {
    grid-template-columns: 1fr;
  }

  .pedido-grid-financeiro {
    grid-template-columns: 1fr;
    padding: 14px;
  }

  .pedido-field-email,
  .pedido-field-descricao {
    grid-column: auto;
  }

  .repeat-line {
    grid-template-columns: 1fr;
  }

  .repeat-line-action {
    justify-content: flex-start;
    padding-bottom: 0;
  }

  .pedido-financeiro-modal {
    width: min(100vw - 18px, 100%);
  }

  .copy-link-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1100px) {
  .app-shell {
    grid-template-columns: 56px 1fr;
  }

  .sidebar {
    position: fixed;
    left: 56px;
    top: 0;
    z-index: 40;
    display: flex;
    box-shadow: 0 18px 48px rgba(15, 23, 42, 0.18);
  }

  .content-shell {
    grid-column: 1 / -1;
    padding-top: 14px;
  }

  body.menu-collapsed .app-shell {
    grid-template-columns: 56px 1fr;
  }

  body.menu-collapsed .sidebar {
    display: flex;
    width: 260px;
    opacity: 0;
    transform: translateX(-28px);
    pointer-events: none;
  }

  .page-title {
    font-size: 1.75rem;
  }
}

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

  .icon-rail {
    position: static;
    height: auto;
    flex-direction: row;
    justify-content: center;
    border-right: 0;
    border-bottom: 1px solid var(--dark-rail-border);
    padding: 8px;
  }

  .content-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .content-shell {
    padding: 14px;
  }

  .menu-toggle-btn {
    min-width: auto;
  }

  .contas-tabs {
    gap: 8px;
    border-bottom: 0;
  }

  .contas-tab {
    border: 1px solid #dbe3ef;
    border-radius: 999px;
    margin-bottom: 0;
  }

  .repeat-line {
    grid-template-columns: 1fr;
  }

  .repeat-line-action {
    padding-bottom: 0;
  }

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

.auth-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #eef2ff 0%, #f8fafc 55%, #e2e8f0 100%);
}

.auth-shell {
  width: min(440px, calc(100vw - 24px));
}

.auth-card {
  background: #ffffff;
  border: 1px solid #dbe4f0;
  border-radius: 14px;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.08);
  padding: 22px;
}

.auth-header h1 {
  margin: 0;
  color: #0f172a;
  font-size: 1.5rem;
}

.auth-header p {
  margin: 6px 0 0;
  color: #64748b;
}

.auth-brand {
  margin: 0 0 10px;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: #4f46e5;
}

.auth-form {
  display: grid;
  gap: 12px;
}

.auth-submit {
  margin-top: 6px;
  width: 100%;
}

.auth-badge {
  margin-bottom: 12px;
}

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

.card-outline {
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 12px;
  background: #fff;
}

.table-wrap {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.data-table th,
.data-table td {
  border-bottom: 1px solid #e2e8f0;
  padding: 10px 8px;
  vertical-align: top;
}

.data-table th {
  font-size: 0.76rem;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.empty-state {
  color: #64748b;
  text-align: center;
  padding: 16px;
}

.actions-cell {
  display: flex;
  gap: 8px;
  align-items: center;
}

.btn-sm {
  min-height: 32px;
  height: 32px;
  padding: 0 10px;
  font-size: 0.76rem;
}

.btn-danger {
  background: #fee2e2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}

.btn-danger:hover {
  background: #fecaca;
}

.nav-item-button {
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
  font-family: inherit;
}

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