:root {
  --bg: #f5f7fa;
  --bg-soft: #eef4ff;
  --surface: #ffffff;
  --surface-muted: #f8fafc;
  --surface-strong: #eff6ff;
  --sidebar: #0f172a;
  --sidebar-soft: #111c33;
  --sidebar-card: rgba(15, 23, 42, 0.72);
  --primary: #2563eb;
  --primary-strong: #1d4ed8;
  --primary-soft: #dbeafe;
  --secondary: #06b6d4;
  --success: #10b981;
  --success-soft: #d1fae5;
  --warning: #f59e0b;
  --warning-soft: #fef3c7;
  --danger: #ef4444;
  --danger-soft: #fee2e2;
  --text: #0f172a;
  --text-muted: #64748b;
  --text-subtle: #94a3b8;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 24px;
  --shadow: 0 18px 45px rgba(15, 23, 42, 0.08);
  --shadow-soft: 0 10px 30px rgba(15, 23, 42, 0.06);
  --font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-xs: 11px;
  --font-sm: 12px;
  --font-base: 13px;
  --font-md: 14px;
  --font-lg: 18px;
  --font-xl: 24px;
  --font-page-title: 32px;
  --font-regular: 400;
  --font-medium: 500;
  --font-semibold: 600;
  --font-bold: 700;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(37, 99, 235, 0.13), transparent 36rem),
    radial-gradient(circle at 90% 10%, rgba(6, 182, 212, 0.11), transparent 30rem),
    var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 20% 10%, rgba(37, 99, 235, 0.22), transparent 28rem),
    linear-gradient(135deg, #0f172a, #1e293b);
  padding: 24px;
}

.auth-overlay.hidden {
  display: none;
}

.auth-card {
  width: min(420px, 100%);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 26px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.28);
  padding: 28px;
}

.auth-card h1 {
  margin: 0;
  color: var(--text);
  font-size: 28px;
  font-weight: 900;
  letter-spacing: -0.04em;
}

.auth-card p {
  margin: 8px 0 20px;
  color: var(--text-muted);
  font-size: 14px;
}

.auth-card .btn {
  width: 100%;
  margin-top: 14px;
}

.session-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  padding: 8px 10px 8px 14px;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 750;
}

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

button {
  cursor: pointer;
}

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

code {
  color: var(--primary-strong);
  font-weight: 700;
}

.app-shell {
  display: grid;
  min-height: 100vh;
  grid-template-columns: 280px minmax(0, 1fr);
  transition: grid-template-columns 240ms ease;
}

body.sidebar-collapsed .app-shell {
  grid-template-columns: 72px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  height: 100vh;
  flex-direction: column;
  gap: 18px;
  overflow: visible;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  background:
    linear-gradient(180deg, rgba(15, 23, 42, 0.98), rgba(15, 23, 42, 0.94)),
    radial-gradient(circle at top left, rgba(37, 99, 235, 0.5), transparent 16rem);
  color: #e2e8f0;
  padding: 22px 16px;
  transition: padding 240ms ease;
}

.sidebar-toggle {
  position: absolute;
  z-index: 20;
  top: 22px;
  right: -14px;
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 999px;
  background: #0f172a;
  color: #dbeafe;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.24);
  font-size: 20px;
  line-height: 1;
  transition: background 180ms ease, border-color 180ms ease, color 180ms ease, transform 180ms ease;
}

.sidebar-toggle:hover {
  border-color: rgba(103, 232, 249, 0.54);
  background: #172554;
  color: #fff;
  transform: scale(1.04);
}

.brand-card {
  position: relative;
  display: grid;
  min-height: 94px;
  align-content: center;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.075), rgba(255, 255, 255, 0.035));
  padding: 16px;
  overflow: hidden;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.18);
  transition: min-height 240ms ease, padding 240ms ease, border-radius 240ms ease;
}

.eyebrow {
  margin: 0;
  color: #67e8f9;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.25em;
  text-transform: uppercase;
}

.brand-title {
  margin: 8px 0 0;
  color: #fff;
  font-size: 24px;
  line-height: 1;
  font-weight: 850;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: opacity 180ms ease, transform 180ms ease;
}

.brand-copy {
  margin: 10px 0 0;
  color: #94a3b8;
  font-size: 13px;
  line-height: 1.55;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  border: 1px solid rgba(16, 185, 129, 0.24);
  border-radius: 999px;
  background: rgba(16, 185, 129, 0.12);
  color: #a7f3d0;
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 750;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #34d399;
  box-shadow: 0 0 0 4px rgba(52, 211, 153, 0.13);
}

.nav-group {
  display: flex;
  min-height: 0;
  flex: 1;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  overflow-x: visible;
  padding: 2px 2px 12px;
  scrollbar-width: thin;
  scrollbar-color: rgba(148, 163, 184, 0.38) transparent;
}

.nav-group::-webkit-scrollbar {
  width: 6px;
}

.nav-group::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.38);
}

.nav-section {
  display: grid;
  gap: 7px;
}

.nav-section-toggle {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: #64748b;
  padding: 3px 8px;
  text-align: left;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  transition: color 180ms ease, background 180ms ease;
}

.nav-section-toggle:hover {
  background: rgba(255, 255, 255, 0.04);
  color: #93c5fd;
}

.nav-section-arrow {
  color: #64748b;
  font-size: 13px;
  letter-spacing: 0;
  transition: transform 180ms ease, color 180ms ease;
}

.nav-section-collapsed .nav-section-arrow {
  transform: rotate(90deg);
}

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

.nav-section-collapsed .nav-section-items {
  display: none;
}

.nav-label {
  margin: 4px 10px 2px;
  color: #64748b;
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.nav-item,
.nav-link {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: flex-start;
  gap: 11px;
  position: relative;
  border: 1px solid transparent;
  border-radius: 14px;
  background: transparent;
  color: #cbd5e1;
  padding: 9px 10px;
  text-align: left;
  font-size: 13px;
  font-weight: 750;
  text-decoration: none;
  transition: background 180ms ease, color 180ms ease, border-color 180ms ease, transform 180ms ease, box-shadow 180ms ease;
}

.nav-item > span:first-child,
.nav-link > span:first-child {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: opacity 160ms ease, transform 160ms ease;
}

.nav-item:hover,
.nav-link:hover {
  transform: translateX(1px);
  border-color: rgba(148, 163, 184, 0.14);
  background: rgba(255, 255, 255, 0.07);
  color: #fff;
}

.nav-active {
  border-color: rgba(103, 232, 249, 0.35);
  background: linear-gradient(135deg, rgba(34, 211, 238, 0.92), rgba(37, 99, 235, 0.96));
  color: #fff;
  box-shadow: 0 12px 26px rgba(37, 99, 235, 0.24);
}

.nav-active:hover {
  transform: translateX(1px);
  background: linear-gradient(135deg, #22d3ee, #2563eb);
  color: #fff;
}

.nav-icon {
  display: inline-grid;
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 12px;
  background: rgba(148, 163, 184, 0.13);
  color: inherit;
  transition: background 180ms ease, transform 180ms ease;
}

.nav-icon svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.85;
}

.nav-item:hover .nav-icon,
.nav-link:hover .nav-icon,
.nav-active .nav-icon {
  background: rgba(255, 255, 255, 0.16);
}

body.sidebar-collapsed .sidebar {
  padding: 18px 10px;
}

body.sidebar-collapsed .brand-card {
  min-height: 52px;
  justify-items: center;
  border-radius: 18px;
  padding: 9px;
}

body.sidebar-collapsed .brand-card::after {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 12px;
  background: rgba(37, 99, 235, 0.22);
  color: #bfdbfe;
  content: "V3";
  font-size: 12px;
  font-weight: 950;
}

body.sidebar-collapsed .brand-card:has(.system-logo:not(.hidden))::after {
  display: none;
}

body.sidebar-collapsed .system-logo:not(.hidden) {
  max-width: 38px;
  max-height: 38px;
  margin: 0;
}

body.sidebar-collapsed .brand-title,
body.sidebar-collapsed .nav-section-toggle,
body.sidebar-collapsed .nav-item > span:first-child,
body.sidebar-collapsed .nav-link > span:first-child {
  width: 0;
  height: 0;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
  transform: translateX(-4px);
}

body.sidebar-collapsed .brand-title,
body.sidebar-collapsed .nav-section-toggle {
  display: none;
}

body.sidebar-collapsed .nav-group {
  gap: 8px;
  align-items: center;
  padding: 2px 0 12px;
}

body.sidebar-collapsed .nav-section,
body.sidebar-collapsed .nav-section-items {
  width: 100%;
  gap: 8px;
}

body.sidebar-collapsed .nav-section-collapsed .nav-section-items {
  display: grid;
}

body.sidebar-collapsed .nav-item,
body.sidebar-collapsed .nav-link {
  width: 50px;
  height: 50px;
  justify-content: center;
  padding: 0;
}

body.sidebar-collapsed .nav-icon {
  width: 36px;
  height: 36px;
}

body.sidebar-collapsed .nav-active::before {
  position: absolute;
  left: -8px;
  width: 3px;
  height: 26px;
  border-radius: 999px;
  background: #67e8f9;
  content: "";
}

body.sidebar-collapsed .nav-item[data-tooltip]::after,
body.sidebar-collapsed .nav-link[data-tooltip]::after {
  position: absolute;
  z-index: 120;
  top: 50%;
  left: calc(100% + 10px);
  max-width: 220px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 10px;
  background: #0f172a;
  color: #f8fafc;
  content: attr(data-tooltip);
  opacity: 0;
  padding: 7px 10px;
  pointer-events: none;
  transform: translateY(-50%) translateX(-4px);
  transition: opacity 150ms ease, transform 150ms ease;
  white-space: nowrap;
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.22);
  font-size: 12px;
  font-weight: 800;
}



.sidebar-card {
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: var(--radius-lg);
  background: var(--sidebar-card);
  padding: 17px;
}

.sidebar-card h2,
.sidebar-card h3 {
  margin: 0;
  color: #fff;
  font-size: 15px;
  font-weight: 800;
}

.sidebar-card p {
  color: #94a3b8;
}

.main-panel {
  min-width: 0;
  padding: 28px;
}

body.screen-security {
  height: 100vh;
  overflow: hidden;
}

body.screen-security .app-shell {
  height: 100vh;
  min-height: 0;
}

body.screen-security .main-panel {
  height: 100vh;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: auto;
  scrollbar-color: #94a3b8 #e2e8f0;
  scrollbar-gutter: stable;
}

body.screen-payable {
  overflow-x: hidden;
}

body.screen-payable .main-panel {
  min-width: 0;
  overflow-x: hidden;
}

body.screen-payable .main-panel::-webkit-scrollbar,
body.screen-security .main-panel::-webkit-scrollbar,
body.screen-payable .table-scroll::-webkit-scrollbar,
body.screen-security #securitySection::-webkit-scrollbar,
body.screen-security #systemUsersList::-webkit-scrollbar,
body.screen-security #activeUserSessionsList::-webkit-scrollbar,
body.screen-security #userLogsList::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

body.screen-payable .main-panel::-webkit-scrollbar-track,
body.screen-security .main-panel::-webkit-scrollbar-track,
body.screen-payable .table-scroll::-webkit-scrollbar-track,
body.screen-security #securitySection::-webkit-scrollbar-track,
body.screen-security #systemUsersList::-webkit-scrollbar-track,
body.screen-security #activeUserSessionsList::-webkit-scrollbar-track,
body.screen-security #userLogsList::-webkit-scrollbar-track {
  border-radius: 999px;
  background: #e2e8f0;
}

body.screen-payable .main-panel::-webkit-scrollbar-thumb,
body.screen-security .main-panel::-webkit-scrollbar-thumb,
body.screen-payable .table-scroll::-webkit-scrollbar-thumb,
body.screen-security #securitySection::-webkit-scrollbar-thumb,
body.screen-security #systemUsersList::-webkit-scrollbar-thumb,
body.screen-security #activeUserSessionsList::-webkit-scrollbar-thumb,
body.screen-security #userLogsList::-webkit-scrollbar-thumb {
  border: 3px solid #e2e8f0;
  border-radius: 999px;
  background: #94a3b8;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 18px;
  margin-bottom: 22px;
}

.page-kicker {
  margin: 0;
  color: var(--primary);
  font-size: 13px;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.page-title {
  margin: 6px 0 0;
  color: var(--text);
  font-size: clamp(30px, 4vw, 46px);
  line-height: 1.04;
  font-weight: 900;
  letter-spacing: -0.04em;
}

.page-description {
  max-width: 780px;
  margin: 12px 0 0;
  color: var(--text-muted);
  font-size: 15px;
  line-height: 1.65;
}

.quick-status {
  display: grid;
  min-width: 240px;
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.82);
  padding: 16px;
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(16px);
}

.quick-status span {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.quick-status strong {
  color: var(--text);
  font-size: 15px;
}

.panel,
.metric-card,
.table-panel {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(16px);
}

.panel {
  margin-bottom: 22px;
  padding: 22px;
}

.home-section {
  position: relative;
  display: grid;
  min-height: calc(100vh - 180px);
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: #f5f7fa;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.78);
}

.home-watermark {
  max-width: min(82vw, 860px);
  max-height: 68vh;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
}

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

.panel-title {
  margin: 0;
  color: var(--text);
  font-size: 18px;
  font-weight: 850;
  letter-spacing: -0.015em;
}

.panel-copy {
  margin: 6px 0 0;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.55;
}

.filters-card,
.form-grid {
  display: grid;
  gap: 14px;
}

.filters-card {
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  align-items: end;
  margin-bottom: 22px;
}

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

.form-grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.form-grid.four {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.settings-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.8fr);
  gap: 16px;
}

.settings-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 18px;
}

.settings-card h4,
.permission-panel h4 {
  margin: 0 0 6px;
  color: var(--text);
  font-size: 15px;
  font-weight: 850;
}

.settings-card p,
.permission-panel p {
  margin: 0 0 14px;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.55;
}

.service-status-card {
  grid-column: 1 / -1;
}

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

.service-status-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  text-align: right;
}

.service-status-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.service-status-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 15px;
  background: rgba(248, 250, 252, 0.78);
  padding: 12px;
}

.service-status-item.online {
  border-color: rgba(16, 185, 129, 0.28);
  background: rgba(240, 253, 244, 0.86);
}

.service-status-item.offline {
  border-color: rgba(239, 68, 68, 0.28);
  background: rgba(254, 242, 242, 0.86);
}

.service-status-light {
  width: 12px;
  height: 12px;
  border-radius: 999px;
}

.service-status-light.online {
  background: #22c55e;
  box-shadow: 0 0 0 5px rgba(34, 197, 94, 0.14), 0 0 16px rgba(34, 197, 94, 0.55);
}

.service-status-light.offline {
  background: #ef4444;
  box-shadow: 0 0 0 5px rgba(239, 68, 68, 0.12), 0 0 16px rgba(239, 68, 68, 0.42);
}

.service-status-info {
  min-width: 0;
}

.service-status-info strong {
  display: block;
  color: var(--text);
  font-size: 13px;
  font-weight: 850;
}

.service-status-info small {
  display: block;
  overflow: hidden;
  margin-top: 3px;
  color: var(--text-muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.service-status-label {
  border-radius: 999px;
  padding: 5px 8px;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.service-status-label.online {
  background: rgba(16, 185, 129, 0.13);
  color: #047857;
}

.service-status-label.offline {
  background: rgba(239, 68, 68, 0.12);
  color: #b91c1c;
}

.service-status-empty {
  grid-column: 1 / -1;
  border: 1px dashed rgba(148, 163, 184, 0.28);
  border-radius: 14px;
  color: var(--text-muted);
  padding: 14px;
  text-align: center;
  font-size: 12px;
  font-weight: 750;
}

.service-status-empty.error {
  border-color: rgba(239, 68, 68, 0.25);
  background: rgba(254, 242, 242, 0.7);
  color: #b91c1c;
}

.section-gap {
  margin-top: 14px;
}

.field,
.field-inline {
  position: relative;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 800;
}

.autocomplete-field {
  position: relative;
}

.autocomplete-dropdown {
  position: absolute;
  z-index: 45;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  max-height: 280px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 18px 42px rgba(15, 23, 42, 0.16);
  padding: 6px;
}

.autocomplete-option {
  display: block;
  width: 100%;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  padding: 9px 10px;
  text-align: left;
  cursor: pointer;
}

.autocomplete-option:hover,
.autocomplete-option:focus {
  background: var(--primary-soft);
}

.autocomplete-option strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 850;
}

.autocomplete-option span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-top: 3px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 650;
}

.autocomplete-empty {
  padding: 12px;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 750;
}

.sidebar .field {
  color: #cbd5e1;
}

.field input,
.field select,
.field textarea,
.select,
.input,
.textarea {
  width: 100%;
  margin-top: 7px;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: #fff;
  color: var(--text);
  outline: none;
  padding: 10px 12px;
  font-size: 14px;
  line-height: 1.4;
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.field textarea,
.textarea {
  min-height: 96px;
  resize: vertical;
}

.sidebar .field input,
.sidebar .input {
  border-color: rgba(148, 163, 184, 0.22);
  background: rgba(15, 23, 42, 0.72);
  color: #fff;
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.select:focus,
.input:focus,
.textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.hint {
  margin: 5px 0 0;
  color: var(--text-subtle);
  font-size: 12px;
}

.status-success {
  color: #34d399 !important;
}

.status-warning {
  color: #fbbf24 !important;
}

.status-danger {
  color: #f87171 !important;
}

.sidebar .hint {
  color: #64748b;
}

.check-card,
.radio-card,
.switch-card {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-muted);
  color: var(--text-muted);
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 750;
}

.check-card input,
.radio-card input,
.switch-card input {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
}

.switch-card {
  align-items: flex-start;
  background: #fff;
}

.switch-card strong,
.switch-card small {
  display: block;
}

.switch-card strong {
  color: var(--text);
}

.switch-card small {
  margin-top: 3px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 650;
  line-height: 1.45;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 41px;
  border: 1px solid transparent;
  border-radius: 13px;
  padding: 10px 15px;
  font-size: 14px;
  font-weight: 850;
  text-decoration: none;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease, border-color 160ms ease;
}

.btn:hover:not(:disabled) {
  transform: translateY(-1px);
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: #fff;
  box-shadow: 0 14px 28px rgba(37, 99, 235, 0.22);
}

.btn-primary:hover:not(:disabled) {
  box-shadow: 0 16px 34px rgba(37, 99, 235, 0.28);
}

.btn-success {
  background: var(--success);
  color: #fff;
  box-shadow: 0 14px 26px rgba(16, 185, 129, 0.22);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
  box-shadow: 0 14px 26px rgba(239, 68, 68, 0.2);
}

.btn-secondary,
.btn-ghost {
  border-color: var(--border-strong);
  background: #fff;
  color: var(--text);
}

.btn-secondary:hover:not(:disabled),
.btn-ghost:hover:not(:disabled) {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.btn-warning {
  border-color: rgba(245, 158, 11, 0.42);
  background: #fff7ed;
  color: #92400e;
}

.btn-small {
  min-height: 32px;
  border-radius: 10px;
  padding: 6px 10px;
  font-size: 12px;
}

.sidebar .btn-secondary,
.sidebar .btn-ghost {
  border-color: rgba(148, 163, 184, 0.25);
  background: rgba(255, 255, 255, 0.06);
  color: #e2e8f0;
}

.sidebar .btn-secondary:hover:not(:disabled),
.sidebar .btn-ghost:hover:not(:disabled) {
  border-color: rgba(103, 232, 249, 0.5);
  background: rgba(103, 232, 249, 0.1);
}

.actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 22px;
}

.metric-card {
  position: relative;
  overflow: hidden;
  padding: 20px;
}

.metric-card::after {
  content: "";
  position: absolute;
  inset: auto -24px -34px auto;
  width: 120px;
  height: 120px;
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.08);
}

.metric-card p {
  margin: 0;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 750;
}

.metric-card strong {
  position: relative;
  z-index: 1;
  display: block;
  margin-top: 8px;
  color: var(--text);
  font-size: 34px;
  line-height: 1;
  font-weight: 900;
  letter-spacing: -0.04em;
}

.receivable-only-metric.hidden,
.payable-only-metric.hidden {
  display: none;
}

.billing-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 0 0 12px;
}

.billing-metrics article {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(180deg, #fff, var(--surface-muted));
  padding: 12px;
}

.billing-metrics article::after {
  content: "";
  position: absolute;
  right: -28px;
  bottom: -40px;
  width: 78px;
  height: 78px;
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.07);
}

.billing-metrics p {
  margin: 0;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.billing-metrics strong {
  position: relative;
  z-index: 1;
  display: block;
  margin-top: 5px;
  color: var(--text);
  font-size: 24px;
  font-weight: 900;
}

.billing-metrics article > span {
  position: relative;
  z-index: 1;
  display: block;
  margin-top: 2px;
  color: var(--text-subtle);
  font-size: 11px;
  line-height: 1.4;
}

.billing-metrics .success-value {
  color: var(--success);
}

.billing-metrics .danger-value {
  color: var(--danger);
}

.billing-metrics .warning-value {
  color: var(--warning);
}

.provider-section {
  margin-top: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-muted);
  padding: 18px;
}

.provider-section-header {
  margin-bottom: 14px;
}

.provider-section-header h4,
.provider-box h5 {
  margin: 0;
  color: var(--text);
  font-size: 15px;
  font-weight: 900;
}

.provider-section-header p,
.provider-box p {
  margin: 5px 0 0;
}

.provider-choice {
  max-width: 360px;
}

.provider-box {
  margin-top: 14px;
  border: 1px solid rgba(203, 213, 225, 0.76);
  border-radius: var(--radius);
  background: #fff;
  padding: 16px;
}

.copy-field-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
  margin-top: 14px;
}

.copy-field-row .field {
  margin: 0;
}

.telegram-link-card {
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
  border: 1px solid rgba(14, 165, 233, 0.28);
  border-radius: var(--radius);
  background: #f0f9ff;
  padding: 14px;
}

.telegram-link-card p,
.telegram-link-card small {
  margin: 4px 0 0;
  color: var(--text-muted);
}

.telegram-link-actions,
.telegram-generated-link {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: end;
}

.telegram-generated-link .field {
  flex: 1 1 320px;
  margin: 0;
}

.telegram-generated-link .hint {
  flex-basis: 100%;
}

.table-panel {
  overflow: hidden;
}

.table-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--border);
  padding: 18px 20px;
}

.table-header h3 {
  margin: 0;
  color: var(--text);
  font-size: 18px;
  font-weight: 850;
}

.table-header p {
  margin: 5px 0 0;
  color: var(--text-muted);
  font-size: 14px;
}

.table-scroll {
  max-height: min(58vh, 620px);
  overflow: auto;
}

.table-panel .table-scroll {
  max-height: min(44vh, 520px);
  overflow-x: auto;
  overflow-y: scroll;
  scrollbar-gutter: stable both-edges;
}

body.screen-payable .table-panel {
  display: flex;
  min-height: 0;
  max-height: calc(100vh - 360px);
  flex-direction: column;
}

body.screen-payable .table-panel .table-scroll {
  flex: 1 1 auto;
  min-height: 220px;
  max-height: none;
  overflow-x: scroll;
  overflow-y: scroll;
  scrollbar-width: auto;
  scrollbar-color: #94a3b8 #e2e8f0;
}

.data-table th {
  position: sticky;
  top: 0;
  z-index: 2;
}

.data-table {
  width: 100%;
  min-width: 860px;
  border-collapse: collapse;
  text-align: left;
  font-size: 14px;
}

.data-table thead {
  background: var(--surface-muted);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.data-table th,
.data-table td {
  border-bottom: 1px solid var(--border);
  padding: 14px 16px;
  white-space: nowrap;
}

.data-table tbody tr {
  transition: background 160ms ease;
}

.data-table tbody tr:hover {
  background: #f8fbff;
}

.tw-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 10px 0 12px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(248, 250, 252, 0.82);
}

.tw-toolbar button,
.tw-menu button {
  font: inherit;
}

.tw-toolbar button {
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-muted);
  padding: 7px 10px;
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.04em;
  cursor: pointer;
}

.tw-toolbar button:hover {
  border-color: var(--primary);
  color: var(--primary-strong);
}

.tw-menu {
  position: fixed;
  z-index: 1200;
  width: min(330px, calc(100vw - 24px));
  max-height: min(560px, calc(100vh - 32px));
  overflow: auto;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: 0 22px 48px rgba(15, 23, 42, 0.18);
}

.tw-menu-title {
  margin-bottom: 8px;
  color: var(--text);
  font-weight: 850;
}

.tw-check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  color: var(--text);
  font-size: 13px;
}

.tw-check-row small {
  color: var(--text-muted);
}

.tw-menu-action {
  width: 100%;
  margin-top: 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-muted);
  color: var(--text);
  padding: 9px 10px;
  cursor: pointer;
}

.tw-menu-action.primary,
.tw-menu-action.active {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}

.tw-view-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

.tw-view-row strong,
.tw-view-row span {
  grid-column: 1 / -1;
}

.tw-view-row span,
.tw-menu-empty {
  color: var(--text-muted);
  font-size: 12px;
}

.tw-view-row button {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text-muted);
  padding: 5px 7px;
  cursor: pointer;
}

.tw-hidden-cell {
  display: none !important;
}

.data-table th,
.manual-table th,
.collection-table th,
.legal-table th,
.commercial-adjustable-grid th {
  position: relative;
}

.tw-resize-handle {
  position: absolute;
  top: 0;
  right: -4px;
  width: 9px;
  height: 100%;
  cursor: col-resize;
  user-select: none;
}

.tw-resize-handle::after {
  content: "";
  position: absolute;
  top: 8px;
  right: 4px;
  width: 2px;
  height: calc(100% - 16px);
  border-radius: 999px;
  background: #94a3b8;
  opacity: 0.9;
}

.tw-resize-handle:hover {
  background: rgba(37, 99, 235, 0.12);
}

.tw-resize-handle:hover::after {
  background: var(--primary);
  opacity: 1;
}

.data-table th:not(:last-child),
.manual-table th:not(:last-child),
.collection-table th:not(:last-child),
.legal-table th:not(:last-child),
.commercial-adjustable-grid th:not(:last-child) {
  border-right: 1px solid #dbe4f0;
}

.tw-density-compact th,
.tw-density-compact td {
  padding-top: 8px !important;
  padding-bottom: 8px !important;
}

.tw-density-comfortable th,
.tw-density-comfortable td {
  padding-top: 18px !important;
  padding-bottom: 18px !important;
}

.tw-fullscreen {
  position: fixed !important;
  inset: 12px !important;
  z-index: 1100 !important;
  overflow: auto !important;
  margin: 0 !important;
  background: var(--surface) !important;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.28) !important;
}

.tw-fullscreen .table-scroll,
.tw-fullscreen .manual-table-scroll,
.tw-fullscreen .collection-table-scroll,
.tw-fullscreen .legal-table-scroll {
  max-height: calc(100vh - 190px);
  overflow: auto;
}

body.tw-fullscreen-active {
  overflow: hidden;
}

.table-row-clickable {
  cursor: pointer;
}

.row-overdue {
  background: rgba(254, 226, 226, 0.52);
}

.row-due-soon {
  background: rgba(254, 243, 199, 0.48);
}

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  background: var(--surface-strong);
  color: var(--primary-strong);
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 850;
}

.badge-muted {
  background: #f1f5f9;
  color: var(--text-muted);
}

.badge-success {
  background: var(--success-soft);
  color: #047857;
}

.badge-info {
  background: var(--primary-soft);
  color: var(--primary-strong);
}

.badge-warning {
  background: var(--warning-soft);
  color: #92400e;
}

.badge-danger {
  background: var(--danger-soft);
  color: #b91c1c;
}

.alert {
  margin-bottom: 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  color: var(--text);
  padding: 14px 16px;
  font-size: 14px;
  font-weight: 700;
  box-shadow: var(--shadow-soft);
}

.alert-error {
  border-color: rgba(239, 68, 68, 0.22);
  background: #fff5f5;
  color: #991b1b;
}

.alert-success {
  border-color: rgba(16, 185, 129, 0.24);
  background: #f0fdf4;
  color: #047857;
}

.alert-info {
  border-color: rgba(6, 182, 212, 0.24);
  background: #ecfeff;
  color: #0e7490;
}

.config-message {
  margin-top: 12px;
  border-radius: 13px;
  padding: 10px 12px;
  font-size: 12px;
  font-weight: 750;
}

.config-message.alert-error,
.config-message.alert-success,
.config-message.alert-info {
  border-style: solid;
  border-width: 1px;
}

.debug-panel {
  max-height: 220px;
  overflow: auto;
  margin-top: 12px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 13px;
  background: rgba(15, 23, 42, 0.82);
  color: #cbd5e1;
  padding: 12px;
  font-size: 11px;
  line-height: 1.55;
  white-space: pre-wrap;
}

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

.billing-hero-panel {
  overflow: hidden;
  background:
    radial-gradient(circle at 100% 0%, rgba(37, 99, 235, 0.12), transparent 26rem),
    #fff;
}

.billing-hero-header {
  align-items: center;
}

.billing-shell-panel {
  overflow: visible;
  padding: 18px;
  background:
    radial-gradient(circle at 100% 0%, rgba(37, 99, 235, 0.08), transparent 24rem),
    #fff;
}

.billing-compact-header {
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.billing-compact-header .panel-copy {
  margin-top: 4px;
  font-size: 13px;
}

.billing-tab-control {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.billing-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.billing-tab {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-muted);
  color: var(--text-muted);
  padding: 8px 13px;
  font-size: 13px;
  font-weight: 850;
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, color 160ms ease, box-shadow 160ms ease;
}

.billing-tab:hover {
  border-color: rgba(37, 99, 235, 0.28);
  color: var(--text);
}

.billing-tab-panel {
  display: none;
}

#billingTabOverview:checked ~ .billing-tabs label[for="billingTabOverview"],
#billingTabSteps:checked ~ .billing-tabs label[for="billingTabSteps"],
#billingTabIntegrations:checked ~ .billing-tabs label[for="billingTabIntegrations"],
#billingTabProviders:checked ~ .billing-tabs label[for="billingTabProviders"],
#billingTabTests:checked ~ .billing-tabs label[for="billingTabTests"] {
  border-color: rgba(37, 99, 235, 0.34);
  background: var(--primary-soft);
  color: var(--primary-strong);
  box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.08);
}

#billingTabOverview:checked ~ .billing-tabs-panels [data-billing-tab-panel="overview"],
#billingTabSteps:checked ~ .billing-tabs-panels [data-billing-tab-panel="steps"],
#billingTabIntegrations:checked ~ .billing-tabs-panels [data-billing-tab-panel="integrations"],
#billingTabProviders:checked ~ .billing-tabs-panels [data-billing-tab-panel="providers"],
#billingTabTests:checked ~ .billing-tabs-panels [data-billing-tab-panel="tests"] {
  display: block;
}

.billing-tabs-panels,
.billing-tab-panel,
.billing-section-heading > div,
.billing-overview-grid > *,
.billing-engine-card > *,
.billing-action-card,
.billing-provider-card,
.billing-provider-card > summary > *,
.billing-rules-compact-list .billing-step-card,
.billing-step-title-block,
.billing-step-summary > *,
.billing-step-grid > *,
.billing-test-grid > *,
.billing-test-card,
.billing-test-actions-card {
  min-width: 0;
}

.billing-shell-panel .panel-copy,
.billing-provider-card > summary span,
.billing-provider-card > summary small,
.billing-step-title-block h4,
.billing-step-title-block p,
.billing-step-summary strong,
.billing-step-footer span,
.billing-variable-strip code,
.channel-chip {
  overflow-wrap: anywhere;
}

.billing-section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.billing-section-heading .panel-copy {
  margin-top: 4px;
  font-size: 13px;
}

.billing-overview-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
  gap: 12px;
}

.billing-action-card,
.billing-test-actions-card,
.billing-providers-panel {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: #fff;
  padding: 12px;
}

.billing-hero-actions {
  justify-content: flex-end;
}

.billing-engine-card {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 0.55fr) minmax(0, 0.55fr) minmax(154px, auto);
  gap: 10px;
  align-items: end;
  border: 1px solid rgba(37, 99, 235, 0.14);
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.06), rgba(6, 182, 212, 0.06));
  padding: 12px;
}

#billingEngineSave {
  min-width: 154px;
  min-height: 54px;
  align-self: end;
  padding-inline: 18px;
  white-space: nowrap;
}

.billing-send-mode {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 0;
}

.billing-results-box {
  margin-top: 12px;
}

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

.integrations-workspace {
  display: grid;
  gap: 14px;
  padding: 14px;
  background:
    radial-gradient(circle at top left, rgba(34, 197, 94, 0.13), transparent 30%),
    linear-gradient(135deg, #ffffff, #f8fafc 58%, #ecfdf5);
}

.integrations-hero-heading {
  margin-bottom: 0;
}

.whatsapp-integration-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(260px, 0.65fr);
  gap: 14px;
}

.whatsapp-web-card,
.integration-flow-card {
  border: 1px solid rgba(22, 163, 74, 0.18);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.08);
}

.whatsapp-web-card {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.whatsapp-web-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
}

.whatsapp-web-header h4,
.integration-flow-card h4 {
  margin: 7px 0 6px;
  color: var(--text);
  font-size: clamp(20px, 2.4vw, 28px);
  font-weight: 950;
  letter-spacing: -0.03em;
}

.whatsapp-web-header p,
.integration-flow-card p {
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.55;
}

.integration-status-pill {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  border: 1px solid rgba(22, 163, 74, 0.2);
  border-radius: 999px;
  background: rgba(220, 252, 231, 0.9);
  color: #15803d;
  padding: 5px 10px;
  font-size: 11px;
  font-weight: 950;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.whatsapp-device-preview {
  position: relative;
  display: grid;
  place-items: center;
  width: 108px;
  min-height: 136px;
  border: 8px solid #0f172a;
  border-radius: 28px;
  background: linear-gradient(160deg, #dcfce7, #ffffff 48%, #bbf7d0);
  color: #16a34a;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.85), 0 18px 30px rgba(15, 23, 42, 0.18);
}

.whatsapp-device-preview span {
  position: absolute;
  top: 8px;
  width: 34px;
  height: 4px;
  border-radius: 999px;
  background: #0f172a;
}

.whatsapp-device-preview strong {
  font-size: 26px;
  font-weight: 950;
  letter-spacing: -0.04em;
}

.whatsapp-device-preview small {
  margin-top: -22px;
  color: #15803d;
  font-size: 12px;
  font-weight: 900;
}

.integration-provider-choice {
  max-width: 420px;
}

.evolution-actions-row {
  gap: 10px;
}

.whatsapp-web-card #whatsappWebResult {
  margin-top: 0;
}

.integration-flow-card {
  align-self: stretch;
  padding: 18px;
}

.integration-flow-steps {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.integration-flow-steps span {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  border: 1px solid rgba(22, 163, 74, 0.14);
  border-radius: 16px;
  background: rgba(240, 253, 244, 0.72);
  color: var(--text);
  padding: 10px;
  font-size: 13px;
  font-weight: 800;
}

.integration-flow-steps strong {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  background: #16a34a;
  color: #fff;
  font-size: 12px;
}

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

.integration-provider-card {
  border-color: rgba(15, 23, 42, 0.09);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.05);
}

.integration-provider-card > summary em {
  border-color: rgba(22, 163, 74, 0.18);
  background: #f0fdf4;
  color: #15803d;
}

.integration-provider-card[open] > summary {
  background: rgba(248, 250, 252, 0.88);
}

.integration-webhook-row {
  align-items: end;
}

.billing-provider-card {
  margin-top: 0;
  padding: 0;
  overflow: hidden;
  background: #fff;
}

.billing-provider-card[open] {
  grid-column: 1 / -1;
}

.integration-config-grid .billing-provider-card[open] {
  grid-column: auto;
}

.billing-provider-card > summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 10px;
  align-items: center;
  padding: 12px;
  cursor: pointer;
  list-style: none;
}

.billing-provider-card > summary::-webkit-details-marker {
  display: none;
}

.billing-provider-card > summary span,
.billing-provider-card > summary small {
  min-width: 0;
}

.billing-provider-card > summary span {
  grid-column: 1;
  color: var(--text);
  font-size: 14px;
  font-weight: 900;
  line-height: 1.3;
  overflow-wrap: normal;
  word-break: normal;
}

.billing-provider-card > summary small {
  grid-column: 1;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.35;
  overflow-wrap: break-word;
}

.billing-provider-card > summary em {
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: center;
  justify-self: end;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-muted);
  color: var(--primary-strong);
  padding: 6px 10px;
  font-size: 12px;
  font-style: normal;
  font-weight: 850;
}

.billing-provider-card[open] > summary {
  border-bottom: 1px solid var(--border);
  background: #f8fafc;
}

.billing-provider-card > .form-grid,
.billing-provider-card > .field,
.billing-provider-card > .provider-box {
  margin: 12px;
}

.billing-provider-card > .provider-box + .provider-box {
  margin-top: 0;
}

.wa-web-dashboard {
  display: grid;
  gap: 10px;
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 0;
  box-shadow: none;
}

.wa-panel {
  border: 1px solid #d9e2ef;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.025);
}

.wa-main-card {
  padding: 16px;
}

.wa-card-heading h3,
.wa-card-heading p,
.wa-inner-heading h4,
.wa-inner-heading p,
.wa-qr-area h5,
.wa-qr-area p {
  margin: 0;
}

.wa-card-heading h3 {
  color: #0f172a;
  font-size: 19px;
  font-weight: 900;
  letter-spacing: -0.025em;
}

.wa-card-heading p {
  margin-top: 4px;
  color: #334155;
  font-size: 12px;
}

.wa-main-grid {
  display: grid;
  grid-template-columns: minmax(420px, 0.86fr) minmax(520px, 1.14fr);
  gap: 14px;
  margin-top: 16px;
}

.wa-inner-card {
  min-width: 0;
  border: 1px solid #d9e2ef;
  border-radius: 8px;
  background: #fff;
  padding: 14px;
}

.wa-inner-heading h4 {
  color: #0f172a;
  font-size: 13px;
  font-weight: 900;
}

.wa-inner-heading p {
  margin-top: 9px;
  color: #233557;
  font-size: 11px;
  line-height: 1.35;
}

.wa-connection-layout {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(220px, 0.92fr);
  gap: 20px;
  margin-top: 19px;
}

.wa-connection-info {
  display: grid;
  align-content: start;
  gap: 17px;
}

.wa-connected-badge {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  width: fit-content;
  border-radius: 5px;
  background: #dcfce7;
  color: #15803d;
  padding: 8px 12px;
  font-size: 11px;
  font-weight: 900;
}

.wa-connected-badge i {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: #16a34a;
}

.wa-connected-badge.warning {
  background: #fef3c7;
  color: #b45309;
}

.wa-connected-badge.warning i {
  background: #f59e0b;
}

.wa-connected-badge.error {
  background: #fee2e2;
  color: #b91c1c;
}

.wa-connected-badge.error i {
  background: #ef4444;
}

.wa-connection-info dl {
  display: grid;
  gap: 19px;
  margin: 0;
}

.wa-connection-info dt {
  margin-bottom: 8px;
  color: #334155;
  font-size: 11px;
}

.wa-connection-info dd {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: #0f172a;
  font-size: 12px;
  font-weight: 850;
}

.wa-copy-button {
  display: inline-grid;
  width: 18px;
  height: 18px;
  place-items: center;
  border: 1px solid #94a3b8;
  border-radius: 4px;
  background: #fff;
  color: #64748b;
  padding: 0;
  font-size: 12px;
  line-height: 1;
}

.wa-connection-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 2px;
}

.wa-outline-danger,
.wa-outline-primary,
.wa-refresh-qr,
.wa-save-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 5px;
  background: #fff;
  min-height: 36px;
  padding: 0 17px;
  font-size: 11px;
  font-weight: 900;
  cursor: pointer;
  transition: background 140ms ease, border-color 140ms ease, color 140ms ease;
}

.wa-outline-danger {
  border: 1px solid #ef4444;
  color: #ef0000;
}

.wa-outline-danger:hover {
  background: #fef2f2;
}

.wa-outline-primary,
.wa-refresh-qr {
  border: 1px solid #2563eb;
  color: #0052ff;
}

.wa-outline-primary:hover,
.wa-refresh-qr:hover {
  background: #eff6ff;
}

.wa-qr-area {
  display: grid;
  justify-items: center;
  border-left: 1px solid #d9e2ef;
  padding-left: 20px;
  text-align: center;
}

.wa-qr-area h5 {
  color: #0f172a;
  font-size: 12px;
  font-weight: 900;
}

.wa-qr-area p {
  margin-top: 8px;
  color: #334155;
  font-size: 11px;
}

.wa-qr-code {
  position: relative;
  display: grid;
  width: 150px;
  height: 150px;
  margin-top: 12px;
  place-items: center;
  background:
    linear-gradient(90deg, #111827 10px, transparent 10px 20px, #111827 20px 30px, transparent 30px 40px) 0 0 / 40px 40px,
    linear-gradient(#111827 10px, transparent 10px 20px, #111827 20px 30px, transparent 30px 40px) 0 0 / 40px 40px,
    repeating-conic-gradient(#111827 0 25%, #fff 0 50%) 0 0 / 18px 18px;
  border: 9px solid #fff;
  box-shadow: 0 0 0 1px #d9e2ef;
}

.wa-qr-code::before,
.wa-qr-code::after {
  content: "";
  position: absolute;
  width: 30px;
  height: 30px;
  border: 7px solid #111827;
  background: #fff;
}

.wa-qr-code::before {
  top: 8px;
  left: 8px;
  box-shadow: 87px 0 0 -7px #fff, 87px 0 0 0 #111827, 0 87px 0 -7px #fff, 0 87px 0 0 #111827;
}

.wa-qr-code::after {
  right: 8px;
  bottom: 8px;
  width: 24px;
  height: 24px;
  border-width: 6px;
}

.wa-qr-code span {
  position: relative;
  z-index: 1;
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border: 4px solid #111827;
  border-radius: 999px;
  background: #fff;
  color: #111827;
  font-size: 22px;
  font-weight: 900;
}

.wa-qr-code.has-image {
  background: #fff;
}

.wa-qr-code.has-image::before,
.wa-qr-code.has-image::after {
  display: none;
}

.wa-qr-code.has-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.wa-refresh-qr {
  gap: 8px;
  min-height: 30px;
  margin-top: 16px;
  border: 0;
  padding: 0 8px;
}

.wa-status-layout {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) minmax(270px, 0.9fr);
  gap: 18px;
  margin-top: 25px;
}

.wa-status-list {
  display: grid;
  gap: 24px;
}

.wa-status-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.wa-status-item i {
  width: 21px;
  height: 21px;
  border: 6px solid #e2e8f0;
  border-radius: 999px;
  background: #94a3b8;
}

.wa-status-item.active i {
  border-color: #dcfce7;
  background: #16a34a;
}

.wa-status-item strong,
.wa-status-item small {
  display: block;
}

.wa-status-item strong {
  color: #0f172a;
  font-size: 12px;
  font-weight: 900;
}

.wa-status-item small {
  margin-top: 4px;
  color: #334155;
  font-size: 10px;
  line-height: 1.35;
}

.wa-info-card {
  border: 1px solid #bfdbfe;
  border-radius: 6px;
  background: #f8fbff;
  padding: 16px;
}

.wa-info-card h5 {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0 0 9px;
  color: #1d4ed8;
  font-size: 12px;
  font-weight: 900;
}

.wa-info-card h5 span {
  display: grid;
  width: 15px;
  height: 15px;
  place-items: center;
  border: 2px solid #2563eb;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 950;
}

.wa-info-card p,
.wa-info-card li {
  color: #1e293b;
  font-size: 11px;
  line-height: 1.65;
}

.wa-info-card p {
  margin: 0 0 16px;
}

.wa-info-card strong {
  display: block;
  margin-bottom: 7px;
  color: #0f172a;
  font-size: 12px;
}

.wa-info-card ul {
  display: grid;
  gap: 7px;
  margin: 0;
  padding-left: 18px;
}

.wa-whatsapp-web-result {
  margin-top: 14px;
}

.wa-bot-card {
  padding: 16px 16px 0;
}

.wa-bot-grid {
  display: grid;
  grid-template-columns: minmax(360px, 1fr) minmax(260px, 0.7fr) minmax(390px, 1.08fr);
  gap: 18px;
  margin-top: 14px;
}

.wa-automation-card,
.wa-hours-card,
.wa-messages-card {
  padding: 14px;
}

.wa-toggle-list {
  display: grid;
  gap: 16px;
  margin-top: 24px;
}

.wa-toggle-row {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.wa-toggle-row > i {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 999px;
  background: #e5e7eb;
  color: #475569;
  font-style: normal;
  font-size: 17px;
}

.wa-toggle-row.active > i {
  border: 1px solid #86efac;
  background: #dcfce7;
  color: #16a34a;
}

.wa-toggle-row span strong,
.wa-toggle-row span small {
  display: block;
}

.wa-toggle-row span strong {
  color: #0f172a;
  font-size: 12px;
  font-weight: 900;
}

.wa-toggle-row span small {
  margin-top: 4px;
  color: #334155;
  font-size: 10px;
  line-height: 1.35;
}

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

.wa-toggle-row b {
  position: relative;
  width: 35px;
  height: 20px;
  border-radius: 999px;
  background: #cbd5e1;
}

.wa-toggle-row b::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 14px;
  height: 14px;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.18);
}

.wa-toggle-row input:checked + b {
  background: #16a34a;
}

.wa-toggle-row input:checked + b::after {
  transform: translateX(15px);
}

.wa-hours-card,
.wa-messages-card {
  display: grid;
  align-content: start;
  gap: 11px;
}

.wa-field,
.wa-message-field {
  display: grid;
  gap: 6px;
  color: #0f172a;
  font-size: 10px;
  font-weight: 850;
}

.wa-field span {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  border: 1px solid #d9e2ef;
  border-radius: 5px;
  background: #fff;
}

.wa-field i {
  padding-left: 10px;
  color: #64748b;
  font-style: normal;
}

.wa-field input,
.wa-field select,
.wa-message-field textarea {
  width: 100%;
  border: 1px solid #d9e2ef;
  border-radius: 5px;
  background: #fff;
  color: #0f172a;
  font: inherit;
}

.wa-field input {
  border: 0;
  min-height: 32px;
  padding: 6px 10px;
}

.wa-field select {
  min-height: 34px;
  padding: 6px 10px;
}

.wa-message-field {
  position: relative;
}

.wa-message-field textarea {
  min-height: 62px;
  resize: vertical;
  padding: 10px 52px 10px 10px;
  color: #0f172a;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.35;
}

.wa-message-field small {
  position: absolute;
  right: 9px;
  bottom: 9px;
  color: #0f172a;
  font-size: 9px;
  font-weight: 700;
}

.wa-save-row {
  display: flex;
  justify-content: flex-end;
  margin: 18px -16px 0;
  border-top: 1px solid #e2e8f0;
  padding: 10px 16px 13px;
}

.wa-save-button {
  min-height: 36px;
  border: 1px solid #0052ff;
  background: #0052ff;
  color: #fff;
  box-shadow: 0 9px 18px rgba(37, 99, 235, 0.18);
}

.wa-save-button:hover {
  background: #1d4ed8;
}

.wa-technical-store {
  display: none;
}

.providers-workspace {
  display: grid;
  gap: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: #fff;
  padding: 14px;
}

.billing-rules-compact-list {
  max-height: min(68vh, 760px);
  overflow: auto;
  padding-right: 4px;
}

#systemUsersList,
#activeUserSessionsList,
#userLogsList {
  max-height: min(52vh, 560px);
  overflow: auto;
}

#systemUsersList {
  max-height: min(42vh, 430px);
  overflow-y: scroll;
  scrollbar-width: auto;
  scrollbar-color: #94a3b8 #e2e8f0;
  scrollbar-gutter: stable;
}

body.screen-security #securitySection {
  max-height: calc(100vh - 128px);
  overflow-y: auto;
  scrollbar-width: auto;
  scrollbar-color: #94a3b8 #e2e8f0;
  scrollbar-gutter: stable;
}

body.screen-security #systemUsersList {
  max-height: 260px;
  overflow-y: scroll;
}

.security-users-footer {
  margin-top: 10px;
}

.security-users-footer > div {
  align-items: center;
  gap: 8px;
}

.security-users-footer label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 750;
}

.security-users-footer select {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 8px;
  background: var(--surface);
  color: var(--text);
}

.providers-heading {
  margin-bottom: 0;
}

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

.provider-config-card {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: linear-gradient(180deg, #fff, #f8fafc);
  padding: 14px;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.04);
}

.provider-config-card-wide {
  grid-column: 1 / -1;
}

.provider-config-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.provider-config-heading h4 {
  margin: 0;
  color: var(--text);
  font-size: 15px;
  font-weight: 900;
}

.provider-config-heading span {
  border: 1px solid rgba(37, 99, 235, 0.18);
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary-strong);
  padding: 5px 9px;
  font-size: 11px;
  font-weight: 850;
}

.provider-config-card .provider-box {
  margin: 12px 0 0;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fff;
  padding: 12px;
}

.provider-config-card .provider-box h5 {
  margin: 0 0 5px;
  color: var(--text);
  font-size: 13px;
  font-weight: 900;
}

.provider-config-card .provider-choice {
  max-width: 360px;
}

.provider-form-stack {
  gap: 10px;
}

@media (max-width: 1280px) {
  .wa-main-grid,
  .wa-bot-grid,
  .wa-status-layout,
  .providers-grid {
    grid-template-columns: 1fr;
  }

  .provider-config-card-wide {
    grid-column: auto;
  }

  .wa-qr-area {
    border-left: 0;
    border-top: 1px solid #d9e2ef;
    padding-top: 18px;
    padding-left: 0;
  }
}

@media (max-width: 760px) {
  .wa-main-card,
  .wa-bot-card,
  .wa-inner-card {
    padding: 12px;
  }

  .wa-connection-layout,
  .wa-toggle-row {
    grid-template-columns: 1fr;
  }

  .wa-connection-actions,
  .wa-save-row {
    align-items: stretch;
    flex-direction: column;
  }

  .wa-outline-danger,
  .wa-outline-primary,
  .wa-save-button {
    width: 100%;
  }
}

.billing-test-card {
  padding: 12px;
}

.billing-test-card .panel-title,
.billing-test-actions-card .panel-title {
  font-size: 15px;
}

.billing-test-grid {
  margin-top: 10px;
}

.billing-test-actions-card {
  margin-top: 12px;
}

.billing-test-actions {
  gap: 8px;
}

.billing-test-actions-card #whatsappWebResult {
  margin-top: 12px;
}

.billing-shell-panel .field input,
.billing-shell-panel .field select,
.billing-shell-panel .field textarea {
  margin-top: 5px;
  padding: 8px 10px;
  border-radius: 11px;
}

.billing-shell-panel .check-card,
.billing-shell-panel .radio-card,
.billing-shell-panel .switch-card {
  min-height: 38px;
  padding: 8px 10px;
  border-radius: 12px;
}

.billing-variables-box {
  padding: 12px;
}

.billing-variables-table {
  margin-top: 10px;
}

.billing-variables-box .hint {
  margin-top: 8px;
}

.billing-canvas-panel {
  margin-top: 20px;
}

.billing-workflow-map {
  position: relative;
  display: grid;
  gap: 16px;
}

.billing-workflow-map::before {
  content: "";
  position: absolute;
  top: 24px;
  bottom: 24px;
  left: 27px;
  width: 2px;
  background: linear-gradient(180deg, rgba(37, 99, 235, 0.35), rgba(6, 182, 212, 0.2), rgba(239, 68, 68, 0.2));
}

.billing-rule-form {
  position: relative;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: #fff;
  padding: 0;
  box-shadow: var(--shadow-soft);
}

.billing-step-card {
  margin-left: 58px;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.billing-step-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 18px 42px rgba(15, 23, 42, 0.09);
}

.billing-step-card.form-invalid {
  border-color: rgba(239, 68, 68, 0.5);
  box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.08), var(--shadow-soft);
}

.billing-step-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 5px;
  border-radius: var(--radius-lg) 0 0 var(--radius-lg);
  background: var(--primary);
}

.billing-step-card.step-before::before {
  background: #06b6d4;
}

.billing-step-card.step-due::before {
  background: #2563eb;
}

.billing-step-card.step-overdue::before {
  background: #ef4444;
}

.billing-step-header {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  padding: 18px 20px 14px;
}

.billing-step-marker {
  position: absolute;
  top: 18px;
  left: -58px;
  z-index: 1;
  display: grid;
  width: 56px;
  height: 56px;
  place-items: center;
  border: 1px solid rgba(37, 99, 235, 0.18);
  border-radius: 18px;
  background: #fff;
  box-shadow: var(--shadow-soft);
}

.billing-step-marker span {
  color: var(--primary-strong);
  font-size: 14px;
  font-weight: 900;
}

.billing-step-title-block h4 {
  margin: 6px 0 0;
  color: var(--text);
  font-size: 18px;
  font-weight: 900;
  letter-spacing: -0.02em;
}

.billing-step-title-block p {
  margin: 6px 0 0;
  color: var(--text-muted);
  font-size: 13px;
}

.billing-step-kicker {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  color: var(--primary);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.billing-step-trigger {
  min-width: 96px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface-muted);
  padding: 12px;
  text-align: center;
}

.billing-step-trigger strong,
.billing-step-trigger span {
  display: block;
}

.billing-step-trigger strong {
  color: var(--text);
  font-size: 24px;
  line-height: 1;
  font-weight: 950;
  letter-spacing: -0.04em;
}

.billing-step-trigger span {
  margin-top: 4px;
  color: var(--text-subtle);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.billing-step-summary {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(180px, 0.8fr) minmax(150px, 0.6fr);
  gap: 12px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: #f8fafc;
  padding: 14px 20px;
}

.billing-step-summary span,
.billing-step-summary em {
  display: block;
  color: var(--text-subtle);
  font-size: 11px;
  font-style: normal;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.billing-step-summary strong {
  display: block;
  margin-top: 7px;
  color: var(--text);
  font-size: 13px;
  font-weight: 850;
}

.billing-rule-feedback {
  border-radius: 12px;
  font-size: 13px;
  font-weight: 700;
  margin: 12px 20px 0;
  padding: 10px 12px;
}

.billing-rule-feedback-success {
  background: #e8f8ef;
  border: 1px solid #afe8c6;
  color: #176238;
}

.billing-rule-feedback-error {
  background: #fff1f1;
  border: 1px solid #f5b5b5;
  color: #a42424;
}

.billing-channel-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 7px;
}

.channel-chip {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 850;
}

.channel-whatsapp {
  background: #dcfce7;
  color: #047857;
}

.channel-email {
  background: #dbeafe;
  color: #1d4ed8;
}

.channel-telegram {
  background: #e0f2fe;
  color: #0369a1;
}

.channel-negotiation {
  background: #fef3c7;
  color: #92400e;
}

.billing-step-details {
  padding: 0 20px 18px;
}

.billing-step-details summary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: #fff;
  color: var(--text);
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 850;
  cursor: pointer;
}

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

.step-config-block {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-muted);
  padding: 16px;
}

.step-config-block h5 {
  margin: 0 0 12px;
  color: var(--text);
  font-size: 14px;
  font-weight: 900;
}

.step-config-block .field + .field,
.step-config-block .field + .hint {
  margin-top: 12px;
}

.step-config-wide {
  grid-column: 1 / -1;
}

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

.billing-variable-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.billing-variable-strip code {
  border: 1px solid rgba(37, 99, 235, 0.16);
  border-radius: 999px;
  background: #eff6ff;
  padding: 5px 8px;
  font-size: 12px;
}

.billing-step-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
  border-top: 1px solid var(--border);
  padding-top: 14px;
}

.billing-step-footer span {
  color: var(--text-muted);
  font-size: 13px;
}

.billing-empty-state {
  display: grid;
  gap: 6px;
  text-align: left;
}

.billing-empty-state strong {
  color: var(--text);
}

.billing-empty-state span {
  color: var(--text-muted);
}

.billing-rules-compact-list {
  margin-top: 12px;
}

.billing-rules-compact-list .billing-workflow-map {
  gap: 10px;
}

.billing-rules-compact-list .billing-workflow-map::before {
  display: none;
}

.billing-rules-compact-list .billing-step-card {
  margin-left: 0;
  box-shadow: none;
}

.billing-rules-compact-list .billing-step-card:hover {
  transform: none;
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.07);
}

.billing-rules-compact-list .billing-step-card::before {
  width: 4px;
}

.billing-rules-compact-list .billing-step-header {
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  padding: 10px 12px;
}

.billing-rules-compact-list .billing-step-marker {
  position: static;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  box-shadow: none;
}

.billing-rules-compact-list .billing-step-marker span {
  font-size: 12px;
}

.billing-rules-compact-list .billing-step-title-block h4 {
  margin-top: 3px;
  font-size: 15px;
}

.billing-rules-compact-list .billing-step-title-block p {
  margin-top: 3px;
  font-size: 12px;
}

.billing-rules-compact-list .billing-step-kicker {
  gap: 6px;
  font-size: 10px;
}

.billing-rules-compact-list .billing-step-trigger {
  min-width: 74px;
  border-radius: 12px;
  padding: 8px 10px;
}

.billing-rules-compact-list .billing-step-trigger strong {
  font-size: 20px;
}

.billing-rules-compact-list .billing-step-trigger span {
  margin-top: 2px;
  font-size: 10px;
}

.billing-rules-compact-list .billing-step-summary {
  grid-template-columns: minmax(0, 1.4fr) minmax(180px, 0.8fr) minmax(130px, 0.6fr);
  gap: 10px;
  padding: 10px 12px;
}

.billing-rules-compact-list .billing-step-summary strong {
  margin-top: 5px;
  font-size: 12px;
}

.billing-rules-compact-list .billing-channel-row {
  gap: 5px;
  margin-top: 5px;
}

.billing-rules-compact-list .channel-chip {
  padding: 4px 8px;
  font-size: 11px;
}

.billing-rules-compact-list .billing-step-details {
  padding: 0 12px 12px;
}

.billing-rules-compact-list .billing-step-details summary {
  margin-top: 10px;
  padding: 7px 10px;
  font-size: 12px;
}

.billing-rules-compact-list .billing-step-grid {
  gap: 10px;
  margin-top: 10px;
}

.billing-rules-compact-list .step-config-block {
  padding: 12px;
}

.billing-rules-compact-list .step-config-block h5 {
  margin-bottom: 8px;
  font-size: 13px;
}

.billing-rules-compact-list .step-config-block .field + .field,
.billing-rules-compact-list .step-config-block .field + .hint {
  margin-top: 9px;
}

.billing-rules-compact-list .billing-toggle-grid {
  gap: 8px;
}

.billing-rules-compact-list .billing-variable-strip {
  gap: 6px;
  margin-top: 8px;
}

.billing-rules-compact-list .billing-variable-strip code {
  padding: 4px 7px;
  font-size: 11px;
}

.billing-rules-compact-list .billing-step-footer {
  margin-top: 10px;
  padding-top: 10px;
}

.customer-panel {
  padding: 18px;
}

.customer-panel-header {
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.customer-panel-header > div {
  min-width: 0;
}

.customer-panel-header .btn {
  margin-left: auto;
  white-space: nowrap;
}

.customer-panel-header .panel-copy {
  margin-top: 3px;
  font-size: 13px;
}

.customer-search-card {
  margin-top: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: #fff;
  padding: 12px;
}

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

.customer-search-header h4 {
  margin: 0;
  color: var(--text);
  font-size: 14px;
  font-weight: 900;
}

.customer-search-header p {
  margin: 2px 0 0;
  color: var(--text-muted);
  font-size: 12px;
}

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

.customer-selected-card {
  margin-top: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-muted);
  padding: 10px;
}

.selected-customer-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--text);
}

.selected-customer-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px 10px;
  margin-top: 8px;
  color: var(--text-muted);
  font-size: 12px;
}

.selected-customer-pending {
  margin: 8px 0 0;
  color: #92400e;
  font-size: 12px;
}

.customer-form {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.customer-form-block {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: #fff;
  padding: 12px;
}

.customer-form-block h4 {
  margin: 0 0 10px;
  color: var(--text);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.01em;
  text-transform: uppercase;
}

.customer-form-block-primary {
  background: linear-gradient(180deg, #fff 0%, #fbfdff 100%);
}

.customer-main-grid,
.customer-address-grid,
.customer-telegram-fields,
.customer-channel-grid {
  display: grid;
  gap: 10px;
}

.customer-main-grid,
.customer-address-grid {
  grid-template-columns: repeat(12, minmax(0, 1fr));
}

.customer-main-grid .field-id {
  grid-column: span 2;
}

.customer-main-grid .field-name {
  grid-column: span 5;
}

.customer-main-grid .field-document,
.customer-main-grid .field-phone,
.customer-main-grid .field-email {
  grid-column: span 3;
}

.customer-main-grid .field-status {
  grid-column: span 2;
}

.customer-main-grid .field-list {
  grid-column: span 6;
}

.customer-address-grid .field-cep,
.customer-address-grid .field-number,
.customer-address-grid .field-uf {
  grid-column: span 2;
}

.customer-address-grid .field-street {
  grid-column: span 5;
}

.customer-address-grid .field-complement,
.customer-address-grid .field-neighborhood,
.customer-address-grid .field-country {
  grid-column: span 3;
}

.customer-address-grid .field-city {
  grid-column: span 4;
}

.customer-telegram-fields {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 10px;
}

.customer-channel-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 10px;
}

.customer-channel-grid .field {
  grid-column: span 2;
}

.customer-accordion {
  padding: 0;
  overflow: hidden;
}

.customer-accordion > summary {
  display: flex;
  align-items: center;
  min-height: 42px;
  padding: 0 12px;
  color: var(--text);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  cursor: pointer;
  list-style: none;
}

.customer-accordion > summary::-webkit-details-marker {
  display: none;
}

.customer-accordion > summary::before {
  content: "›";
  display: inline-grid;
  width: 22px;
  height: 22px;
  margin-right: 8px;
  place-items: center;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 18px;
  line-height: 1;
  transform: rotate(0deg);
  transition: transform 160ms ease;
}

.customer-accordion[open] > summary {
  border-bottom: 1px solid var(--border);
}

.customer-accordion[open] > summary::before {
  transform: rotate(90deg);
}

.customer-accordion > .customer-address-grid,
.customer-accordion > .customer-telegram-fields,
.customer-accordion > .telegram-link-card,
.customer-accordion > .customer-channel-grid {
  margin: 12px;
}

.customer-accordion > .customer-telegram-fields + .telegram-link-card,
.customer-accordion > .telegram-link-card + .customer-channel-grid {
  margin-top: 0;
}

.customer-panel .field input,
.customer-panel .field select,
.customer-panel .field textarea {
  margin-top: 5px;
  padding: 8px 10px;
  border-radius: 11px;
}

.customer-panel .field textarea {
  min-height: 72px;
}

.customer-panel .check-card {
  min-height: 38px;
  padding: 8px 10px;
  border-radius: 12px;
}

.customer-panel .telegram-link-card {
  gap: 10px;
  padding: 12px;
}

.customer-contact-list {
  margin-top: 12px;
}

.customer-panel {
  background: #f7fbff;
  border-color: #c7d9f4;
  box-shadow: 0 18px 44px rgba(15, 23, 42, 0.08);
}

.customer-panel-header {
  margin: -18px -18px 18px;
  padding: 16px 18px;
  border-bottom: 1px solid #d7e5f7;
  background: linear-gradient(180deg, #ffffff, #f3f8ff);
}

.customer-panel-header .panel-title {
  color: #08245c;
  font-size: 24px;
  font-weight: 950;
}

.customer-panel-header .panel-copy {
  color: #5b6b87;
}

.customer-panel-header .btn-success,
.customer-panel .btn-success {
  border-color: #1559d8;
  background: linear-gradient(135deg, #0f62fe, #1559d8);
  box-shadow: 0 12px 24px rgba(15, 98, 254, 0.22);
}

.customer-search-card {
  border-color: #c7d9f4;
  background: #fff;
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.05);
}

.customer-form {
  gap: 18px;
  margin-top: 18px;
}

.customer-form-block {
  border-color: #a9c7ee;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.08);
}

.customer-form-block-primary {
  padding: 0;
  overflow: hidden;
  background: #fff;
}

.customer-form-block-primary h4,
.customer-accordion > summary {
  min-height: 58px;
  border-bottom: 1px solid #c7d9f4;
  background: #eff6ff;
  color: #071f5f;
  font-size: 22px;
  font-weight: 950;
  letter-spacing: -0.02em;
  text-transform: none;
}

.customer-form-block-primary h4 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0;
  padding: 0 28px;
}

.customer-form-block-primary h4::before,
.customer-accordion > summary::before {
  content: "";
  width: 28px;
  height: 28px;
  margin-right: 16px;
  border: 3px solid #071f5f;
  border-radius: 9px;
  background: linear-gradient(135deg, rgba(7, 31, 95, 0.05), rgba(15, 98, 254, 0.08));
  transform: none;
}

.customer-form-block-primary h4::after,
.customer-accordion > summary::after {
  content: "";
  width: 14px;
  height: 14px;
  margin-left: auto;
  border-right: 4px solid #071f5f;
  border-bottom: 4px solid #071f5f;
  transform: rotate(225deg);
}

.customer-accordion:not([open]) > summary::after {
  transform: rotate(45deg);
}

.customer-accordion > summary {
  padding: 0 28px;
}

.customer-accordion[open] > summary {
  border-bottom-color: #c7d9f4;
}

.customer-accordion[open] > summary::before {
  transform: none;
}

.customer-main-grid,
.customer-address-grid,
.customer-telegram-fields,
.customer-channel-grid,
.customer-notes-grid {
  gap: 24px 38px;
}

.customer-main-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 28px 34px 30px;
}

.customer-main-grid .field-id,
.customer-main-grid .field-name,
.customer-main-grid .field-document,
.customer-main-grid .field-status,
.customer-main-grid .field-phone,
.customer-main-grid .field-email,
.customer-main-grid .field-list {
  grid-column: auto;
}

.customer-address-grid {
  grid-template-columns: minmax(180px, 0.9fr) minmax(320px, 1.8fr) minmax(170px, 0.8fr);
}

.customer-address-grid .field-cep,
.customer-address-grid .field-street,
.customer-address-grid .field-number,
.customer-address-grid .field-complement,
.customer-address-grid .field-neighborhood,
.customer-address-grid .field-city,
.customer-address-grid .field-uf,
.customer-address-grid .field-country {
  grid-column: auto;
}

.customer-address-grid .field-complement,
.customer-address-grid .field-city {
  grid-column: span 1;
}

.customer-address-grid .field-neighborhood,
.customer-address-grid .field-country {
  grid-column: span 2;
}

.customer-telegram-fields,
.customer-channel-grid,
.customer-notes-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.customer-channel-grid .field,
.customer-notes-grid .field {
  grid-column: 1 / -1;
}

.customer-accordion > .customer-address-grid,
.customer-accordion > .customer-telegram-fields,
.customer-accordion > .telegram-link-card,
.customer-accordion > .customer-channel-grid,
.customer-accordion > .customer-notes-grid {
  margin: 28px 34px 30px;
}

.customer-panel .field {
  color: #091329;
  font-size: 16px;
  font-weight: 850;
}

.customer-panel .field input,
.customer-panel .field select,
.customer-panel .field textarea {
  min-height: 44px;
  margin-top: 8px;
  border-color: #aeb8c8;
  border-radius: 8px;
  background: #fff;
  color: #111827;
  padding: 10px 16px;
  font-size: 16px;
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.04);
}

.customer-panel .field input::placeholder,
.customer-panel .field textarea::placeholder {
  color: #6b7280;
}

.customer-panel .field input:focus,
.customer-panel .field select:focus,
.customer-panel .field textarea:focus {
  border-color: #1559d8;
  box-shadow: 0 0 0 3px rgba(21, 89, 216, 0.12);
}

.customer-panel .field textarea {
  min-height: 88px;
}

.customer-panel .check-card {
  min-height: 44px;
  border-color: #c7d9f4;
  border-radius: 10px;
  background: #f8fbff;
  color: #071f5f;
  padding: 10px 12px;
  font-size: 14px;
}

.customer-panel .telegram-link-card {
  border-color: #a9c7ee;
  border-radius: 12px;
  background: #f5f9ff;
  padding: 18px;
}

.customer-form-actions {
  display: flex;
  justify-content: flex-end;
}

.results-box {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-muted);
  padding: 16px;
  color: var(--text-muted);
  font-size: 14px;
}

.contact-list {
  max-height: 210px;
  overflow-y: auto;
}

.contact-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  margin-bottom: 8px;
  border: 1px solid var(--border);
  border-radius: 15px;
  background: #fff;
  padding: 8px;
}

.contact-main {
  border: 0;
  background: transparent;
  color: var(--text);
  padding: 5px 4px;
  text-align: left;
  font-size: 13px;
  font-weight: 750;
}

.contact-delete {
  border: 1px solid rgba(239, 68, 68, 0.22);
  border-radius: 11px;
  background: var(--danger-soft);
  color: #b91c1c;
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 850;
}

.contact-delete:hover {
  background: #fecaca;
}

.contact-list > button {
  width: 100%;
  margin-bottom: 8px;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: #fff;
  color: var(--text);
  padding: 10px 12px;
  text-align: left;
  font-size: 13px;
  font-weight: 750;
}

.contact-main:hover,
.contact-list > button:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.55);
  padding: 18px;
  backdrop-filter: blur(12px);
}

.modal-card {
  width: min(920px, 100%);
  max-height: 90vh;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 26px;
  background: #fff;
  box-shadow: 0 30px 80px rgba(15, 23, 42, 0.28);
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--border);
  padding: 20px 22px;
}

.modal-header p {
  margin: 0;
  color: var(--primary);
  font-size: 13px;
  font-weight: 850;
}

.modal-header h3 {
  margin: 4px 0 0;
  color: var(--text);
  font-size: 22px;
  font-weight: 900;
}

.modal-content {
  max-height: 70vh;
  overflow-y: auto;
  padding: 22px;
}

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

.detail-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-muted);
  padding: 15px;
}

.detail-card dt {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.detail-card dd {
  margin: 6px 0 0;
  color: var(--text);
  font-size: 14px;
  font-weight: 750;
}

.pre-box {
  overflow: auto;
  border-radius: 14px;
  background: #0f172a;
  color: #cbd5e1;
  padding: 14px;
  font-size: 12px;
}

.empty-state {
  padding: 34px 16px;
  text-align: center;
  color: var(--text-subtle);
  font-weight: 750;
}

body.commercial-layout-active {
  background: #f6f8fc;
}

body.commercial-layout-active .topbar {
  display: none;
}

body.commercial-layout-active .main-panel {
  padding: 0;
}

.commercial-section {
  min-height: 100vh;
  padding: 14px 18px 20px;
  background: #f6f8fc;
  color: #17213a;
}

.commercial-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 12px;
}

.commercial-title {
  margin: 0;
  color: #111b36;
  font-size: 26px;
  font-weight: 900;
  letter-spacing: -0.03em;
}

.commercial-subtitle {
  margin: 8px 0 0;
  color: #52617a;
  font-size: 12px;
  font-weight: 700;
}

.commercial-header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 14px;
  color: #52617a;
  font-size: 11px;
  font-weight: 800;
}

.commercial-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #263653;
}

.commercial-status.updating {
  color: #1d4ed8;
}

.commercial-status.error {
  color: #dc2626;
}

.commercial-status.unknown {
  color: #b45309;
}

.commercial-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #16a34a;
  box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.12);
}

.commercial-status.updating .commercial-status-dot {
  background: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.commercial-status.error .commercial-status-dot {
  background: #dc2626;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.12);
}

.commercial-status.unknown .commercial-status-dot {
  background: #f59e0b;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.12);
}

.commercial-updated strong {
  color: #263653;
}

.commercial-refresh,
.commercial-filter-button,
.commercial-link {
  border: 0;
  border-radius: 6px;
  background: #1457d9;
  color: #fff;
  font-size: 11px;
  font-weight: 900;
  padding: 9px 13px;
  box-shadow: 0 8px 16px rgba(20, 87, 217, 0.16);
}

.commercial-refresh {
  background: #fff;
  color: #1457d9;
  border: 1px solid #dce5f3;
  box-shadow: none;
}

.commercial-link {
  display: block;
  margin: 8px auto 0;
  padding: 0;
  background: transparent;
  color: #1457d9;
  box-shadow: none;
}

.commercial-filters {
  display: grid;
  grid-template-columns: 1.3fr 1.3fr 1.3fr 1.15fr 1fr 1fr auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 14px;
}

.commercial-filters.rentals-filters {
  grid-template-columns: repeat(10, minmax(100px, 1fr)) auto;
}

.commercial-filters label {
  display: grid;
  gap: 5px;
  color: #1e2b46;
  font-size: 11px;
  font-weight: 900;
}

.commercial-filters select,
.commercial-filters input {
  width: 100%;
  min-height: 32px;
  border: 1px solid #dce5f3;
  border-radius: 6px;
  background: #fff;
  color: #263653;
  padding: 7px 9px;
  font-size: 11px;
  font-weight: 700;
  outline: none;
}

.commercial-kpi-grid {
  display: grid;
  gap: 12px;
  margin-bottom: 12px;
}

.sales-kpi-grid,
.rentals-kpi-grid {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.commercial-kpi,
.commercial-card {
  border: 1px solid #dfe7f2;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.04);
}

.commercial-kpi {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 92px;
  padding: 16px;
}

.commercial-kpi[data-commercial-detail],
.commercial-card[data-commercial-detail],
.financial-summary-grid [data-commercial-detail] {
  cursor: pointer;
}

.commercial-kpi[data-commercial-detail]:hover,
.commercial-kpi[data-commercial-detail]:focus-visible,
.commercial-card[data-commercial-detail]:hover,
.commercial-card[data-commercial-detail]:focus-visible,
.financial-summary-grid [data-commercial-detail]:hover,
.financial-summary-grid [data-commercial-detail]:focus-visible {
  border-color: #8bb7ff;
  box-shadow: 0 12px 24px rgba(37, 99, 235, 0.12);
  outline: none;
}

.commercial-kpi-icon {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border-radius: 10px;
  font-size: 25px;
  font-weight: 900;
}

.commercial-kpi-icon.blue { background: #eaf1ff; color: #2563eb; }
.commercial-kpi-icon.green { background: #e8f9ed; color: #16a34a; }
.commercial-kpi-icon.orange { background: #fff0e3; color: #f97316; }
.commercial-kpi-icon.purple { background: #f1e9ff; color: #7c3aed; }
.commercial-kpi-icon.amber { background: #fff6df; color: #f59e0b; }
.commercial-kpi-icon.red { background: #ffe7e9; color: #ef4444; }
.commercial-kpi-icon.cyan { background: #e7f8fb; color: #0891b2; }

.commercial-kpi small,
.financial-summary-grid small,
.commercial-reservation-grid small {
  display: block;
  color: #34445f;
  font-size: 11px;
  font-weight: 900;
}

.commercial-kpi strong {
  display: block;
  margin-top: 7px;
  color: #111b36;
  font-size: 21px;
  line-height: 1;
  font-weight: 950;
  letter-spacing: -0.03em;
}

.commercial-kpi em,
.commercial-reservation-grid em {
  display: block;
  margin-top: 7px;
  color: #60708a;
  font-size: 10px;
  font-style: normal;
  font-weight: 800;
}

.commercial-kpi em.positive { color: #16a34a; }
.commercial-kpi em.negative { color: #ef4444; }
.commercial-kpi em.neutral { color: #60708a; }

.commercial-grid {
  display: grid;
  gap: 12px;
  margin-bottom: 12px;
}

.sales-main-grid {
  grid-template-columns: 1.15fr 1.15fr 1fr 1.15fr;
}

.sales-bottom-grid {
  grid-template-columns: 1fr 1.08fr 1fr 1.85fr;
}

.rentals-top-grid {
  grid-template-columns: 1fr 1.1fr 1.1fr 1.15fr 1.65fr;
}

.rentals-bottom-grid {
  grid-template-columns: 1.2fr 1.1fr 1.7fr 1.1fr 1.1fr;
}

.commercial-card {
  min-height: 170px;
  padding: 14px;
  overflow: hidden;
}

.commercial-card.wide {
  min-width: 0;
}

.commercial-card h4 {
  margin: 0 0 12px;
  color: #17213a;
  font-size: 13px;
  font-weight: 950;
}

.commercial-card > small {
  display: block;
  margin-top: 9px;
  color: #61718b;
  font-size: 10px;
  font-weight: 750;
}

.commercial-donut-row {
  display: grid;
  grid-template-columns: 128px minmax(0, 1fr);
  align-items: center;
  gap: 16px;
}

.commercial-donut {
  position: relative;
  display: grid;
  width: 118px;
  height: 118px;
  place-items: center;
  border-radius: 999px;
  background: #eef2f7;
}

.commercial-donut::after {
  content: "";
  position: absolute;
  inset: 23px;
  border-radius: inherit;
  background: #fff;
}

.commercial-donut strong,
.commercial-donut span {
  position: relative;
  z-index: 1;
  display: block;
  text-align: center;
}

.commercial-donut strong {
  color: #111b36;
  font-size: 24px;
  font-weight: 950;
}

.commercial-donut span {
  margin-top: -30px;
  color: #52617a;
  font-size: 11px;
  font-weight: 900;
}

.commercial-legend {
  display: grid;
  gap: 9px;
  min-width: 0;
}

.commercial-legend div {
  display: grid;
  grid-template-columns: 10px minmax(70px, 1fr) auto;
  gap: 8px;
  align-items: center;
  color: #263653;
  font-size: 11px;
  font-weight: 850;
}

.commercial-legend i,
.commercial-dot {
  width: 8px;
  height: 8px;
  border-radius: 2px;
}

.commercial-dot {
  display: inline-block;
  margin-right: 8px;
  background: #16a34a;
}

.commercial-legend span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.commercial-legend strong {
  color: #52617a;
  font-size: 10px;
}

.commercial-bars,
.commercial-small-bars {
  display: grid;
  gap: 11px;
}

.commercial-bar-row {
  display: grid;
  grid-template-columns: 126px minmax(100px, 1fr) auto;
  gap: 10px;
  align-items: center;
  color: #263653;
  font-size: 11px;
  font-weight: 850;
}

.commercial-small-bars .commercial-bar-row {
  grid-template-columns: 86px minmax(70px, 1fr) 34px;
}

.commercial-bar-row div {
  height: 18px;
  overflow: hidden;
  border-radius: 3px;
  background: #edf2f8;
}

.commercial-bar-row i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: #2563eb;
}

.commercial-bar-row strong {
  color: #52617a;
  font-size: 10px;
  font-weight: 900;
}

.commercial-combo-chart {
  display: flex;
  align-items: end;
  justify-content: space-around;
  gap: 12px;
  min-height: 142px;
  border-bottom: 1px solid #e3eaf4;
  padding: 12px 6px 0;
}

.commercial-month-col {
  display: grid;
  justify-items: center;
  gap: 8px;
  width: 42px;
  height: 136px;
}

.commercial-month-bars {
  display: flex;
  align-items: end;
  gap: 4px;
  width: 100%;
  height: 104px;
}

.commercial-month-bars i {
  flex: 1;
  min-height: 3px;
  border-radius: 3px 3px 0 0;
}

.commercial-month-col span {
  color: #52617a;
  font-size: 10px;
  font-weight: 850;
}

.commercial-table-wrap {
  width: 100%;
  overflow: auto;
}

.commercial-table-wrap table {
  width: 100%;
  min-width: 420px;
  border-collapse: collapse;
  font-size: 11px;
}

.commercial-table-wrap table.commercial-adjustable-grid {
  border: 1px solid #cbd5e1;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
}

.commercial-adjustable-card {
  border-color: #cbd5e1;
}

.commercial-grid-hint {
  display: inline-flex;
  margin: -2px 0 10px;
  color: #64748b;
  font-size: 10px;
  font-weight: 850;
}

.commercial-table-wrap th,
.commercial-table-wrap td {
  border-bottom: 1px solid #e8eef6;
  padding: 8px 8px;
  text-align: left;
  white-space: nowrap;
}

.commercial-adjustable-grid th,
.commercial-adjustable-grid td {
  border-right: 1px solid #cbd5e1;
  border-bottom: 1px solid #dbe4f0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.commercial-adjustable-grid th:last-child,
.commercial-adjustable-grid td:last-child {
  border-right: 0;
}

.commercial-adjustable-grid tbody tr:nth-child(even) td {
  background: #f8fbff;
}

.commercial-adjustable-grid tbody tr:hover td {
  background: #eef6ff;
}

.commercial-table-wrap th {
  color: #253650;
  background: #f8fafc;
  font-size: 10px;
  font-weight: 950;
}

.commercial-adjustable-grid th .tw-resize-handle::after {
  background: #2563eb;
  width: 3px;
  box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.12);
}

.commercial-adjustable-grid th .tw-resize-handle:hover::after {
  background: #1d4ed8;
}

.commercial-table-wrap td {
  color: #263653;
  font-weight: 760;
}

.commercial-status-badge {
  display: inline-flex;
  border-radius: 999px;
  padding: 4px 7px;
  font-size: 9px;
  font-weight: 950;
}

.commercial-status-badge.success { background: #dcfce7; color: #15803d; }
.commercial-status-badge.warning { background: #fef3c7; color: #b45309; }
.commercial-status-badge.danger { background: #fee2e2; color: #dc2626; }

.commercial-ranking {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 20px;
}

.commercial-ranking li {
  display: grid;
  grid-template-columns: 86px minmax(70px, 1fr) auto;
  gap: 10px;
  align-items: center;
  color: #263653;
  font-size: 11px;
  font-weight: 850;
}

.commercial-ranking i {
  height: 4px;
  border-radius: 999px;
  background: #16a34a;
}

.commercial-ranking strong {
  color: #263653;
  font-size: 10px;
  text-align: right;
}

.commercial-ranking small {
  display: block;
  color: #60708a;
  font-size: 9px;
}

.commercial-reservation-grid,
.financial-summary-grid {
  display: grid;
  gap: 10px;
}

.commercial-reservation-grid {
  grid-template-columns: repeat(3, 1fr);
  text-align: center;
}

.commercial-reservation-grid strong,
.financial-summary-grid strong {
  display: block;
  margin-top: 8px;
  color: #111b36;
  font-size: 22px;
  font-weight: 950;
}

.financial-summary-grid {
  grid-template-columns: repeat(3, 1fr);
}

.financial-summary-grid span {
  min-height: 78px;
  border: 1px solid #e7eef7;
  border-radius: 8px;
  padding: 12px;
  text-align: center;
}

.financial-summary-grid span:nth-child(4),
.financial-summary-grid span:nth-child(5) {
  grid-column: span 1;
}

.commercial-message {
  margin: 0 0 12px;
  border: 1px solid #dbeafe;
  border-radius: 8px;
  background: #eff6ff;
  color: #1d4ed8;
  padding: 10px 12px;
  font-size: 12px;
  font-weight: 800;
}

.commercial-message.error {
  border-color: #fecaca;
  background: #fef2f2;
  color: #dc2626;
}

@media (max-width: 1440px) {
  .sales-main-grid,
  .sales-bottom-grid,
  .rentals-top-grid,
  .rentals-bottom-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .commercial-filters,
  .commercial-filters.rentals-filters {
    grid-template-columns: repeat(4, minmax(130px, 1fr));
  }
}

@media (max-width: 900px) {
  .commercial-header {
    display: grid;
  }

  .commercial-header-actions {
    justify-content: flex-start;
  }

  .sales-kpi-grid,
  .rentals-kpi-grid,
  .sales-main-grid,
  .sales-bottom-grid,
  .rentals-top-grid,
  .rentals-bottom-grid,
  .commercial-filters,
  .commercial-filters.rentals-filters {
    grid-template-columns: 1fr;
  }

  .commercial-donut-row {
    grid-template-columns: 1fr;
    justify-items: center;
  }

  .commercial-legend {
    width: 100%;
  }
}

.hidden {
  display: none !important;
}

.flex {
  display: flex !important;
}

@media (max-width: 1180px) {
  .customer-main-grid .field-id,
  .customer-main-grid .field-status,
  .customer-main-grid .field-document,
  .customer-main-grid .field-phone,
  .customer-address-grid .field-cep,
  .customer-address-grid .field-number,
  .customer-address-grid .field-uf,
  .customer-address-grid .field-country {
    grid-column: span 3;
  }

  .customer-main-grid .field-name,
  .customer-main-grid .field-email,
  .customer-address-grid .field-street,
  .customer-address-grid .field-complement,
  .customer-address-grid .field-neighborhood,
  .customer-address-grid .field-city {
    grid-column: span 6;
  }

  .customer-channel-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .selected-customer-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .customer-panel-header {
    align-items: stretch;
    flex-direction: column;
  }

  .customer-panel-header .btn {
    width: 100%;
  }

  .customer-main-grid .field-id,
  .customer-main-grid .field-status,
  .customer-main-grid .field-document,
  .customer-main-grid .field-phone,
  .customer-main-grid .field-email,
  .customer-main-grid .field-list,
  .customer-address-grid .field-cep,
  .customer-address-grid .field-street,
  .customer-address-grid .field-number,
  .customer-address-grid .field-complement,
  .customer-address-grid .field-neighborhood,
  .customer-address-grid .field-city,
  .customer-address-grid .field-uf,
  .customer-address-grid .field-country {
    grid-column: span 6;
  }

  .customer-channel-grid,
  .customer-telegram-fields {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

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

  body.sidebar-collapsed .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: relative;
    height: auto;
    overflow: hidden;
  }

  body.sidebar-collapsed .sidebar {
    padding: 22px 16px;
  }

  body.sidebar-collapsed .brand-card {
    min-height: 94px;
    justify-items: stretch;
    border-radius: 22px;
    padding: 16px;
  }

  body.sidebar-collapsed .brand-card::after {
    display: none;
  }

  body.sidebar-collapsed .system-logo:not(.hidden) {
    max-height: 48px;
    max-width: 100%;
    margin-bottom: 12px;
  }

  .sidebar-toggle {
    display: none;
  }

  body.sidebar-collapsed .brand-title,
  body.sidebar-collapsed .nav-section-toggle,
  body.sidebar-collapsed .nav-item > span:first-child,
  body.sidebar-collapsed .nav-link > span:first-child {
    width: auto;
    height: auto;
    opacity: 1;
    overflow: visible;
    pointer-events: auto;
    transform: none;
  }

  body.sidebar-collapsed .brand-title {
    display: block;
  }

  body.sidebar-collapsed .nav-section-toggle {
    display: flex;
  }

  body.sidebar-collapsed .nav-item > span:first-child,
  body.sidebar-collapsed .nav-link > span:first-child {
    display: initial;
  }

  body.sidebar-collapsed .nav-section-collapsed .nav-section-items {
    display: none;
  }

  body.sidebar-collapsed .nav-item,
  body.sidebar-collapsed .nav-link {
    width: 100%;
    height: auto;
    justify-content: flex-start;
    padding: 9px 10px;
  }

  body.sidebar-collapsed .nav-icon {
    width: 32px;
    height: 32px;
  }

  body.sidebar-collapsed .nav-active::before,
  body.sidebar-collapsed .nav-item[data-tooltip]::after,
  body.sidebar-collapsed .nav-link[data-tooltip]::after {
    display: none;
  }

  .nav-group {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .nav-label {
    grid-column: 1 / -1;
  }

  .topbar,
  .filters-card,
  .metric-grid,
  .billing-metrics,
  .billing-layout,
  .billing-engine-card,
  .billing-send-mode,
  .billing-step-summary,
  .billing-step-grid,
  .settings-grid {
    grid-template-columns: 1fr;
  }

  .service-status-header,
  .service-status-actions {
    align-items: stretch;
    flex-direction: column;
    text-align: left;
  }

  .service-status-list {
    grid-template-columns: 1fr;
  }

  .quick-status {
    min-width: 0;
  }
}

@media (max-width: 760px) {
  .main-panel {
    padding: 18px;
  }

  .sidebar {
    padding: 18px;
  }

  body.sidebar-collapsed .sidebar {
    padding: 18px;
  }

  .nav-group,
  .customer-search-row,
  .selected-customer-grid,
  .customer-main-grid,
  .customer-address-grid,
  .customer-telegram-fields,
  .customer-channel-grid,
  .copy-field-row,
  .form-grid.two,
  .form-grid.three,
  .form-grid.four,
  .detail-grid,
  .permission-grid {
    grid-template-columns: 1fr;
  }

  .customer-main-grid .field,
  .customer-address-grid .field,
  .customer-channel-grid .field {
    grid-column: auto;
  }

  .panel,
  .metric-card,
  .table-header {
    padding: 16px;
  }

  .billing-workflow-map::before {
    display: none;
  }

  .billing-step-card {
    margin-left: 0;
  }

  .billing-step-header {
    grid-template-columns: 1fr;
    padding: 16px;
  }

  .billing-step-marker {
    position: static;
    width: 44px;
    height: 44px;
    border-radius: 14px;
  }

  .billing-step-trigger {
    text-align: left;
  }

  .billing-toggle-grid {
    grid-template-columns: 1fr;
  }

  .billing-step-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .billing-step-footer .btn,
  .billing-hero-actions .btn,
  .billing-engine-card .btn {
    width: 100%;
  }

  .table-header,
  .panel-header {
    flex-direction: column;
    align-items: stretch;
  }

  .actions-row .btn,
  .filters-card .btn,
  .sidebar .btn {
    width: 100%;
  }
}

.system-logo {
  max-height: 48px;
  max-width: 100%;
  object-fit: contain;
  margin-bottom: 12px;
}

.config-subpanel {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.config-subpanel h3 {
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  margin: 0 0 12px 0;
}

.logo-preview {
  margin-top: 8px;
  padding: 8px;
  background: var(--surface-muted);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
}

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

.module-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.module-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
}

.permission-panel {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-muted);
  padding: 16px;
}

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

.permission-group {
  display: grid;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  padding: 12px;
}

.permission-group strong {
  color: var(--text);
  font-size: 13px;
  font-weight: 850;
}

.permission-toggle {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 750;
}

.permission-toggle small {
  border-radius: 999px;
  background: var(--surface-strong);
  color: var(--primary-strong);
  padding: 2px 7px;
  font-size: 10px;
  font-weight: 850;
  text-transform: uppercase;
}

.permission-toggle input:disabled + span {
  opacity: 0.72;
}

.filter-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  grid-column: 1 / -1;
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.date-preset {
  background: var(--surface-muted);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  transition: all 0.15s ease;
}

.date-preset:hover {
  background: var(--primary-soft);
  border-color: var(--primary);
  color: var(--primary-strong);
}

.active-filters {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--primary-soft);
  color: var(--primary-strong);
  border: 1px solid rgba(37, 99, 235, 0.2);
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.filter-chip span {
  font-weight: 800;
  cursor: pointer;
  opacity: 0.7;
}

.filter-chip span:hover {
  opacity: 1;
}

.manual-billing-section {
  position: relative;
  padding-bottom: 86px;
}

.manual-page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.manual-page-head .panel-title {
  font-size: 28px;
  font-weight: 950;
  letter-spacing: -0.04em;
}

.manual-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

.manual-metrics article {
  min-height: 112px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 8px 28px rgba(15, 23, 42, 0.045);
  padding: 18px 20px;
}

.manual-metrics span,
.manual-metrics small {
  display: block;
  color: var(--primary);
  font-size: 13px;
  font-weight: 850;
}

.manual-metrics strong {
  display: block;
  margin-top: 8px;
  color: var(--text);
  font-size: 24px;
  font-weight: 950;
}

.manual-metrics small {
  margin-top: 5px;
  color: var(--text-muted);
  font-weight: 700;
}

.manual-table-card {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 12px 36px rgba(15, 23, 42, 0.055);
  overflow: hidden;
}

.manual-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 16px;
  align-items: start;
}

.manual-queue-card {
  min-width: 0;
}

.manual-history-card {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 12px 36px rgba(15, 23, 42, 0.055);
  overflow: hidden;
}

.manual-table-header,
.manual-filters-row,
.manual-table-footer {
  padding: 16px 18px;
}

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

.manual-table-header h4 {
  margin: 0;
  color: var(--text);
  font-size: 16px;
  font-weight: 900;
}

.manual-table-header p {
  margin: 5px 0 0;
  color: var(--text-muted);
  font-size: 12px;
}

.manual-table-header.compact {
  align-items: flex-start;
  padding: 14px;
}

.manual-table-header.compact .btn {
  min-height: 34px;
  padding: 7px 10px;
  font-size: 12px;
}

.manual-actions-top,
.manual-filters-row {
  display: flex;
  gap: 10px;
}

.manual-filters-row {
  border-top: 1px solid var(--border);
}

.manual-filters-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr)) auto;
  align-items: end;
}

.manual-filters-grid .field {
  margin: 0;
}

.manual-filters-grid input,
.manual-filters-grid select,
.manual-history-filters input,
.manual-history-filters select {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: #fff;
  color: var(--text);
  padding: 8px 10px;
}

.manual-filters-row .input {
  max-width: 320px;
  margin-top: 0;
}

.manual-table-scroll {
  max-height: min(58vh, 620px);
  overflow: auto;
}

.manual-table th {
  position: sticky;
  top: 0;
  z-index: 2;
}

.manual-table {
  width: 100%;
  min-width: 1320px;
  border-collapse: collapse;
  font-size: 13px;
}

.manual-queue-table th,
.manual-queue-table td {
  padding: 11px 12px;
}

.manual-table th,
.manual-table td {
  border-top: 1px solid var(--border);
  padding: 12px 18px;
  text-align: left;
  vertical-align: middle;
}

.manual-table th {
  background: #f8fafc;
  color: var(--text);
  font-size: 12px;
  font-weight: 900;
}

.manual-table td strong,
.manual-table td small {
  display: block;
}

.manual-table td small {
  margin-top: 3px;
  color: var(--text-muted);
}

.manual-icon-btn {
  display: inline-grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid rgba(16, 185, 129, 0.22);
  border-radius: 999px;
  background: #ecfdf5;
  color: #059669;
  font-size: 12px;
  font-weight: 950;
}

.manual-selection-bar {
  position: fixed;
  z-index: 70;
  right: 28px;
  bottom: 22px;
  left: 328px;
  display: flex;
  align-items: center;
  gap: 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.14);
  padding: 14px 18px;
}

.manual-whatsapp-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  border: 0;
  border-radius: 9px;
  background: linear-gradient(135deg, #16a34a, #10b981);
  box-shadow: 0 12px 28px rgba(16, 185, 129, 0.24);
  color: #fff;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 900;
}

.manual-whatsapp-btn:disabled {
  opacity: 0.55;
}

.manual-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  background: rgba(15, 23, 42, 0.18);
  padding: 24px;
}

.manual-modal-backdrop.hidden {
  display: none;
}

.manual-modal {
  width: min(620px, 100%);
  max-height: calc(100vh - 48px);
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 30px 80px rgba(15, 23, 42, 0.2);
}

.manual-modal-header {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  gap: 12px;
  align-items: center;
  border-bottom: 1px solid var(--border);
  padding: 16px 18px;
}

.manual-modal-header h3 {
  margin: 0 0 8px;
  color: var(--text);
  font-size: 18px;
  font-weight: 950;
}

.manual-modal-header strong,
.manual-modal-header select {
  display: block;
}

.manual-modal-header select {
  margin-top: 4px;
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 800;
}

.manual-wa-icon {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 999px;
  background: #ecfdf5;
  color: #16a34a;
  font-size: 12px;
  font-weight: 950;
}

.manual-found {
  border-radius: 8px;
  background: #dcfce7;
  color: #059669;
  padding: 8px 10px;
  font-size: 11px;
  font-weight: 900;
  white-space: nowrap;
}

.manual-send-all {
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--border);
  background: #f8fafc;
  color: var(--text);
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 850;
}

.manual-send-all input {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
}

.manual-queue-send-all {
  margin-top: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 9px 10px;
}

.manual-missing {
  background: var(--danger-soft);
  color: #b91c1c;
}

.manual-modal-header button,
.manual-queue-header button {
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 24px;
  line-height: 1;
}

.manual-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-bottom: 1px solid var(--border);
}

.manual-info-list {
  padding: 14px 18px;
}

.manual-info-list + .manual-info-list {
  border-left: 1px solid var(--border);
}

.manual-info-list p {
  margin: 0 0 14px;
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
  word-break: break-word;
}

.manual-info-list span {
  display: block;
  margin-bottom: 4px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 900;
}

.manual-options {
  border-bottom: 1px solid var(--border);
  padding: 14px 18px;
}

.manual-options > strong,
.manual-preview-block > strong {
  display: block;
  margin-bottom: 10px;
  color: var(--text);
  font-size: 13px;
  font-weight: 950;
}

.manual-options > div {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 22px;
}

.manual-options label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-size: 13px;
  font-weight: 750;
}

.manual-options input,
.manual-table input {
  accent-color: var(--primary);
}

.manual-preview-block {
  padding: 14px 18px 0;
}

#manualMessagePreview {
  min-height: 230px;
  margin: 0;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  background: linear-gradient(180deg, #eff6ff, #fff);
  color: var(--text);
  padding: 12px;
  white-space: pre-wrap;
  font-size: 12px;
  line-height: 1.45;
}

.manual-modal-actions {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 12px;
  padding: 12px 18px 0;
}

.manual-modal-hint {
  margin: 6px 0 16px;
  color: var(--text-muted);
  text-align: center;
  font-size: 12px;
}

.manual-email-icon {
  background: #eff6ff;
  color: #2563eb;
}

.manual-email-summary {
  display: grid;
  gap: 12px;
  border-bottom: 1px solid var(--border);
  padding: 16px 18px;
}

.manual-email-summary > div {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.manual-email-summary p {
  margin: 0;
}

.manual-email-summary span {
  display: block;
  margin-bottom: 4px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 800;
}

.manual-email-summary strong {
  color: var(--text);
  font-size: 14px;
  font-weight: 850;
  word-break: break-word;
}

.manual-email-recipients {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.manual-email-recipients > span {
  margin: 0;
}

.manual-email-recipient {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #f8fafc;
  padding: 10px 12px;
}

.manual-email-recipient input {
  margin-top: 2px;
  accent-color: var(--primary);
}

.manual-email-recipient b,
.manual-email-recipient small {
  display: block;
}

.manual-email-recipient b {
  color: var(--text);
  font-size: 13px;
  font-weight: 850;
}

.manual-email-recipient small {
  margin-top: 2px;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
}

.manual-email-options {
  display: grid;
  gap: 10px;
  padding: 16px 18px 0;
}

.manual-email-options > strong {
  color: var(--text);
  font-size: 13px;
  font-weight: 900;
}

.manual-email-option {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  padding: 13px;
  cursor: pointer;
}

.manual-email-option.selected {
  border-color: #2563eb;
  background: #eff6ff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.manual-email-option input {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  accent-color: var(--primary);
}

.manual-report-type {
  outline: 2px solid rgba(37, 99, 235, 0.16);
  outline-offset: 2px;
}

.manual-email-option b,
.manual-email-option small {
  display: block;
}

.manual-email-option b {
  color: var(--text);
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
}

.manual-email-option small {
  margin-top: 3px;
  color: var(--text-muted);
  font-size: 12px;
}

.manual-email-message {
  border: 1px solid #fed7aa;
  border-radius: 12px;
  background: #fff7ed;
  color: #9a3412;
  padding: 12px;
  font-size: 13px;
}

.manual-email-message strong,
.manual-email-message p {
  margin: 0 0 8px;
}

.manual-email-message div {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 10px;
}

.manual-email-actions {
  grid-template-columns: 1fr 1fr;
}

.manual-queue-panel {
  position: fixed;
  z-index: 75;
  right: 28px;
  bottom: 92px;
  width: min(360px, calc(100vw - 32px));
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 24px 64px rgba(15, 23, 42, 0.18);
  padding: 16px;
}

.manual-queue-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.manual-queue-panel p {
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.45;
}

.manual-progress {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: #e2e8f0;
  margin: 10px 0 18px;
}

.manual-progress span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: #16a34a;
}

.manual-queue-current {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  padding: 12px;
  margin-bottom: 14px;
}

.manual-queue-current strong,
.manual-queue-current span {
  display: block;
}

.manual-queue-current span {
  color: var(--text-muted);
  font-size: 12px;
}

.manual-queue-current p {
  margin: 8px 0 0;
  color: var(--text);
}

.manual-queue-panel .btn,
.manual-queue-panel .manual-whatsapp-btn {
  width: 100%;
  margin-top: 10px;
}

.manual-history-filters {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  border-top: 1px solid var(--border);
  padding: 12px 14px;
}

.manual-history-list {
  max-height: 430px;
  overflow: auto;
  border-top: 1px solid var(--border);
}

.manual-history-item {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 7px;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  padding: 12px 14px;
  text-align: left;
}

.manual-history-item:hover {
  background: #f8fafc;
}

.manual-history-item span,
.manual-history-item strong,
.manual-history-item small {
  display: block;
}

.manual-history-item small {
  margin-top: 2px;
  color: var(--text-muted);
  font-size: 11px;
}

.manual-history-more {
  width: calc(100% - 28px);
  margin: 12px 14px;
}

.manual-history-details {
  border-top: 1px solid var(--border);
  background: #f8fafc;
  padding: 12px 14px 14px;
}

.manual-history-details-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.manual-history-details-head button {
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 20px;
}

.manual-history-details-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 12px;
}

.manual-history-details-grid p,
.manual-history-message {
  margin: 0;
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
  word-break: break-word;
}

.manual-history-details-grid span,
.manual-history-message span {
  display: block;
  margin-bottom: 3px;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 900;
}

.manual-history-message {
  margin-top: 12px;
}

.manual-history-message pre {
  max-height: 180px;
  overflow: auto;
  margin: 6px 0 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  padding: 10px;
  white-space: pre-wrap;
  font-size: 11px;
  font-weight: 600;
}

.payment-slip-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-width: 150px;
  min-height: 38px;
  border-color: rgba(29, 78, 216, 0.62);
  border-radius: 9px;
  background: #fff;
  color: #0f3c9e;
  font-weight: 900;
  white-space: nowrap;
}

.payment-slip-button::before {
  content: "";
  width: 13px;
  height: 16px;
  flex: 0 0 auto;
  border: 2px solid currentColor;
  border-radius: 2px;
  background: linear-gradient(135deg, transparent 0 70%, rgba(29, 78, 216, 0.2) 71% 100%);
  box-shadow: inset 0 -5px 0 -3px currentColor;
}

.payment-slip-button:hover:not(:disabled) {
  border-color: #1d4ed8;
  background: #eff6ff;
  color: #0f3c9e;
}

.payment-slip-unavailable {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-width: 150px;
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: #f1f3f5;
  color: #6b7280;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 800;
  cursor: not-allowed;
  white-space: nowrap;
}

.payment-slip-unavailable::before {
  content: "\2298";
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  font-size: 16px;
  line-height: 1;
  opacity: 0.82;
}

.payment-slip-unknown {
  border-color: rgba(245, 158, 11, 0.18);
  background: #fff7ed;
  color: #9a3412;
}

@media (max-width: 1100px) {
  .manual-workspace {
    grid-template-columns: 1fr;
  }

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

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

  .manual-selection-bar {
    left: 24px;
  }
}

@media (max-width: 760px) {
  .manual-page-head,
  .manual-table-header,
  .manual-actions-top,
  .manual-filters-row,
  .manual-selection-bar {
    align-items: stretch;
    flex-direction: column;
  }

  .manual-metrics,
  .manual-detail-grid,
  .manual-filters-grid,
  .manual-history-details-grid,
  .manual-options > div,
  .manual-modal-actions {
    grid-template-columns: 1fr;
  }

  .manual-info-list + .manual-info-list {
    border-top: 1px solid var(--border);
    border-left: 0;
  }

  .manual-modal-header {
    grid-template-columns: auto minmax(0, 1fr) auto;
  }

  .manual-found {
    grid-column: 1 / -1;
    justify-self: start;
  }
}

@media (min-width: 761px) {
  body:has(.nav-link[data-resource="bills-to-receive"].nav-active) .main-panel {
    padding: 22px 24px;
  }

  body:has(.nav-link[data-resource="bills-to-receive"].nav-active) .topbar {
    align-items: center;
    margin-bottom: 16px;
  }

  body:has(.nav-link[data-resource="bills-to-receive"].nav-active) .page-title {
    margin-top: 3px;
    font-size: clamp(24px, 2.2vw, 28px);
    letter-spacing: -0.025em;
  }

  body:has(.nav-link[data-resource="bills-to-receive"].nav-active) .page-description {
    max-width: 680px;
    margin-top: 6px;
    font-size: 13px;
    line-height: 1.45;
  }

  body:has(.nav-link[data-resource="bills-to-receive"].nav-active) .page-kicker {
    font-size: 11px;
  }

  body:has(.nav-link[data-resource="bills-to-receive"].nav-active) .session-bar {
    padding: 6px 8px 6px 12px;
    font-size: 12px;
  }

  body:has(.nav-link[data-resource="bills-to-receive"].nav-active) .filters-card {
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 10px 12px;
    align-items: end;
    margin-bottom: 14px;
    padding: 14px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.05);
  }

  body:has(.nav-link[data-resource="bills-to-receive"].nav-active) .filter-toolbar {
    grid-column: 1 / -1;
    gap: 6px;
    margin-bottom: 2px;
    padding-bottom: 10px;
  }

  body:has(.nav-link[data-resource="bills-to-receive"].nav-active) .date-preset {
    min-height: 30px;
    padding: 5px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 800;
  }

  body:has(.nav-link[data-resource="bills-to-receive"].nav-active) #clearFilters {
    min-height: 30px;
    padding: 5px 10px;
    font-size: 11px;
  }

  body:has(.nav-link[data-resource="bills-to-receive"].nav-active) .filters-card > .field {
    min-width: 0;
    font-size: 11px;
    letter-spacing: 0.01em;
  }

  body:has(.nav-link[data-resource="bills-to-receive"].nav-active) .filters-card > .field input,
  body:has(.nav-link[data-resource="bills-to-receive"].nav-active) .filters-card > .field select {
    min-height: 36px;
    margin-top: 5px;
    padding: 7px 10px;
    border-radius: 10px;
    font-size: 13px;
  }

  body:has(.nav-link[data-resource="bills-to-receive"].nav-active) .filters-card > .field:nth-of-type(1),
  body:has(.nav-link[data-resource="bills-to-receive"].nav-active) .filters-card > .field:nth-of-type(2) {
    grid-column: span 2;
  }

  body:has(.nav-link[data-resource="bills-to-receive"].nav-active) .filters-card > .field:nth-of-type(3),
  body:has(.nav-link[data-resource="bills-to-receive"].nav-active) .filters-card > .field:nth-of-type(4),
  body:has(.nav-link[data-resource="bills-to-receive"].nav-active) .filters-card > .field:nth-of-type(5),
  body:has(.nav-link[data-resource="bills-to-receive"].nav-active) .filters-card > .field:nth-of-type(6) {
    grid-column: span 3;
  }

  body:has(.nav-link[data-resource="bills-to-receive"].nav-active) .filters-card > .field:nth-of-type(7),
  body:has(.nav-link[data-resource="bills-to-receive"].nav-active) .filters-card > .field:nth-of-type(8),
  body:has(.nav-link[data-resource="bills-to-receive"].nav-active) .filters-card > .field:nth-of-type(9),
  body:has(.nav-link[data-resource="bills-to-receive"].nav-active) .filters-card > .field:nth-of-type(10) {
    grid-column: span 2;
  }

  body:has(.nav-link[data-resource="bills-to-receive"].nav-active) .filters-card > button[type="submit"] {
    grid-column: span 4;
    min-height: 36px;
    padding: 7px 14px;
    border-radius: 11px;
    font-size: 13px;
    box-shadow: 0 10px 22px rgba(37, 99, 235, 0.18);
  }

  body:has(.nav-link[data-resource="bills-to-receive"].nav-active) .active-filters {
    grid-column: 1 / -1;
    margin-top: 0;
  }

  body:has(.nav-link[data-resource="bills-to-receive"].nav-active) .filter-chip {
    padding: 3px 8px;
    font-size: 11px;
  }

  body:has(.nav-link[data-resource="bills-to-receive"].nav-active) #alertBox {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 36px;
    margin-bottom: 14px;
    border-radius: 12px;
    padding: 8px 12px;
    font-size: 13px;
    box-shadow: none;
  }

  body:has(.nav-link[data-resource="bills-to-receive"].nav-active) #alertBox.alert-success::before {
    content: "✓";
    display: inline-grid;
    width: 18px;
    height: 18px;
    flex: 0 0 auto;
    place-items: center;
    border-radius: 999px;
    background: var(--success);
    color: #fff;
    font-size: 11px;
    font-weight: 900;
  }

  body:has(.nav-link[data-resource="bills-to-receive"].nav-active) .metric-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 14px;
  }

  body:has(.nav-link[data-resource="bills-to-receive"].nav-active) .metric-card {
    min-height: 92px;
    padding: 14px 16px;
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.045);
  }

  body:has(.nav-link[data-resource="bills-to-receive"].nav-active) .metric-card::after {
    width: 78px;
    height: 78px;
    inset: auto -20px -30px auto;
    background: rgba(37, 99, 235, 0.06);
  }

  body:has(.nav-link[data-resource="bills-to-receive"].nav-active) .metric-card p {
    font-size: 11px;
    font-weight: 850;
    letter-spacing: 0.08em;
    text-transform: uppercase;
  }

  body:has(.nav-link[data-resource="bills-to-receive"].nav-active) .metric-card strong {
    margin-top: 7px;
    font-size: clamp(22px, 2vw, 28px);
  }

  body:has(.nav-link[data-resource="bills-to-receive"].nav-active) .table-panel {
    overflow: hidden;
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.055);
  }

  body:has(.nav-link[data-resource="bills-to-receive"].nav-active) .table-header {
    padding: 13px 16px;
    background: linear-gradient(180deg, #fff, #fbfdff);
  }

  body:has(.nav-link[data-resource="bills-to-receive"].nav-active) .table-header h3 {
    font-size: 16px;
  }

  body:has(.nav-link[data-resource="bills-to-receive"].nav-active) .table-header p {
    margin-top: 3px;
    font-size: 12px;
  }

  body:has(.nav-link[data-resource="bills-to-receive"].nav-active) .table-header .actions-row {
    gap: 8px;
  }

  body:has(.nav-link[data-resource="bills-to-receive"].nav-active) #prevPage,
  body:has(.nav-link[data-resource="bills-to-receive"].nav-active) #nextPage {
    min-height: 34px;
    padding: 7px 11px;
    border-radius: 10px;
    font-size: 12px;
  }

  body:has(.nav-link[data-resource="bills-to-receive"].nav-active) .data-table {
    min-width: 1120px;
    table-layout: fixed;
    font-size: 13px;
  }

  body:has(.nav-link[data-resource="bills-to-receive"].nav-active) .data-table th,
  body:has(.nav-link[data-resource="bills-to-receive"].nav-active) .data-table td {
    overflow: hidden;
    padding: 10px 12px;
    text-overflow: ellipsis;
    vertical-align: middle;
  }

  body:has(.nav-link[data-resource="bills-to-receive"].nav-active) .data-table thead {
    background: #f8fafc;
    font-size: 11px;
  }

  body:has(.nav-link[data-resource="bills-to-receive"].nav-active) .data-table th:nth-child(1),
  body:has(.nav-link[data-resource="bills-to-receive"].nav-active) .data-table td:nth-child(1) {
    width: 7%;
  }

  body:has(.nav-link[data-resource="bills-to-receive"].nav-active) .data-table th:nth-child(2),
  body:has(.nav-link[data-resource="bills-to-receive"].nav-active) .data-table td:nth-child(2),
  body:has(.nav-link[data-resource="bills-to-receive"].nav-active) .data-table th:nth-child(3),
  body:has(.nav-link[data-resource="bills-to-receive"].nav-active) .data-table td:nth-child(3) {
    width: 15%;
  }

  body:has(.nav-link[data-resource="bills-to-receive"].nav-active) .data-table th:nth-child(4),
  body:has(.nav-link[data-resource="bills-to-receive"].nav-active) .data-table td:nth-child(4) {
    width: 13%;
  }

  body:has(.nav-link[data-resource="bills-to-receive"].nav-active) .data-table th:nth-child(5),
  body:has(.nav-link[data-resource="bills-to-receive"].nav-active) .data-table td:nth-child(5) {
    width: 10%;
  }

  body:has(.nav-link[data-resource="bills-to-receive"].nav-active) .data-table th:nth-child(6),
  body:has(.nav-link[data-resource="bills-to-receive"].nav-active) .data-table td:nth-child(6) {
    width: 10%;
    text-align: right;
  }

  body:has(.nav-link[data-resource="bills-to-receive"].nav-active) .data-table th:nth-child(7),
  body:has(.nav-link[data-resource="bills-to-receive"].nav-active) .data-table td:nth-child(7),
  body:has(.nav-link[data-resource="bills-to-receive"].nav-active) .data-table th:nth-child(8),
  body:has(.nav-link[data-resource="bills-to-receive"].nav-active) .data-table td:nth-child(8) {
    width: 8%;
  }

  body:has(.nav-link[data-resource="bills-to-receive"].nav-active) .data-table th:nth-child(9),
  body:has(.nav-link[data-resource="bills-to-receive"].nav-active) .data-table td:nth-child(9) {
    width: 14%;
    overflow: visible;
    text-align: center;
  }

  body:has(.nav-link[data-resource="bills-to-receive"].nav-active) .data-table tbody tr:hover {
    background: #f8fbff;
  }

  body:has(.nav-link[data-resource="bills-to-receive"].nav-active) .data-table .badge {
    padding: 4px 8px;
    font-size: 11px;
  }

  body:has(.nav-link[data-resource="bills-to-receive"].nav-active) .data-table .row-overdue .badge-muted {
    background: var(--danger-soft);
    color: #b91c1c;
  }

  body:has(.nav-link[data-resource="bills-to-receive"].nav-active) .data-table .row-due-soon .badge-muted {
    background: var(--warning-soft);
    color: #92400e;
  }

  body:has(.nav-link[data-resource="bills-to-receive"].nav-active) .payment-slip-button {
    min-height: 38px;
    padding: 8px 12px;
    border-radius: 9px;
    font-size: 12px;
  }

  body:has(.nav-link[data-resource="bills-to-pay"].nav-active) .main-panel {
    padding: 22px 24px;
  }

  body:has(.nav-link[data-resource="bills-to-pay"].nav-active) .topbar {
    align-items: center;
    margin-bottom: 16px;
  }

  body:has(.nav-link[data-resource="bills-to-pay"].nav-active) .page-title {
    margin-top: 3px;
    font-size: clamp(24px, 2.2vw, 28px);
    letter-spacing: -0.025em;
  }

  body:has(.nav-link[data-resource="bills-to-pay"].nav-active) .page-description {
    max-width: 680px;
    margin-top: 6px;
    font-size: 13px;
    line-height: 1.45;
  }

  body:has(.nav-link[data-resource="bills-to-pay"].nav-active) .page-kicker {
    font-size: 11px;
  }

  body:has(.nav-link[data-resource="bills-to-pay"].nav-active) .session-bar {
    padding: 6px 8px 6px 12px;
    font-size: 12px;
  }

  body:has(.nav-link[data-resource="bills-to-pay"].nav-active) .filters-card {
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 10px 12px;
    align-items: end;
    margin-bottom: 14px;
    padding: 14px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.05);
  }

  body:has(.nav-link[data-resource="bills-to-pay"].nav-active) .filter-toolbar {
    grid-column: 1 / -1;
    gap: 6px;
    margin-bottom: 2px;
    padding-bottom: 10px;
  }

  body:has(.nav-link[data-resource="bills-to-pay"].nav-active) .date-preset {
    min-height: 30px;
    padding: 5px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 800;
  }

  body:has(.nav-link[data-resource="bills-to-pay"].nav-active) #clearFilters {
    min-height: 30px;
    padding: 5px 10px;
    font-size: 11px;
  }

  body:has(.nav-link[data-resource="bills-to-pay"].nav-active) .filters-card > .field {
    min-width: 0;
    font-size: 11px;
    letter-spacing: 0.01em;
  }

  body:has(.nav-link[data-resource="bills-to-pay"].nav-active) .filters-card > .field input,
  body:has(.nav-link[data-resource="bills-to-pay"].nav-active) .filters-card > .field select {
    min-height: 36px;
    margin-top: 5px;
    padding: 7px 10px;
    border-radius: 10px;
    font-size: 13px;
  }

  body:has(.nav-link[data-resource="bills-to-pay"].nav-active) .filters-card > .field:nth-of-type(1),
  body:has(.nav-link[data-resource="bills-to-pay"].nav-active) .filters-card > .field:nth-of-type(2) {
    grid-column: span 2;
  }

  body:has(.nav-link[data-resource="bills-to-pay"].nav-active) .filters-card > .field:nth-of-type(3),
  body:has(.nav-link[data-resource="bills-to-pay"].nav-active) .filters-card > .field:nth-of-type(4),
  body:has(.nav-link[data-resource="bills-to-pay"].nav-active) .filters-card > .field:nth-of-type(5),
  body:has(.nav-link[data-resource="bills-to-pay"].nav-active) .filters-card > .field:nth-of-type(6) {
    grid-column: span 3;
  }

  body:has(.nav-link[data-resource="bills-to-pay"].nav-active) .filters-card > .field:nth-of-type(7),
  body:has(.nav-link[data-resource="bills-to-pay"].nav-active) .filters-card > .field:nth-of-type(8),
  body:has(.nav-link[data-resource="bills-to-pay"].nav-active) .filters-card > .field:nth-of-type(9),
  body:has(.nav-link[data-resource="bills-to-pay"].nav-active) .filters-card > .field:nth-of-type(10) {
    grid-column: span 2;
  }

  body:has(.nav-link[data-resource="bills-to-pay"].nav-active) .filters-card > button[type="submit"] {
    grid-column: span 4;
    min-height: 36px;
    padding: 7px 14px;
    border-radius: 11px;
    font-size: 13px;
    box-shadow: 0 10px 22px rgba(37, 99, 235, 0.18);
  }

  body:has(.nav-link[data-resource="bills-to-pay"].nav-active) .active-filters {
    grid-column: 1 / -1;
    margin-top: 0;
  }

  body:has(.nav-link[data-resource="bills-to-pay"].nav-active) .filter-chip {
    padding: 3px 8px;
    font-size: 11px;
  }

  body:has(.nav-link[data-resource="bills-to-pay"].nav-active) #alertBox {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 36px;
    margin-bottom: 14px;
    border-radius: 12px;
    padding: 8px 12px;
    font-size: 13px;
    box-shadow: none;
  }

  body:has(.nav-link[data-resource="bills-to-pay"].nav-active) #alertBox.alert-success::before {
    content: "✓";
    display: inline-grid;
    width: 18px;
    height: 18px;
    flex: 0 0 auto;
    place-items: center;
    border-radius: 999px;
    background: var(--success);
    color: #fff;
    font-size: 11px;
    font-weight: 900;
  }

  body:has(.nav-link[data-resource="bills-to-pay"].nav-active) .metric-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 14px;
  }

  body:has(.nav-link[data-resource="bills-to-pay"].nav-active) .metric-card {
    min-height: 92px;
    padding: 14px 16px;
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.045);
  }

  body:has(.nav-link[data-resource="bills-to-pay"].nav-active) .metric-card::after {
    width: 78px;
    height: 78px;
    inset: auto -20px -30px auto;
    background: rgba(37, 99, 235, 0.06);
  }

  body:has(.nav-link[data-resource="bills-to-pay"].nav-active) .metric-card p {
    font-size: 11px;
    font-weight: 850;
    letter-spacing: 0.08em;
    text-transform: uppercase;
  }

  body:has(.nav-link[data-resource="bills-to-pay"].nav-active) .metric-card strong {
    margin-top: 7px;
    font-size: clamp(22px, 2vw, 28px);
  }

  body:has(.nav-link[data-resource="bills-to-pay"].nav-active) .table-panel {
    overflow: hidden;
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.055);
  }

  body:has(.nav-link[data-resource="bills-to-pay"].nav-active) .table-header {
    padding: 13px 16px;
    background: linear-gradient(180deg, #fff, #fbfdff);
  }

  body:has(.nav-link[data-resource="bills-to-pay"].nav-active) .table-header h3 {
    font-size: 16px;
  }

  body:has(.nav-link[data-resource="bills-to-pay"].nav-active) .table-header p {
    margin-top: 3px;
    font-size: 12px;
  }

  body:has(.nav-link[data-resource="bills-to-pay"].nav-active) .table-header .actions-row {
    gap: 8px;
  }

  body:has(.nav-link[data-resource="bills-to-pay"].nav-active) #prevPage,
  body:has(.nav-link[data-resource="bills-to-pay"].nav-active) #nextPage {
    min-height: 34px;
    padding: 7px 11px;
    border-radius: 10px;
    font-size: 12px;
  }

  body:has(.nav-link[data-resource="bills-to-pay"].nav-active) .data-table {
    min-width: 1120px;
    table-layout: fixed;
    font-size: 13px;
  }

  body:has(.nav-link[data-resource="bills-to-pay"].nav-active) .data-table th,
  body:has(.nav-link[data-resource="bills-to-pay"].nav-active) .data-table td {
    overflow: hidden;
    padding: 10px 12px;
    text-overflow: ellipsis;
    vertical-align: middle;
  }

  body:has(.nav-link[data-resource="bills-to-pay"].nav-active) .data-table thead {
    background: #f8fafc;
    font-size: 11px;
  }

  body:has(.nav-link[data-resource="bills-to-pay"].nav-active) .data-table th:nth-child(1),
  body:has(.nav-link[data-resource="bills-to-pay"].nav-active) .data-table td:nth-child(1) {
    width: 7%;
  }

  body:has(.nav-link[data-resource="bills-to-pay"].nav-active) .data-table th:nth-child(2),
  body:has(.nav-link[data-resource="bills-to-pay"].nav-active) .data-table td:nth-child(2),
  body:has(.nav-link[data-resource="bills-to-pay"].nav-active) .data-table th:nth-child(3),
  body:has(.nav-link[data-resource="bills-to-pay"].nav-active) .data-table td:nth-child(3) {
    width: 17%;
  }

  body:has(.nav-link[data-resource="bills-to-pay"].nav-active) .data-table th:nth-child(4),
  body:has(.nav-link[data-resource="bills-to-pay"].nav-active) .data-table td:nth-child(4) {
    width: 15%;
  }

  body:has(.nav-link[data-resource="bills-to-pay"].nav-active) .data-table th:nth-child(5),
  body:has(.nav-link[data-resource="bills-to-pay"].nav-active) .data-table td:nth-child(5) {
    width: 12%;
  }

  body:has(.nav-link[data-resource="bills-to-pay"].nav-active) .data-table th:nth-child(6),
  body:has(.nav-link[data-resource="bills-to-pay"].nav-active) .data-table td:nth-child(6) {
    width: 10%;
    text-align: right;
  }

  body:has(.nav-link[data-resource="bills-to-pay"].nav-active) .data-table th:nth-child(7),
  body:has(.nav-link[data-resource="bills-to-pay"].nav-active) .data-table td:nth-child(7),
  body:has(.nav-link[data-resource="bills-to-pay"].nav-active) .data-table th:nth-child(8),
  body:has(.nav-link[data-resource="bills-to-pay"].nav-active) .data-table td:nth-child(8) {
    width: 8%;
  }

  body:has(.nav-link[data-resource="bills-to-pay"].nav-active) .data-table th:nth-child(9),
  body:has(.nav-link[data-resource="bills-to-pay"].nav-active) .data-table td:nth-child(9) {
    width: 6%;
    text-align: center;
  }

  body:has(.nav-link[data-resource="bills-to-pay"].nav-active) .data-table tbody tr:hover {
    background: #f8fbff;
  }

  body:has(.nav-link[data-resource="bills-to-pay"].nav-active) .data-table .badge {
    padding: 4px 8px;
    font-size: 11px;
  }

  body:has(.nav-link[data-resource="bills-to-pay"].nav-active) .data-table .row-overdue .badge-muted {
    background: var(--danger-soft);
    color: #b91c1c;
  }

  body:has(.nav-link[data-resource="bills-to-pay"].nav-active) .data-table .row-due-soon .badge-muted {
    background: var(--warning-soft);
    color: #92400e;
  }

  body:has(.nav-link[data-resource="bills-to-pay"].nav-active) .payment-slip-button {
    min-height: 30px;
    padding: 5px 9px;
    border-radius: 9px;
    font-size: 11px;
  }
}

/* Registro de Cobranças */
.collection-records-section {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.collection-page-head,
.collection-card-heading,
.collection-table-footer,
.collection-detail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.collection-page-head {
  padding: 2px 4px;
}

.collection-page-head .panel-title {
  margin-top: 3px;
  font-size: 21px;
}

.collection-page-head .panel-copy {
  margin-top: 4px;
  font-size: 12px;
}

.collection-metrics {
  display: grid;
  grid-template-columns: repeat(8, minmax(130px, 1fr));
  gap: 8px;
}

.collection-metrics article {
  position: relative;
  overflow: hidden;
  min-width: 0;
  min-height: 90px;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: #fff;
  padding: 12px 13px;
  box-shadow: 0 7px 20px rgba(15, 23, 42, 0.035);
}

.collection-metrics article::before {
  content: "";
  position: absolute;
  width: 38px;
  height: 38px;
  right: -10px;
  top: -10px;
  border-radius: 999px;
  background: var(--primary-soft);
  opacity: 0.75;
}

.collection-metrics .metric-awaiting::before { background: var(--warning-soft); }
.collection-metrics .metric-promise::before { background: #ede9fe; }
.collection-metrics .metric-broken::before { background: var(--danger-soft); }
.collection-metrics .metric-negotiating::before { background: #cffafe; }
.collection-metrics .metric-reported::before { background: var(--success-soft); }

.collection-metrics span,
.collection-metrics small {
  display: block;
  overflow: hidden;
  color: var(--text-muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.collection-metrics span {
  font-size: 10px;
  font-weight: 850;
}

.collection-metrics strong {
  display: block;
  overflow: hidden;
  margin: 7px 0 4px;
  color: var(--text);
  font-size: 20px;
  font-weight: 950;
  letter-spacing: -0.03em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.collection-metrics small {
  font-size: 9px;
}

.collection-filters-card,
.collection-table-card,
.collection-detail-panel {
  border: 1px solid var(--border);
  border-radius: 13px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.035);
}

.collection-filters-card > summary {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 38px;
  border-bottom: 1px solid transparent;
  padding: 8px 14px;
  cursor: pointer;
  list-style: none;
}

.collection-filters-card[open] > summary {
  border-bottom-color: var(--border);
}

.collection-filters-card > summary::-webkit-details-marker { display: none; }
.collection-filters-card > summary strong { font-size: 12px; }
.collection-filters-card > summary span { color: var(--text-muted); font-size: 10px; }

.collection-filters-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(150px, 1fr));
  gap: 10px 12px;
  padding: 12px 14px 14px;
}

.collection-filters-grid .field {
  min-width: 0;
  font-size: 10px;
}

.collection-filters-grid .field input,
.collection-filters-grid .field select {
  min-width: 0;
  min-height: 34px;
  margin-top: 4px;
  border-radius: 8px;
  padding: 6px 9px;
  font-size: 11px;
}

.collection-period-field > span {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.collection-filter-actions {
  display: flex;
  grid-column: 4 / -1;
  align-items: end;
  justify-content: flex-end;
  gap: 8px;
}

.collection-filter-actions .btn {
  min-height: 34px;
  padding: 7px 13px;
  font-size: 11px;
}

.collection-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 310px;
  gap: 10px;
  align-items: start;
}

.collection-table-card {
  min-width: 0;
  overflow: hidden;
}

.collection-card-heading {
  min-height: 42px;
  border-bottom: 1px solid var(--border);
  padding: 9px 12px;
}

.collection-card-heading h4,
.collection-card-heading p {
  margin: 0;
}

.collection-card-heading h4 { font-size: 12px; }
.collection-card-heading p { margin-top: 2px; color: var(--text-muted); font-size: 9px; }
.collection-card-heading > span { color: var(--text-muted); font-size: 9px; font-weight: 800; }

.collection-table-scroll {
  max-height: min(58vh, 590px);
  overflow: auto;
}

.collection-table {
  width: 100%;
  min-width: 1460px;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
  color: var(--text);
  font-size: 10px;
}

.collection-table th {
  position: sticky;
  z-index: 2;
  top: 0;
  height: 38px;
  border-bottom: 1px solid var(--border);
  background: #f8fafc;
  color: #475569;
  padding: 7px 8px;
  text-align: left;
  font-size: 9px;
  font-weight: 900;
  white-space: nowrap;
}

.collection-table th[data-collection-sort] { cursor: pointer; }
.collection-table th[data-collection-sort]::after { content: " ↕"; color: var(--text-subtle); }

.collection-table td {
  height: 51px;
  overflow: hidden;
  border-bottom: 1px solid #edf1f5;
  padding: 7px 8px;
  text-overflow: ellipsis;
  vertical-align: middle;
  white-space: nowrap;
}

.collection-table tbody tr { cursor: pointer; transition: background 140ms ease; }
.collection-table tbody tr:hover { background: #f8fbff; }
.collection-table tbody tr.selected { background: #eff6ff; }
.collection-table td strong,
.collection-table td small { display: block; overflow: hidden; text-overflow: ellipsis; }
.collection-table td small { margin-top: 2px; color: var(--text-muted); font-size: 8px; }
.collection-table th:nth-child(1) { width: 120px; }
.collection-table th:nth-child(2) { width: 130px; }
.collection-table th:nth-child(3) { width: 150px; }
.collection-table th:nth-child(4) { width: 90px; }
.collection-table th:nth-child(5) { width: 85px; }
.collection-table th:nth-child(6) { width: 70px; text-align: center; }
.collection-table th:nth-child(7) { width: 95px; text-align: right; }
.collection-table th:nth-child(8) { width: 105px; }
.collection-table th:nth-child(9) { width: 135px; }
.collection-table th:nth-child(10),
.collection-table th:nth-child(11) { width: 105px; }
.collection-table th:nth-child(12) { width: 105px; }
.collection-table th:nth-child(13) { width: 108px; text-align: center; }
.collection-table td:nth-child(6) { text-align: center; }
.collection-table td:nth-child(7) { text-align: right; }
.collection-table td:nth-child(13) { overflow: visible; text-align: center; }

.collection-delay.overdue { color: #dc2626; font-weight: 950; }
.collection-value { font-weight: 850; }

.collection-status,
.collection-financial {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  max-width: 100%;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 4px 6px;
  font-size: 8px;
  font-weight: 850;
  line-height: 1.15;
  white-space: normal;
}

.collection-financial-open { background: #dcfce7; color: #15803d; }
.collection-financial-overdue { border-color: #fecaca; background: #fee2e2; color: #dc2626; }
.collection-financial-paid { background: #d1fae5; color: #047857; }
.collection-financial-partial { background: #fef3c7; color: #92400e; }
.collection-financial-cancelled { background: #e2e8f0; color: #475569; }
.collection-status-pending { background: #f1f5f9; color: #475569; }
.collection-status-in_collection { background: #dbeafe; color: #1d4ed8; }
.collection-status-awaiting_return { background: #fef3c7; color: #b45309; }
.collection-status-payment_promise { background: #ede9fe; color: #6d28d9; }
.collection-status-negotiating { background: #cffafe; color: #0e7490; }
.collection-status-payment_reported { background: #dcfce7; color: #15803d; }
.collection-status-promise_broken { background: #fee2e2; color: #dc2626; }
.collection-status-no_contact { background: #ffedd5; color: #c2410c; }
.collection-status-suspended { background: #e2e8f0; color: #334155; }
.collection-status-regularized { background: #d1fae5; color: #047857; }
.collection-status-closed { background: #f1f5f9; color: #475569; }

.collection-row-actions {
  display: flex;
  justify-content: center;
  gap: 4px;
}

.collection-row-actions button {
  min-width: 27px;
  height: 27px;
  border: 1px solid #bfdbfe;
  border-radius: 7px;
  background: #fff;
  color: #1d4ed8;
  padding: 0 6px;
  font-size: 8px;
  font-weight: 900;
  cursor: pointer;
}

.collection-row-actions button:hover { background: #eff6ff; }

.collection-table-footer {
  min-height: 45px;
  border-top: 1px solid var(--border);
  padding: 8px 12px;
  color: var(--text-muted);
  font-size: 9px;
}

.collection-table-footer > div,
.collection-table-footer label {
  display: flex;
  align-items: center;
  gap: 7px;
}

.collection-table-footer select,
.collection-table-footer .btn {
  min-height: 29px;
  border-radius: 7px;
  padding: 4px 8px;
  font-size: 9px;
}

.collection-table-footer > div > strong {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 7px;
  background: var(--primary-strong);
  color: #fff;
}

.collection-detail-panel {
  position: sticky;
  top: 12px;
  min-width: 0;
  max-height: calc(100vh - 34px);
  overflow-y: auto;
  padding-bottom: 9px;
}

.collection-detail-head {
  position: sticky;
  z-index: 3;
  top: 0;
  border-bottom: 1px solid var(--border);
  background: #fff;
  padding: 10px 11px;
}

.collection-detail-head span,
.collection-detail-head strong { display: block; }
.collection-detail-head span { color: var(--text-muted); font-size: 9px; font-weight: 800; }
.collection-detail-head strong { margin-top: 3px; font-size: 12px; }
.collection-detail-head button,
.collection-record-modal .modal-header button { border: 0; background: transparent; color: var(--text-muted); font-size: 20px; cursor: pointer; }

.collection-detail-content { padding: 10px; }
.collection-client-summary { display: grid; gap: 3px; padding: 2px 2px 10px; }
.collection-client-summary strong { font-size: 12px; }
.collection-client-summary span { color: var(--text-muted); font-size: 9px; }

.collection-title-summary,
.collection-quick-card,
.collection-timeline-card,
.collection-promise-summary {
  margin: 0 9px 9px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  padding: 10px;
}

.collection-title-summary { margin: 0; }
.collection-title-summary h5,
.collection-quick-card h5,
.collection-timeline-card h5 { margin: 0 0 9px; font-size: 10px; }
.collection-title-summary > div { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 6px; }
.collection-title-summary span { min-width: 0; }
.collection-title-summary small,
.collection-title-summary strong { display: block; }
.collection-title-summary small { color: var(--text-muted); font-size: 7px; }
.collection-title-summary strong { margin-top: 3px; font-size: 9px; }
.collection-title-summary b { margin-top: 3px; }
.collection-promise-summary { display: grid; gap: 4px; background: #faf5ff; color: #6d28d9; font-size: 9px; }

.collection-quick-card > div {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 5px;
}

.collection-quick-card button {
  display: grid;
  gap: 4px;
  place-items: center;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--text-muted);
  padding: 2px;
  font-size: 7px;
  cursor: pointer;
}

.collection-quick-card button b {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 8px;
}

.collection-quick-card button:disabled { cursor: not-allowed; opacity: 0.38; }

.collection-timeline-card > div {
  position: relative;
  display: grid;
  gap: 0;
  max-height: 315px;
  overflow-y: auto;
  padding-left: 12px;
}

.collection-timeline-item {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 8px;
  border-left: 1px solid #c4b5fd;
  padding: 0 0 15px 12px;
  font-size: 8px;
}

.collection-timeline-item::before {
  content: "";
  position: absolute;
  width: 7px;
  height: 7px;
  left: -4px;
  top: 3px;
  border-radius: 999px;
  background: #8b5cf6;
}

.collection-timeline-item.automated::before { background: #0ea5e9; }
.collection-timeline-item time { color: var(--text-muted); font-weight: 750; }
.collection-timeline-item > span { border-radius: 999px; background: #f1f5f9; padding: 2px 5px; color: var(--text-muted); }
.collection-timeline-item strong,
.collection-timeline-item p,
.collection-timeline-item small { grid-column: 1 / -1; }
.collection-timeline-item strong { color: #5b21b6; }
.collection-timeline-item p { margin: 0; color: #334155; line-height: 1.45; white-space: pre-wrap; }
.collection-timeline-item small { color: var(--text-muted); }

#collectionRecordModal { display: flex; }
#collectionRecordModal.hidden { display: none !important; }
#collectionHistoryModal { display: flex; }
#collectionHistoryModal.hidden { display: none !important; }

.collection-record-modal {
  width: min(760px, 100%);
  max-height: 92vh;
  overflow-y: auto;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 28px 80px rgba(15, 23, 42, 0.3);
}

.collection-history-modal {
  width: min(720px, 100%);
  max-height: 88vh;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 28px 80px rgba(15, 23, 42, 0.3);
}

.collection-history-modal .modal-header {
  border-bottom: 1px solid var(--border);
}

.collection-history-modal .modal-header button {
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
}

.collection-history-subtitle {
  display: block;
  margin-top: 6px;
  color: var(--text-muted);
  font-size: 12px;
}

.collection-history-modal-list {
  max-height: calc(88vh - 112px);
  overflow-y: auto;
  padding: 18px 22px 18px 30px;
}

.collection-record-snapshot {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  border-bottom: 1px solid var(--border);
  background: #f8fafc;
  padding: 13px 20px;
}

.collection-record-snapshot span { min-width: 0; }
.collection-record-snapshot small,
.collection-record-snapshot strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.collection-record-snapshot small { color: var(--text-muted); font-size: 9px; }
.collection-record-snapshot strong { margin-top: 3px; font-size: 11px; }
.collection-record-fields { padding: 18px 20px 10px; }
.collection-record-fields textarea { resize: vertical; }
.collection-record-wide { grid-column: 1 / -1; }
.collection-promise-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; border: 1px solid #ddd6fe; border-radius: 11px; background: #faf5ff; padding: 12px; }
.collection-responsible-note { margin: 0 20px 12px; color: var(--text-muted); font-size: 11px; }
.collection-record-modal .modal-actions { display: flex; justify-content: flex-end; gap: 9px; border-top: 1px solid var(--border); padding: 13px 20px; }

@media (max-width: 1500px) {
  .collection-metrics { grid-template-columns: repeat(4, minmax(140px, 1fr)); }
  .collection-filters-grid { grid-template-columns: repeat(4, minmax(150px, 1fr)); }
  .collection-filter-actions { grid-column: 3 / -1; }
}

@media (max-width: 1250px) {
  .collection-workspace { grid-template-columns: 1fr; }
  .collection-detail-panel {
    position: fixed;
    z-index: 45;
    top: 12px;
    right: 12px;
    bottom: 12px;
    width: min(340px, calc(100vw - 24px));
    max-height: none;
    transform: translateX(calc(100% + 24px));
    transition: transform 180ms ease;
    box-shadow: 0 24px 70px rgba(15, 23, 42, 0.24);
  }
  .collection-detail-panel.active { transform: translateX(0); }
}

@media (max-width: 760px) {
  .collection-page-head,
  .collection-card-heading,
  .collection-table-footer { align-items: stretch; flex-direction: column; }
  .collection-page-head .btn { width: 100%; }
  .collection-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .collection-filters-grid { grid-template-columns: 1fr; }
  .collection-filter-actions { grid-column: 1; }
  .collection-filter-actions .btn { flex: 1; }
  .collection-record-snapshot,
  .collection-record-fields,
  .collection-promise-fields { grid-template-columns: 1fr; }
  .collection-record-wide { grid-column: 1; }
  .collection-record-modal .modal-header { padding: 15px; }
  .collection-record-fields { padding: 14px; }
}

.user-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
}

.user-main {
  display: flex;
  align-items: center;
  gap: 12px;
  background: transparent;
  border: none;
  text-align: left;
  width: 100%;
  color: var(--text);
}

.user-main strong {
  font-size: 14px;
}

.user-main span {
  font-size: 13px;
  color: var(--text-muted);
}

@media (max-width: 1360px) {
  .billing-overview-grid {
    grid-template-columns: 1fr;
  }

  .billing-engine-card {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .billing-engine-card .switch-card {
    grid-column: 1 / -1;
  }

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

  .billing-provider-card[open] {
    grid-column: 1 / -1;
  }

  .billing-rules-compact-list .billing-step-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .billing-rules-compact-list .billing-step-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 980px) {
  .billing-engine-card,
  .billing-send-mode,
  .billing-provider-grid,
  .billing-rules-compact-list .billing-step-header,
  .billing-rules-compact-list .billing-step-summary {
    grid-template-columns: 1fr;
  }

  .billing-rules-compact-list .billing-step-trigger {
    justify-self: start;
    text-align: left;
  }
}

@media (max-width: 1180px) {
  .billing-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .billing-overview-grid,
  .billing-provider-grid,
  .whatsapp-integration-hero,
  .integration-config-grid {
    grid-template-columns: 1fr;
  }

  .billing-provider-card[open] {
    grid-column: auto;
  }

  .billing-engine-card {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .billing-engine-card .switch-card {
    grid-column: 1 / -1;
  }

  .billing-rules-compact-list .billing-step-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .billing-shell-panel {
    padding: 14px;
  }

  .billing-tabs {
    display: grid;
    grid-template-columns: 1fr;
  }

  .billing-tab {
    justify-content: center;
  }

  .billing-metrics,
  .billing-engine-card,
  .billing-send-mode,
  .billing-rules-compact-list .billing-step-summary,
  .billing-rules-compact-list .billing-step-grid,
  .billing-provider-card .form-grid.two,
  .whatsapp-web-header,
  .billing-test-grid {
    grid-template-columns: 1fr;
  }

  .whatsapp-device-preview {
    justify-self: start;
    width: 92px;
    min-height: 116px;
  }

  .evolution-actions-row .btn,
  .integration-webhook-row .btn {
    width: 100%;
  }

  .billing-section-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .billing-section-heading .btn {
    width: 100%;
  }

  .billing-rules-compact-list .billing-step-header {
    grid-template-columns: 1fr;
  }

  .billing-rules-compact-list .billing-step-trigger {
    text-align: left;
  }

  .billing-provider-card > summary {
    grid-template-columns: 1fr;
  }

  .billing-provider-card > summary em {
    grid-column: 1;
    grid-row: auto;
    justify-self: start;
  }
}

@media (min-width: 761px) {
  .customer-main-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .customer-main-grid .field-id,
  .customer-main-grid .field-name,
  .customer-main-grid .field-document,
  .customer-main-grid .field-status,
  .customer-main-grid .field-phone,
  .customer-main-grid .field-email,
  .customer-main-grid .field-list {
    grid-column: auto;
  }

  .customer-address-grid {
    grid-template-columns: minmax(180px, 0.9fr) minmax(320px, 1.8fr) minmax(170px, 0.8fr);
  }

  .customer-address-grid .field-cep,
  .customer-address-grid .field-street,
  .customer-address-grid .field-number,
  .customer-address-grid .field-complement,
  .customer-address-grid .field-neighborhood,
  .customer-address-grid .field-city,
  .customer-address-grid .field-uf,
  .customer-address-grid .field-country {
    grid-column: auto;
  }

  .customer-address-grid .field-neighborhood,
  .customer-address-grid .field-country {
    grid-column: span 2;
  }
}

.customer-panel {
  padding: 14px;
}

.customer-panel-header {
  margin: -14px -14px 12px;
  padding: 12px 14px;
}

.customer-panel-header .panel-title {
  font-size: 20px;
}

.customer-panel-header .panel-copy {
  margin-top: 2px;
  font-size: 12px;
  line-height: 1.35;
}

.customer-panel-header .btn,
.customer-panel .btn {
  min-height: 36px;
  padding: 7px 12px;
  border-radius: 10px;
  font-size: 13px;
}

.customer-search-card {
  padding: 10px;
}

.customer-search-header {
  margin-bottom: 6px;
}

.customer-search-header h4 {
  font-size: 13px;
}

.customer-search-header p,
.customer-selected-card,
.selected-customer-grid,
.selected-customer-pending {
  font-size: 11px;
}

.customer-search-row {
  gap: 8px;
}

.customer-selected-card {
  margin-top: 6px;
  padding: 8px;
}

.customer-form {
  gap: 12px;
  margin-top: 12px;
}

.customer-form-block {
  border-radius: 12px;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.06);
}

.customer-form-block-primary h4,
.customer-accordion > summary {
  min-height: 44px;
  font-size: 17px;
}

.customer-form-block-primary h4,
.customer-accordion > summary {
  padding: 0 18px;
}

.customer-form-block-primary h4::before,
.customer-accordion > summary::before {
  width: 20px;
  height: 20px;
  margin-right: 10px;
  border-width: 2px;
  border-radius: 7px;
}

.customer-form-block-primary h4::after,
.customer-accordion > summary::after {
  width: 10px;
  height: 10px;
  border-right-width: 3px;
  border-bottom-width: 3px;
}

.customer-main-grid,
.customer-address-grid,
.customer-telegram-fields,
.customer-channel-grid,
.customer-notes-grid {
  gap: 12px 18px;
}

.customer-main-grid {
  padding: 16px 20px 18px;
}

.customer-accordion > .customer-address-grid,
.customer-accordion > .customer-telegram-fields,
.customer-accordion > .telegram-link-card,
.customer-accordion > .customer-channel-grid,
.customer-accordion > .customer-notes-grid {
  margin: 16px 20px 18px;
}

.customer-panel .field {
  font-size: 13px;
}

.customer-panel .field input,
.customer-panel .field select,
.customer-panel .field textarea {
  min-height: 38px;
  margin-top: 5px;
  padding: 8px 11px;
  font-size: 13px;
}

.customer-panel .field textarea {
  min-height: 70px;
}

.customer-panel .check-card {
  min-height: 36px;
  padding: 8px 10px;
  font-size: 12px;
}

.customer-panel .telegram-link-card {
  gap: 8px;
  padding: 12px;
}

.customer-panel .telegram-link-card p,
.customer-panel .telegram-link-card small,
.customer-panel .hint {
  font-size: 11px;
}

.customer-documents-card {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.customer-documents-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.customer-documents-head p,
.customer-document-sync-info {
  margin: 0;
  color: #64748b;
  font-size: 12px;
}

.customer-document-list {
  overflow-x: auto;
}

.customer-document-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
  border: 1px solid #dbe4ef;
  border-radius: 14px;
  background: #fff;
}

.customer-document-table th,
.customer-document-table td {
  border-bottom: 1px solid #e2e8f0;
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
  font-size: 12px;
}

.customer-document-table th {
  background: #f8fafc;
  color: #334155;
  font-weight: 850;
}

.customer-document-table tr:last-child td {
  border-bottom: 0;
}

.customer-document-table strong,
.customer-document-table small {
  display: block;
}

.customer-document-table small {
  margin-top: 3px;
  color: #64748b;
}

.document-detail-list {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr);
  gap: 8px 12px;
}

.document-detail-list dt {
  color: #64748b;
  font-weight: 800;
}

.document-detail-list dd {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
}

.customer-contact-list {
  margin-top: 10px;
}

@media (min-width: 761px) {
  .customer-address-grid {
    grid-template-columns: minmax(150px, 0.8fr) minmax(280px, 1.7fr) minmax(140px, 0.75fr);
  }
}

.topbar-whatsapp-status {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 10px 14px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.wa-topbar-badge {
  display: flex;
  align-items: center;
  gap: 10px;
}
.wa-topbar-badge .wa-dot {
  width: 10px;
  height: 10px;
  background-color: #22c55e;
  border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.2);
}
.wa-topbar-badge div {
  display: flex;
  flex-direction: column;
}
.wa-topbar-badge strong {
  font-size: 13px;
  font-weight: 700;
  color: #1e293b;
}
.wa-topbar-badge small {
  font-size: 11px;
  color: #64748b;
}
.wa-help-btn {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  color: #475569;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  margin-left: 8px;
}
.wa-help-btn:hover {
  background: #e2e8f0;
}

.topbar-whatsapp-status.warning .wa-dot {
  background-color: #f59e0b;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.2);
}

.topbar-whatsapp-status.error .wa-dot {
  background-color: #ef4444;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.2);
}

.topbar-whatsapp-status.hidden {
  display: none;
}

.reports-section {
  display: block;
}

.reports-section.hidden {
  display: none;
}

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

.report-card {
  display: flex;
  min-height: 720px;
  min-width: 0;
  flex-direction: column;
  gap: 14px;
  border: 1px solid #d8e2f0;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.96);
  padding: 22px;
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.07);
  overflow: visible;
}

.report-card-main {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 20px;
}

.report-card-heading {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.report-card-heading > span {
  display: inline-grid;
  width: 50px;
  height: 50px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 14px;
  background: linear-gradient(135deg, #dbeafe, #eef4ff);
  color: #0b55d9;
  font-size: 14px;
  font-weight: 900;
}

.report-card-heading h4,
.report-card-heading p {
  margin: 0;
}

.report-card-heading h4 {
  color: #0f172a;
  font-size: 20px;
  font-weight: 900;
  letter-spacing: -0.03em;
}

.report-card-heading p {
  margin-top: 6px;
  color: #64748b;
  font-size: 14px;
}

.report-help {
  display: inline-grid;
  width: 34px;
  height: 34px;
  margin-left: auto;
  place-items: center;
  border: 0;
  border-radius: 12px;
  background: #f1f5f9;
  color: #475569;
  font-size: 18px;
  font-weight: 850;
}

.report-form-grid {
  display: grid;
  gap: 18px 22px;
}

.report-form-grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.report-field {
  position: relative;
  min-width: 0;
  color: #475569;
  font-size: 13px;
  font-weight: 850;
}

.report-label {
  display: block;
  margin-bottom: 8px;
}

.report-field input:not([type="hidden"]) {
  width: 100%;
  height: 44px;
  margin-top: 8px;
  border: 1px solid #d8e2f0;
  border-radius: 11px;
  background: #fff;
  color: #1e293b;
  outline: none;
  padding: 0 14px;
  font-size: 14px;
  font-weight: 650;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.report-field input:not([type="hidden"]):focus,
.report-select-trigger:focus,
.report-combo.open .report-select-trigger {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.16);
}

.report-native-combo > span {
  position: relative;
  display: flex;
  align-items: center;
  margin-top: 8px;
}

.report-native-combo input:not([type="hidden"]) {
  height: 44px;
  margin-top: 0;
  padding: 0 38px 0 42px;
}

.report-native-combo i {
  position: absolute;
  left: 14px;
  z-index: 1;
  width: 16px;
  height: 16px;
  pointer-events: none;
}

.report-native-combo i::before {
  position: absolute;
  top: 1px;
  left: 1px;
  width: 9px;
  height: 9px;
  content: "";
  border: 2px solid #64748b;
  border-radius: 999px;
}

.report-native-combo i::after {
  position: absolute;
  right: 1px;
  bottom: 1px;
  width: 7px;
  height: 2px;
  content: "";
  background: #64748b;
  border-radius: 2px;
  transform: rotate(45deg);
}

.report-native-combo b {
  position: absolute;
  right: 14px;
  color: #334155;
  font-size: 18px;
  pointer-events: none;
}

.report-wide {
  grid-column: 1 / -1;
}

.report-select-trigger {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 44px;
  gap: 10px;
  border: 1px solid #d8e2f0;
  border-radius: 11px;
  background: #fff;
  color: #64748b;
  outline: none;
  padding: 0 12px;
  text-align: left;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.report-select-trigger.has-value {
  color: #111827;
}

.report-select-value {
  display: flex;
  min-width: 0;
  flex: 1;
  align-items: center;
  gap: 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  font-weight: 750;
}

.report-select-icon,
.report-doc-icon {
  position: relative;
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
}

.report-select-icon::before {
  position: absolute;
  top: 1px;
  left: 1px;
  width: 9px;
  height: 9px;
  content: "";
  border: 2px solid #64748b;
  border-radius: 999px;
}

.report-select-icon::after {
  position: absolute;
  right: 1px;
  bottom: 1px;
  width: 7px;
  height: 2px;
  content: "";
  background: #64748b;
  border-radius: 2px;
  transform: rotate(45deg);
}

.report-doc-icon::before,
.report-doc-mini::before {
  display: block;
  width: 12px;
  height: 15px;
  content: "";
  border: 1.7px solid currentColor;
  border-radius: 2px;
  box-shadow: inset 0 -4px 0 rgba(37, 99, 235, 0.08);
}

.report-doc-mini {
  display: inline-grid;
  width: 16px;
  height: 18px;
  place-items: center;
}

.report-select-clear {
  display: none;
  flex: 0 0 auto;
  color: #475569;
  font-size: 20px;
  line-height: 1;
}

.report-select-trigger.has-value .report-select-clear {
  display: block;
}

.report-select-arrow {
  flex: 0 0 auto;
  color: #334155;
  font-size: 18px;
}

.report-select-menu {
  position: absolute;
  z-index: 80;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  border: 1px solid #d8e2f0;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 20px 48px rgba(15, 23, 42, 0.18);
  padding: 10px;
}

.report-select-search {
  height: 40px !important;
  margin: 0 0 10px !important;
  border-radius: 12px !important;
  padding-left: 36px !important;
  background: linear-gradient(90deg, transparent 0, transparent 26px, #f8fafc 26px) !important;
  font-size: 13px !important;
}

.report-select-menu::before {
  position: absolute;
  top: 19px;
  left: 22px;
  width: 9px;
  height: 9px;
  content: "";
  border: 2px solid #94a3b8;
  border-radius: 999px;
}

.report-select-menu::after {
  position: absolute;
  top: 31px;
  left: 32px;
  width: 7px;
  height: 2px;
  content: "";
  background: #94a3b8;
  border-radius: 2px;
  transform: rotate(45deg);
}

.report-select-list {
  max-height: 336px;
  overflow-y: auto;
  padding-right: 5px;
}

.report-select-list::-webkit-scrollbar {
  width: 7px;
}

.report-select-list::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: #94a3b8;
}

.report-select-option {
  display: flex;
  width: 100%;
  min-height: 46px;
  align-items: flex-start;
  gap: 9px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #1f2937;
  padding: 8px 9px;
  text-align: left;
  font-size: 13px;
  font-weight: 650;
}

.report-select-option strong {
  display: -webkit-box;
  overflow: hidden;
  color: inherit;
  line-height: 1.25;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.report-select-option mark {
  border-radius: 4px;
  background: #fde68a;
  color: #78350f;
  padding: 0 2px;
}

.report-option-text {
  display: grid;
  min-width: 0;
  flex: 1;
  gap: 3px;
}

.report-option-text small {
  display: block;
  overflow: hidden;
  color: #64748b;
  font-size: 11px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.report-option-check {
  display: inline-grid;
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 999px;
  background: #dbeafe;
  color: #2563eb;
  opacity: 0;
  font-size: 12px;
  font-weight: 900;
}

.report-select-option:hover,
.report-select-option.active,
.report-select-option.selected:not(.multi) {
  background: #2563eb;
  color: #fff;
}

.report-select-option:hover .report-option-text small,
.report-select-option.active .report-option-text small,
.report-select-option.selected:not(.multi) .report-option-text small {
  color: rgba(255, 255, 255, 0.78);
}

.report-select-option:hover mark,
.report-select-option.active mark,
.report-select-option.selected:not(.multi) mark {
  background: rgba(255, 255, 255, 0.22);
  color: #fff;
}

.report-select-option.selected .report-option-check {
  opacity: 1;
}

.report-select-option.multi.selected {
  color: #0f172a;
  font-weight: 800;
}

.report-checkbox {
  display: inline-grid;
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid #94a3b8;
  border-radius: 3px;
}

.report-select-option.selected .report-checkbox {
  border-color: #2563eb;
  background: #2563eb;
}

.report-select-option.selected .report-checkbox::before {
  content: "✓";
  color: #fff;
  font-size: 12px;
  line-height: 1;
}

.report-select-count,
.report-select-empty {
  color: #64748b;
  font-size: 12px;
  font-weight: 700;
}

.report-select-count {
  display: block;
  padding: 8px 6px 2px;
}

.report-select-empty {
  padding: 14px 8px;
}

.report-select-more {
  display: block;
  width: 100%;
  min-height: 38px;
  margin-top: 6px;
  border: 1px dashed #bfdbfe;
  border-radius: 10px;
  background: #eff6ff;
  color: #0057e7;
  font-size: 13px;
  font-weight: 850;
}

.report-select-more:hover {
  border-color: #2563eb;
  background: #dbeafe;
}

.report-select-footer {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 14px;
  border-top: 1px solid #e2e8f0;
  margin-top: 8px;
  padding: 8px 6px 0;
}

.report-select-footer .report-select-count {
  padding: 0;
}

.report-select-clear-action,
.report-select-apply,
.report-card-foot button {
  border: 0;
  background: transparent;
  color: #0057e7;
  font-size: 13px;
  font-weight: 850;
}

.report-chip {
  display: inline-flex;
  max-width: 160px;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  background: #edf2f7;
  color: #334155;
  padding: 4px 10px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}

.report-chip b {
  color: #64748b;
  font-size: 14px;
}

.report-check-card {
  display: flex;
  min-height: 76px;
  align-items: center;
  gap: 12px;
  border: 1px solid #d8e2f0;
  border-radius: 14px;
  background: #f8fafc;
  color: #475569;
  padding: 14px;
  font-size: 14px;
  font-weight: 800;
}

.report-check-card input,
.report-advanced input {
  width: 17px;
  height: 17px;
  accent-color: #2563eb;
}

.report-advanced {
  border: 1px solid #d8e2f0;
  border-radius: 11px;
  background: #f8fafc;
  padding: 0 14px;
}

.report-advanced summary {
  margin: 0 -14px;
  color: #0057e7;
  cursor: pointer;
  padding: 12px 14px;
  font-size: 14px;
  font-weight: 900;
}

.report-advanced-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 28px;
  padding: 8px 0 16px;
}

.report-advanced-grid label {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #475569;
  font-size: 13px;
  font-weight: 800;
}

.report-advanced-grid span {
  color: #64748b;
  font-size: 13px;
}

.report-actions {
  display: flex;
  margin-top: auto;
  justify-content: flex-end;
}

.report-pdf-btn {
  min-width: 158px;
  min-height: 50px;
  border-radius: 10px;
  background: #0057e7;
  box-shadow: 0 8px 18px rgba(0, 87, 231, 0.28);
}

.report-card-foot {
  display: flex;
  min-height: 54px;
  align-items: center;
  gap: 24px;
  border: 1px solid #d8e2f0;
  border-radius: 12px;
  background: #fff;
  color: #64748b;
  padding: 0 18px;
  font-size: 13px;
  font-weight: 800;
}

.report-card-foot span::before {
  display: inline-block;
  width: 13px;
  height: 16px;
  margin-right: 12px;
  content: "";
  border: 1.5px solid #94a3b8;
  border-radius: 3px;
  vertical-align: -3px;
}

.report-card-foot button {
  border-left: 1px solid #e2e8f0;
  padding-left: 24px;
}

.report-result {
  display: flex;
  min-height: 90px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-radius: 12px;
  border: 1px solid #bfdbfe;
  background: #eff6ff;
  color: #1e3a8a;
  padding: 16px 20px;
  font-size: 14px;
  line-height: 1.45;
}

.report-result strong,
.report-result span {
  display: block;
}

.report-result strong {
  font-weight: 900;
}

.report-result span {
  margin-top: 6px;
  color: #64748b;
  font-size: 13px;
}

.report-result.success {
  border-color: #bbf7d0;
  background: linear-gradient(90deg, #ecfdf5, #f0fdf4);
  color: #047857;
}

.report-result.error {
  border-color: #fecaca;
  background: linear-gradient(90deg, #fff1f2, #fff7ed);
  color: #b91c1c;
}

.report-result a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(16, 185, 129, 0.24);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.66);
  color: #047857;
  padding: 10px 14px;
  font-weight: 900;
  text-decoration: none;
  white-space: nowrap;
}

.report-eye {
  position: relative;
  display: inline-block;
  width: 18px;
  height: 11px;
  border: 2px solid currentColor;
  border-radius: 999px / 70%;
}

.report-eye::after {
  position: absolute;
  top: 2px;
  left: 5px;
  width: 3px;
  height: 3px;
  content: "";
  border-radius: 999px;
  background: currentColor;
}

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

  .report-card {
    min-height: auto;
  }
}

@media (max-width: 720px) {
  .report-card {
    padding: 16px;
  }

  .report-form-grid.two,
  .report-advanced-grid {
    grid-template-columns: 1fr;
  }

  .report-result,
  .report-card-foot {
    align-items: flex-start;
    flex-direction: column;
    justify-content: flex-start;
    padding: 14px;
  }

  .report-card-foot {
    gap: 10px;
  }

  .report-card-foot button {
    border-left: 0;
    padding-left: 0;
  }
}

/* REESTRUTURAÇÃO VISUAL - CORREÇÃO DE LAYOUT COBRANÇA MANUAL */
.manual-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 20px;
  align-items: start;
}
.manual-main-column {
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
}
.manual-sidebar-column {
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.manual-card {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.05);
  overflow: hidden;
}
.manual-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  background: #fafbfc;
}
.manual-card-title {
  color: var(--text);
  font-size: 15px;
  font-weight: 900;
}
.manual-filters-body {
  padding: 20px;
}
.manual-quick-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}
.manual-pill {
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #f8fafc;
  color: var(--text);
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 750;
  transition: all 0.15s ease;
}
.manual-pill:hover,
.manual-pill.active {
  border-color: #93c5fd;
  background: var(--primary-soft);
  color: var(--primary-strong);
}
.manual-pill-clear {
  color: var(--text-muted);
}
.manual-fields-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}
.manual-fields-grid-4 {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}
.manual-fields-grid-3 .field,
.manual-fields-grid-4 .field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 800;
}
.manual-fields-grid-3 input,
.manual-fields-grid-3 select,
.manual-fields-grid-4 input,
.manual-fields-grid-4 select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
}
.manual-fields-grid-3 input:focus,
.manual-fields-grid-3 select:focus,
.manual-fields-grid-4 input:focus,
.manual-fields-grid-4 select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}
.field-action-btn {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}
.field-label-placeholder {
  font-size: 12px;
  visibility: hidden;
  margin-bottom: 6px;
}
.manual-search-btn {
  width: 100%;
  min-height: 42px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: #fff;
  font-weight: 900;
  font-size: 13px;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.25);
  transition: opacity 0.15s ease;
  cursor: pointer;
}
.manual-search-btn:hover {
  opacity: 0.92;
}
.manual-active-filters-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px dashed var(--border);
  font-size: 13px;
}
.active-chips-left {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}
.active-chips-title {
  color: var(--text-muted);
  font-weight: 800;
}
.active-chips-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid #bfdbfe;
  border-radius: 999px;
  background: #eff6ff;
  color: #1e40af;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 750;
  cursor: pointer;
}
.btn-clear-all-chips {
  border: none;
  background: transparent;
  color: var(--danger);
  font-size: 12px;
  font-weight: 850;
  cursor: pointer;
  white-space: nowrap;
}
.btn-clear-all-chips:hover {
  text-decoration: underline;
}
.manual-sidebar-card {
  padding: 20px;
}
.manual-sidebar-card h4 {
  margin: 0 0 14px;
  color: var(--text);
  font-size: 15px;
  font-weight: 900;
}
.sidebar-summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.summary-item {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #f8fafc;
  padding: 12px;
}
.summary-item.wide {
  grid-column: span 2;
}
.summary-item span {
  display: block;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.summary-item strong {
  display: block;
  margin-top: 4px;
  color: var(--text);
  font-size: 18px;
  font-weight: 950;
}
.quick-actions-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.quick-action-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: #fff;
  color: var(--text);
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 800;
  text-align: left;
  transition: all 0.15s ease;
  cursor: pointer;
}
.quick-action-btn:hover {
  border-color: #93c5fd;
  background: var(--bg-soft);
  color: var(--primary-strong);
}
.saved-filters-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.saved-filter-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-radius: 8px;
  background: #f8fafc;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 750;
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s ease;
}
.saved-filter-item:hover {
  background: var(--bg-soft);
  color: var(--primary-strong);
}
.full-width {
  width: 100%;
}
@media (max-width: 1200px) {
  .manual-workspace {
    grid-template-columns: 1fr;
  }
  .manual-fields-grid-4 {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 768px) {
  .manual-fields-grid-4,
  .manual-fields-grid-3 {
    grid-template-columns: 1fr;
  }
}

/* Padronização global de tipografia e hierarquia visual. Somente propriedades textuais. */
html,
body,
button,
input,
textarea,
select {
  font-family: var(--font-family);
}

body {
  font-size: var(--font-base);
  font-weight: var(--font-regular);
  line-height: 1.45;
}

.panel-title,
.collection-page-head .panel-title,
.customer-panel-header .panel-title,
.manual-page-head .panel-title,
.billing-compact-header .panel-title,
.billing-test-card .panel-title,
.billing-test-actions-card .panel-title {
  font-size: var(--font-page-title);
  font-weight: var(--font-bold);
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.page-kicker,
.modal-header .page-kicker,
.report-card-heading > span {
  font-size: var(--font-sm);
  font-weight: var(--font-bold);
  line-height: 1.3;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.panel-copy,
.table-header p,
.manual-table-header p,
.collection-card-heading p,
.collection-page-head .panel-copy,
.customer-panel-header .panel-copy,
.billing-shell-panel .panel-copy,
.report-card-heading p,
.modal-header p,
.hint,
.empty-state {
  font-size: var(--font-md);
  font-weight: var(--font-regular);
  line-height: 1.5;
}

.table-header h3,
.manual-table-header h4,
.collection-card-heading h4,
.collection-detail-head strong,
.collection-detail-content h5,
.collection-quick-card h5,
.collection-timeline-card h5,
.manual-sidebar-card h4,
.manual-card-title,
.report-card-heading h4,
.section-title,
.panel h4,
.card h4,
.modal-header h3,
.collection-record-modal .modal-header h3 {
  font-size: var(--font-lg);
  font-weight: var(--font-bold);
  line-height: 1.3;
  letter-spacing: -0.01em;
}

.manual-sidebar-card h4,
.manual-card-title,
.collection-quick-card h5,
.collection-timeline-card h5,
.collection-title-summary h5,
.collection-table-card h4,
.table-header h3 {
  font-size: 15px;
  font-weight: var(--font-semibold);
}

.field,
.field-inline,
.report-field,
.report-label,
.collection-filters-grid .field,
.collection-record-fields .field,
.manual-fields-grid-3 .field,
.manual-fields-grid-4 .field,
.sidebar .field,
.customer-panel .field,
.billing-provider-card > .field,
.billing-shell-panel .field,
.step-config-block .field,
.collection-period-field {
  font-size: var(--font-sm);
  font-weight: var(--font-semibold);
  line-height: 1.3;
}

input,
select,
textarea,
.field input,
.field select,
.field textarea,
.report-field input:not([type="hidden"]),
.report-select-trigger,
.collection-filters-grid input,
.collection-filters-grid select,
.collection-record-fields input,
.collection-record-fields select,
.collection-record-fields textarea,
.manual-fields-grid-3 input,
.manual-fields-grid-3 select,
.manual-fields-grid-4 input,
.manual-fields-grid-4 select {
  font-size: var(--font-base);
  font-weight: var(--font-medium);
  line-height: 1.4;
}

input::placeholder,
textarea::placeholder {
  font-size: var(--font-base);
  font-weight: var(--font-regular);
  color: var(--text-subtle);
}

.btn,
.btn-primary,
.btn-secondary,
.btn-ghost,
.btn-danger,
.btn-success,
.btn-warning,
.manual-search-btn,
.manual-pill,
.quick-action-btn,
.collection-row-actions button,
.collection-quick-card button,
.report-pdf-btn,
.report-select-apply,
.report-select-clear-action {
  font-size: var(--font-base);
  font-weight: var(--font-semibold);
  line-height: 1;
}

.nav-item,
.session-bar,
.user-menu,
.topbar-whatsapp-status {
  font-size: var(--font-base);
  font-weight: var(--font-medium);
}

.nav-item.active,
.nav-item[aria-current="page"] {
  font-weight: var(--font-semibold);
}

.data-table,
.manual-table,
.collection-table,
.billing-variables-table {
  font-size: var(--font-base);
  font-weight: var(--font-regular);
  line-height: 1.4;
}

.data-table th,
.manual-table th,
.collection-table th,
.billing-variables-table th {
  font-size: var(--font-sm);
  font-weight: var(--font-semibold);
  line-height: 1.3;
}

.data-table td,
.manual-table td,
.collection-table td,
.billing-variables-table td {
  font-size: var(--font-base);
  font-weight: var(--font-regular);
  line-height: 1.4;
}

.data-table td strong,
.manual-table td strong,
.collection-table td strong,
.collection-value,
.collection-delay,
.danger-value,
.table-money,
.amount,
.summary-item strong,
.manual-metrics strong,
.collection-metrics strong {
  font-weight: var(--font-semibold);
}

.badge,
.collection-status,
.collection-financial,
.payment-slip-state,
.filter-chip {
  font-size: var(--font-xs);
  font-weight: var(--font-semibold);
  line-height: 1;
}

.collection-metrics article span,
.manual-metrics article span,
.summary-item span,
.metric-card span,
.dashboard-card span {
  font-size: var(--font-sm);
  font-weight: var(--font-semibold);
  line-height: 1.3;
}

.collection-metrics article strong,
.manual-metrics article strong,
.metric-card strong,
.dashboard-card strong {
  font-size: var(--font-xl);
  font-weight: var(--font-bold);
  line-height: 1.15;
}

.collection-metrics article small,
.manual-metrics article small,
.metric-card small,
.dashboard-card small,
.collection-record-snapshot small,
.collection-title-summary small,
.manual-table td small,
.collection-table td small {
  font-size: var(--font-xs);
  font-weight: var(--font-regular);
  line-height: 1.4;
}

.collection-record-snapshot strong,
.collection-title-summary strong,
.collection-title-summary b,
.collection-client-summary strong,
.manual-table td strong,
.collection-table td strong {
  font-weight: var(--font-semibold);
}

.collection-record-modal .modal-header h3,
.manual-modal-header h3,
.modal-header h3 {
  font-size: 20px;
  font-weight: var(--font-bold);
  line-height: 1.25;
}

code,
.copy-field-row code {
  font-weight: var(--font-medium);
}

@media (max-width: 720px) {
  .panel-title,
  .collection-page-head .panel-title,
  .customer-panel-header .panel-title,
  .manual-page-head .panel-title,
  .billing-compact-header .panel-title {
    font-size: 28px;
  }
}

/* FilterPanel global visual layer. Scope is intentionally limited to existing filter areas. */
:where(
  .filter-panel,
  .filters-card,
  .manual-filters-card,
  .manual-history-filters,
  .collection-filters-card,
  .customer-search-card,
  .reports-section .report-form-grid
) {
  --filter-panel-border: #dbe4f0;
  --filter-panel-radius: 14px;
  --filter-panel-control-height: 42px;
  --filter-panel-control-radius: 9px;
  --filter-panel-control-font: 13px;
  background: #fff;
  border: 1px solid var(--filter-panel-border);
  border-radius: var(--filter-panel-radius);
  box-shadow: none;
}

.filters-card,
body:has(.nav-link[data-resource="bills-to-receive"].nav-active) .filters-card,
body:has(.nav-link[data-resource="bills-to-pay"].nav-active) .filters-card {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px;
  align-items: end;
  padding: 16px;
  margin-bottom: 18px;
  border-radius: 14px;
  background: #fff;
  box-shadow: none;
}

.filter-toolbar,
body:has(.nav-link[data-resource="bills-to-receive"].nav-active) .filter-toolbar,
body:has(.nav-link[data-resource="bills-to-pay"].nav-active) .filter-toolbar,
.manual-quick-pills {
  display: flex;
  flex-wrap: wrap;
  grid-column: 1 / -1;
  gap: 8px;
  margin: 0 0 2px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.filter-toolbar #clearFilters {
  margin-left: auto;
}

.date-preset,
body:has(.nav-link[data-resource="bills-to-receive"].nav-active) .date-preset,
body:has(.nav-link[data-resource="bills-to-pay"].nav-active) .date-preset,
.manual-pill {
  min-height: 32px;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #f8fafc;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  box-shadow: none;
}

.filters-card > .field,
body:has(.nav-link[data-resource="bills-to-receive"].nav-active) .filters-card > .field,
body:has(.nav-link[data-resource="bills-to-pay"].nav-active) .filters-card > .field,
.manual-filters-card .field,
.collection-filters-grid .field,
.customer-search-card .field,
.reports-section .report-field,
.reports-section .report-label {
  min-width: 0;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0;
}

.filters-card > .field input,
.filters-card > .field select,
body:has(.nav-link[data-resource="bills-to-receive"].nav-active) .filters-card > .field input,
body:has(.nav-link[data-resource="bills-to-receive"].nav-active) .filters-card > .field select,
body:has(.nav-link[data-resource="bills-to-pay"].nav-active) .filters-card > .field input,
body:has(.nav-link[data-resource="bills-to-pay"].nav-active) .filters-card > .field select,
.manual-filters-card .field input,
.manual-filters-card .field select,
.manual-history-filters input,
.manual-history-filters select,
.collection-filters-grid .field input,
.collection-filters-grid .field select,
.customer-search-card .field input,
.reports-section .report-field input:not([type="hidden"]),
.reports-section .report-select-trigger {
  width: 100%;
  min-height: 42px;
  height: auto;
  margin-top: 6px;
  border: 1px solid #d8e2f0;
  border-radius: 9px;
  background: #fff;
  color: var(--text);
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: none;
}

.filters-card > .field input:focus,
.filters-card > .field select:focus,
.manual-filters-card .field input:focus,
.manual-filters-card .field select:focus,
.manual-history-filters input:focus,
.manual-history-filters select:focus,
.collection-filters-grid .field input:focus,
.collection-filters-grid .field select:focus,
.customer-search-card .field input:focus,
.reports-section .report-field input:not([type="hidden"]):focus,
.reports-section .report-select-trigger:focus,
.reports-section .report-combo.open .report-select-trigger {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.filters-card > button[type="submit"],
body:has(.nav-link[data-resource="bills-to-receive"].nav-active) .filters-card > button[type="submit"],
body:has(.nav-link[data-resource="bills-to-pay"].nav-active) .filters-card > button[type="submit"],
.collection-filter-actions .btn,
.customer-search-row .btn,
.reports-section .report-actions .btn,
.manual-search-btn {
  min-height: 42px;
  border-radius: 9px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
}

#clearFilters,
.manual-pill-clear,
.collection-filter-actions .btn.btn-ghost,
.reports-section .report-card-foot button {
  min-height: 42px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: #f8fafc;
  color: var(--text-muted);
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
}

.manual-filters-body,
.collection-filters-grid,
.reports-section .report-form-grid,
.customer-search-card {
  padding: 16px;
}

.manual-fields-grid-3,
.manual-fields-grid-4,
.collection-filters-grid,
.manual-history-filters,
.reports-section .report-form-grid,
.customer-search-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px;
  align-items: end;
}

.manual-fields-grid-3,
.manual-fields-grid-4 {
  margin-bottom: 14px;
}

.manual-history-filters {
  padding: 16px;
  margin-bottom: 12px;
}

.collection-filters-card > summary {
  min-height: 44px;
  padding: 10px 16px;
}

.collection-filters-card > summary strong,
.manual-card-title,
.customer-search-header h4 {
  font-size: 14px;
  font-weight: 700;
}

.collection-filters-card > summary span,
.customer-search-header p {
  font-size: 12px;
  font-weight: 400;
}

.collection-period-field > span {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.collection-filter-actions,
.reports-section .report-actions {
  display: flex;
  grid-column: 1 / -1;
  align-items: end;
  justify-content: flex-end;
  gap: 10px;
}

.reports-section .report-form-grid.two {
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}

.reports-section .report-wide {
  grid-column: span 2;
}

.reports-section .report-select-menu {
  border-radius: 12px;
  border-color: #d8e2f0;
  box-shadow: 0 16px 36px rgba(15, 23, 42, 0.12);
}

.manual-active-filters-bar,
.active-filters {
  grid-column: 1 / -1;
}

@media (max-width: 900px) {
  .manual-fields-grid-3,
  .manual-fields-grid-4,
  .collection-filters-grid,
  .manual-history-filters,
  .reports-section .report-form-grid,
  .customer-search-row,
  .filters-card,
  body:has(.nav-link[data-resource="bills-to-receive"].nav-active) .filters-card,
  body:has(.nav-link[data-resource="bills-to-pay"].nav-active) .filters-card {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  }

  .reports-section .report-wide {
    grid-column: 1 / -1;
  }
}

@media (max-width: 640px) {
  .manual-fields-grid-3,
  .manual-fields-grid-4,
  .collection-filters-grid,
  .manual-history-filters,
  .reports-section .report-form-grid,
  .customer-search-row,
  .filters-card,
  body:has(.nav-link[data-resource="bills-to-receive"].nav-active) .filters-card,
  body:has(.nav-link[data-resource="bills-to-pay"].nav-active) .filters-card {
    grid-template-columns: 1fr;
  }

  .filter-toolbar #clearFilters,
  .collection-filter-actions,
  .reports-section .report-actions {
    width: 100%;
  }

  .collection-filter-actions .btn,
  .reports-section .report-actions .btn,
  .filters-card > button[type="submit"] {
    width: 100%;
  }
}

.licensing-section {
  display: grid;
  gap: 16px;
  color: #071b3a;
}

.licensing-head,
.licensing-actions,
.licensing-card-head,
.licensing-filter-actions,
.licensing-footer {
  display: flex;
  align-items: center;
}

.licensing-head {
  justify-content: space-between;
  gap: 16px;
}

.licensing-head h2 {
  margin: 0;
  font-size: 28px;
  font-weight: 850;
}

.licensing-head p,
.licensing-card-head p {
  margin: 4px 0 0;
  color: #526176;
  font-size: 13px;
}

.licensing-actions {
  gap: 10px;
}

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

.licensing-grid {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.licensing-grid.bottom {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.licensing-metric,
.licensing-card {
  border: 1px solid #dbe3ef;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.05);
}

.licensing-metric {
  display: grid;
  gap: 5px;
  padding: 14px 16px;
}

.licensing-metric span,
.licensing-status-list dt {
  color: #526176;
  font-size: 12px;
  font-weight: 800;
}

.licensing-metric strong {
  font-size: 28px;
  line-height: 1;
}

.licensing-metric small {
  color: #64748b;
  font-size: 11px;
  font-weight: 700;
}

.licensing-metric.warning strong { color: #ea580c; }
.licensing-metric.danger strong,
.licensing-metric.blocked strong { color: #dc2626; }

.licensing-card {
  overflow: hidden;
}

.licensing-card-head {
  justify-content: space-between;
  gap: 12px;
  min-height: 56px;
  border-bottom: 1px solid #e4e9f1;
  padding: 12px 16px;
}

.licensing-card-head h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 850;
}

.licensing-status-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
  padding: 14px 16px;
}

.licensing-status-list.compact {
  grid-template-columns: 1fr 1fr;
  padding-top: 6px;
}

.licensing-status-list div {
  display: grid;
  gap: 4px;
}

.licensing-status-list dd {
  margin: 0;
  font-size: 13px;
  font-weight: 850;
}

.license-server-card > .btn,
.integrity-card > .btn {
  margin: 0 16px 16px;
}

.license-integrity-copy {
  margin: 12px 16px 0;
  color: #334155;
  font-size: 13px;
  font-weight: 700;
}

.licensing-filters {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
  padding: 14px 16px;
}

.licensing-filters .wide {
  grid-column: span 2;
}

.licensing-filter-actions {
  gap: 8px;
  justify-content: flex-end;
  align-self: end;
}

.tenant-form {
  display: grid;
  grid-template-columns: 150px minmax(220px, 1fr) 160px minmax(220px, 1fr) 140px auto;
  gap: 12px;
  align-items: end;
  padding: 14px 16px;
}

.tenant-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  max-height: min(42vh, 360px);
  overflow: auto;
  border-top: 1px solid #e4e9f1;
  padding: 12px 16px;
}

.tenant-list.empty-state {
  display: block;
}

.tenant-item {
  display: grid;
  gap: 4px;
  border: 1px solid #e4e9f1;
  border-radius: 9px;
  background: #fbfcfe;
  padding: 10px;
  text-align: left;
}

.tenant-item strong {
  color: #071b3a;
  font-size: 13px;
}

.tenant-item span {
  color: #526176;
  font-size: 12px;
}

.tenant-item small {
  justify-self: start;
}

.licensing-table-scroll {
  max-height: min(56vh, 600px);
  overflow: auto;
}

.licensing-table th {
  position: sticky;
  top: 0;
  z-index: 2;
}

.licensing-table {
  width: 100%;
  min-width: 1320px;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 12px;
}

.licensing-table th,
.licensing-table td {
  border-right: 1px solid #e4e9f1;
  border-bottom: 1px solid #e4e9f1;
  padding: 10px 9px;
  text-align: left;
  vertical-align: middle;
  overflow-wrap: anywhere;
}

.licensing-table th {
  background: #fbfcfe;
  color: #334155;
  font-size: 11px;
  font-weight: 850;
}

.licensing-table td:first-child strong,
.licensing-table td:first-child small {
  display: block;
}

.licensing-table td:first-child small {
  margin-top: 3px;
  color: #64748b;
  font-size: 11px;
}

.licensing-table code {
  color: #075bd8;
  font-size: 11px;
  white-space: normal;
}

.licensing-footer {
  justify-content: flex-end;
  gap: 10px;
  padding: 12px 16px;
}

.license-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 11px;
  font-weight: 850;
  white-space: nowrap;
}

.license-badge.active { background: #dcfce7; color: #166534; }
.license-badge.warning { background: #ffedd5; color: #c2410c; }
.license-badge.attention { background: #fef3c7; color: #92400e; }
.license-badge.danger { background: #fee2e2; color: #991b1b; }
.license-badge.offline,
.license-badge.neutral { background: #f1f5f9; color: #475569; }

.license-list {
  display: grid;
  gap: 8px;
  padding: 12px 16px;
}

.license-list.empty-state {
  display: block;
}

.license-list-item {
  display: grid;
  gap: 2px;
  border: 1px solid #e4e9f1;
  border-radius: 8px;
  background: #fbfcfe;
  padding: 9px 10px;
}

.license-list-item strong {
  font-size: 12px;
}

.license-list-item span {
  color: #526176;
  font-size: 12px;
}

.license-drawer {
  position: fixed;
  inset: 0;
  z-index: 60;
}

.license-drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.38);
}

.license-drawer-panel {
  position: absolute;
  top: 0;
  right: 0;
  display: grid;
  gap: 14px;
  width: min(760px, 100vw);
  height: 100%;
  overflow: auto;
  background: #fff;
  box-shadow: -16px 0 32px rgba(15, 23, 42, 0.18);
  padding: 20px;
}

.license-drawer-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid #e4e9f1;
  padding-bottom: 12px;
}

.license-drawer-head h3 {
  margin: 0;
  font-size: 20px;
  font-weight: 850;
}

.license-drawer-head p {
  margin: 4px 0 0;
  color: #526176;
  font-size: 13px;
}

.license-drawer-head button {
  border: 0;
  background: transparent;
  color: #334155;
  font-size: 28px;
}

.license-detail-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.license-detail-summary div {
  display: grid;
  gap: 3px;
  border: 1px solid #e4e9f1;
  border-radius: 8px;
  background: #fbfcfe;
  padding: 10px;
}

.license-detail-summary span {
  color: #526176;
  font-size: 11px;
  font-weight: 800;
}

.license-detail-summary strong {
  font-size: 12px;
  overflow-wrap: anywhere;
}

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

.license-form-grid .wide {
  grid-column: span 2;
}

.license-feature-box {
  border: 1px solid #e4e9f1;
  border-radius: 10px;
  padding: 12px;
}

.license-feature-box h4 {
  margin: 0 0 10px;
  font-size: 14px;
}

.license-feature-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.license-feature-list label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid #e4e9f1;
  border-radius: 8px;
  padding: 8px;
  font-size: 12px;
  font-weight: 800;
}

.license-drawer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  border-top: 1px solid #e4e9f1;
  padding-top: 14px;
}

@media (max-width: 1280px) {
  .licensing-metrics,
  .licensing-grid,
  .licensing-grid.bottom,
  .tenant-form,
  .tenant-list,
  .licensing-filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .licensing-head,
  .licensing-actions,
  .licensing-card-head,
  .licensing-filter-actions,
  .license-drawer-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .licensing-metrics,
  .licensing-grid,
  .licensing-grid.bottom,
  .tenant-form,
  .tenant-list,
  .licensing-filters,
  .license-form-grid,
  .license-feature-list,
  .license-detail-summary {
    grid-template-columns: 1fr;
  }

  .licensing-filters .wide,
  .license-form-grid .wide {
    grid-column: span 1;
  }
}

.legal-section {
  min-width: 0;
}

body:has(#legalForwardingSection:not(.hidden)) {
  background: #f7f9fc;
}

body:has(#legalForwardingSection:not(.hidden)) .app-shell {
  grid-template-columns: 200px minmax(0, 1fr);
}

body.sidebar-collapsed:has(#legalForwardingSection:not(.hidden)) .app-shell {
  grid-template-columns: 72px minmax(0, 1fr);
}

body:has(#legalForwardingSection:not(.hidden)) .sidebar {
  gap: 18px;
  padding: 22px 0 0;
  background:
    linear-gradient(180deg, #063869 0%, #052a52 44%, #031d3c 100%),
    radial-gradient(circle at 0 0, rgba(16, 108, 255, 0.45), transparent 190px);
}

body:has(#legalForwardingSection:not(.hidden)) .nav-section-toggle {
  display: none;
}

body:has(#legalForwardingSection:not(.hidden)) .sidebar-toggle {
  display: grid;
  top: 18px;
  right: -14px;
  width: 30px;
  height: 30px;
  border: 1px solid rgba(191, 219, 254, 0.45);
  background: #075bd8;
  color: #fff;
  box-shadow: 0 10px 24px rgba(3, 20, 48, 0.28);
}

body:has(#legalForwardingSection:not(.hidden)) .sidebar-toggle:hover {
  border-color: rgba(255, 255, 255, 0.72);
  background: #0b6bff;
}

body:has(#legalForwardingSection:not(.hidden)) .brand-card {
  min-height: 52px;
  margin: 0 16px 18px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  padding: 0;
}

body.sidebar-collapsed:has(#legalForwardingSection:not(.hidden)) .brand-card {
  min-height: 52px;
  margin: 0 10px 18px;
  place-items: center;
}

body:has(#legalForwardingSection:not(.hidden)) .brand-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  font-size: 17px;
  font-weight: 850;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

body.sidebar-collapsed:has(#legalForwardingSection:not(.hidden)) .brand-title {
  width: 100%;
  justify-content: center;
  font-size: 0;
}

body:has(#legalForwardingSection:not(.hidden)) .brand-title::before {
  content: "";
  display: inline-block;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: radial-gradient(circle at center, #38bdf8 0 24%, #075bd8 26% 100%);
  box-shadow: inset 0 0 0 6px rgba(255, 255, 255, 0.14);
}

body:has(#legalForwardingSection:not(.hidden)) .nav-group {
  gap: 0;
  padding: 0;
}

body:has(#legalForwardingSection:not(.hidden)) .nav-section,
body:has(#legalForwardingSection:not(.hidden)) .nav-section-items {
  margin: 0;
  border: 0;
  background: transparent;
  padding: 0;
}

body:has(#legalForwardingSection:not(.hidden)) .nav-item,
body:has(#legalForwardingSection:not(.hidden)) .nav-link {
  min-height: 44px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #dbeafe;
  padding: 0 18px;
  font-size: 13px;
  font-weight: 500;
}

body.sidebar-collapsed:has(#legalForwardingSection:not(.hidden)) .nav-item,
body.sidebar-collapsed:has(#legalForwardingSection:not(.hidden)) .nav-link {
  width: 48px;
  min-height: 48px;
  justify-content: center;
  margin: 4px auto;
  border-radius: 14px;
  padding: 0;
}

body.sidebar-collapsed:has(#legalForwardingSection:not(.hidden)) .nav-icon {
  margin: 0;
}

body:has(#legalForwardingSection:not(.hidden)) .nav-active {
  background: rgba(37, 99, 235, 0.33);
  color: #fff;
}

body:has(#legalForwardingSection:not(.hidden)) .main-panel {
  padding: 0;
  background: #f7f9fc;
}

body:has(#legalForwardingSection:not(.hidden)) .topbar {
  display: none;
}

.legal-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 620px;
  min-height: 100vh;
}

.legal-layout:has(.legal-drawer.hidden) {
  grid-template-columns: minmax(0, 1fr);
}

.legal-main-area {
  display: grid;
  align-content: start;
  gap: 20px;
  min-width: 0;
  padding: 28px 32px 36px;
}

.legal-page-head,
.legal-title-wrap,
.legal-card-heading,
.legal-table-footer,
.legal-filter-actions,
.legal-selection-bar,
.legal-pages,
.legal-legend,
.legal-side-heading,
.legal-drawer-actions {
  display: flex;
  align-items: center;
}

.legal-page-head {
  justify-content: space-between;
  gap: 18px;
}

.legal-title-wrap {
  gap: 15px;
}

.legal-title-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  color: #0b5bd3;
}

.legal-title-mark svg,
#legalForwardingNav svg {
  width: 30px;
  height: 30px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.9;
}

.legal-page-head .panel-title {
  margin: 0;
  color: #071b3a;
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -0.04em;
}

.legal-page-head .panel-copy {
  margin-top: 4px;
  color: #526176;
  font-size: 13px;
}

.legal-new-button {
  min-height: 44px;
  border-radius: 6px;
  background: #075bd8;
  padding: 0 22px;
  box-shadow: 0 12px 24px rgba(7, 91, 216, 0.22);
  font-weight: 700;
}

.legal-new-button span {
  margin-right: 9px;
  font-size: 18px;
}

.legal-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.legal-metric-card,
.legal-filters-card,
.legal-table-card,
.legal-drawer-block,
.legal-dossier-check {
  border: 1px solid #d6deea;
  border-radius: 7px;
  background: #fff;
  box-shadow: 0 12px 34px rgba(15, 23, 42, 0.035);
}

.legal-metric-card {
  position: relative;
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  grid-template-areas:
    "icon title"
    "value value"
    "amount amount"
    "note note";
  column-gap: 7px;
  align-content: start;
  min-width: 0;
  min-height: 82px;
  padding: 10px 12px 9px;
}

.legal-metric-card i {
  grid-area: icon;
  display: grid;
  width: 21px;
  height: 21px;
  place-items: center;
  border-radius: 999px;
  font-style: normal;
  font-size: 10px;
  font-weight: 900;
}

.legal-metric-card span,
.legal-metric-card small,
.legal-metric-card b {
  display: block;
}

.legal-metric-card span {
  grid-area: title;
  align-self: center;
  margin-top: 0;
  padding-left: 0;
  color: #071b3a;
  font-size: 10px;
  font-weight: 800;
  line-height: 1.25;
}

.legal-metric-card strong {
  grid-area: value;
  display: block;
  min-width: 0;
  margin-top: 8px;
  color: #06152f;
  font-size: clamp(17px, 1.45vw, 21px);
  font-weight: 850;
  letter-spacing: -0.05em;
  line-height: 1;
  overflow-wrap: anywhere;
}

.legal-metric-card b {
  grid-area: amount;
  min-width: 0;
  margin-top: 4px;
  color: #071b3a;
  font-size: 10px;
  font-weight: 600;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.legal-metric-card small {
  grid-area: note;
  min-width: 0;
  margin-top: 5px;
  color: #526176;
  font-size: 9px;
  line-height: 1.25;
}

.legal-metric-card.metric-purple strong {
  font-size: clamp(12px, 1vw, 15px);
  line-height: 1.08;
}

.metric-blue i { background: #e8f1ff; color: #075bd8; }
.metric-orange i { background: #fff1e6; color: #f97316; }
.metric-green i { background: #e8f8ef; color: #16a34a; }
.metric-purple i { background: #f0ebff; color: #7c3aed; }

.legal-filters-card,
.legal-table-card {
  overflow: hidden;
}

.legal-filter-heading,
.legal-card-heading {
  justify-content: space-between;
  min-height: 54px;
  border-bottom: 1px solid #dbe3ef;
  padding: 0 18px;
}

.legal-filter-heading strong,
.legal-card-heading h4,
.legal-drawer-block h4,
.legal-drawer-head h3 {
  margin: 0;
  color: #071b3a;
  font-size: 16px;
  font-weight: 800;
}

.legal-filters-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 16px;
  padding: 18px;
}

.legal-filters-grid .field {
  color: #071b3a;
  font-size: 12px;
  font-weight: 700;
}

.legal-filters-grid .field input,
.legal-filters-grid .field select,
.legal-drawer-panel .field input,
.legal-drawer-panel .field textarea,
.legal-drawer-panel .field select,
.legal-pages select {
  min-height: 40px;
  margin-top: 8px;
  border: 1px solid #cfd8e6;
  border-radius: 5px;
  background: #fff;
  color: #243247;
  font-size: 13px;
}

.legal-field-wide {
  grid-column: span 2;
}

.legal-period-field {
  grid-column: span 2;
}

.legal-period-field > span {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.legal-filter-actions {
  grid-column: 4 / -1;
  justify-content: flex-end;
  gap: 14px;
  padding: 0 18px 18px;
}

.legal-filter-actions .btn {
  min-height: 40px;
  border-radius: 5px;
  padding-inline: 24px;
}

.legal-legend {
  gap: 26px;
  color: #526176;
  font-size: 12px;
}

.legal-legend span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.legal-legend i {
  display: inline-block;
  width: 18px;
  height: 18px;
  border-radius: 5px;
}

.legal-legend .ok { background: #dcfce7; }
.legal-legend .warn { background: #ffedd5; }
.legal-legend .info { background: #dbeafe; }

.legal-table-heading-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  min-width: 0;
}

.legal-table-heading-actions .btn {
  min-height: 34px;
  border-radius: 7px;
  padding: 7px 12px;
  white-space: nowrap;
}

.legal-column-panel {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr)) auto;
  gap: 12px;
  align-items: end;
  border-bottom: 1px solid #dbe3ef;
  background: #f8fbff;
  padding: 14px 18px;
}

.legal-column-panel label {
  display: grid;
  gap: 6px;
  color: #071b3a;
  font-size: 11px;
  font-weight: 800;
}

.legal-column-panel input[type="range"] {
  width: 100%;
  accent-color: #075bd8;
}

.legal-column-panel output {
  color: #526176;
  font-size: 11px;
  font-weight: 700;
}

.legal-column-panel .btn {
  min-height: 36px;
  align-self: center;
  white-space: nowrap;
}

.legal-selection-bar {
  justify-content: flex-start;
  gap: 26px;
  min-height: 50px;
  border-bottom: 1px solid #dbe3ef;
  padding: 0 18px;
  color: #075bd8;
  font-size: 13px;
  font-weight: 700;
}

.legal-selection-bar label {
  display: inline-flex;
  align-items: center;
  gap: 9px;
}

.legal-link-button {
  border: 0;
  background: transparent;
  color: #075bd8;
  font-size: 13px;
  font-weight: 700;
}

.legal-table-scroll {
  max-height: min(58vh, 620px);
  overflow: auto;
}

.legal-table th {
  position: sticky;
  top: 0;
  z-index: 2;
}

.legal-table {
  width: 100%;
  min-width: var(--legal-table-min-width, 1500px);
  border-collapse: collapse;
  table-layout: fixed;
  color: #071b3a;
  font-size: 12px;
}

.legal-table th,
.legal-table td {
  border-right: 1px solid #e4e9f1;
  border-bottom: 1px solid #e4e9f1;
  padding: 13px 10px;
  text-align: left;
  vertical-align: middle;
  overflow: hidden;
  overflow-wrap: anywhere;
  word-break: normal;
}

.legal-table th:last-child,
.legal-table td:last-child {
  border-right: 0;
}

.legal-table th {
  background: #fbfcfe;
  color: #071b3a;
  font-size: 11px;
  font-weight: 800;
}

.legal-table tbody tr:hover {
  background: #f8fbff;
}

.legal-table th:nth-child(1),
.legal-table td:nth-child(1) { width: 36px; text-align: center; }
.legal-table th:nth-child(2),
.legal-table td:nth-child(2) { width: var(--legal-col-company, 135px); }
.legal-table th:nth-child(3),
.legal-table td:nth-child(3) { width: var(--legal-col-cost-center, 140px); }
.legal-table th:nth-child(4),
.legal-table td:nth-child(4) { width: var(--legal-col-client, 190px); }
.legal-table th:nth-child(5),
.legal-table td:nth-child(5) { width: var(--legal-col-document, 145px); }
.legal-table th:nth-child(6),
.legal-table td:nth-child(6) { width: var(--legal-col-title, 105px); }
.legal-table th:nth-child(7),
.legal-table td:nth-child(7) { width: 64px; }
.legal-table th:nth-child(8),
.legal-table td:nth-child(8) { width: 90px; }
.legal-table th:nth-child(9),
.legal-table td:nth-child(9) { width: 76px; text-align: center; }
.legal-table th:nth-child(10),
.legal-table td:nth-child(10) { width: var(--legal-col-amount, 105px); }
.legal-table th:nth-child(11),
.legal-table td:nth-child(11) { width: var(--legal-col-balance, 105px); }
.legal-table th:nth-child(12),
.legal-table td:nth-child(12),
.legal-table th:nth-child(13),
.legal-table td:nth-child(13),
.legal-table th:nth-child(15),
.legal-table td:nth-child(15) { width: 58px; text-align: center; }
.legal-table th:nth-child(14),
.legal-table td:nth-child(14) { width: 112px; }

.legal-client-link {
  display: block;
  width: 100%;
  border: 0;
  background: transparent;
  color: #075bd8;
  padding: 0;
  text-align: left;
  font-weight: 800;
  line-height: 1.35;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: normal;
}

.legal-date-danger,
.legal-days-danger {
  color: #dc2626;
  font-weight: 800;
}

.legal-history-button,
.legal-actions-button {
  display: inline-grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 0;
  border-radius: 6px;
  background: #eaf2ff;
  color: #075bd8;
  font-weight: 900;
}

.legal-actions-button {
  background: transparent;
  color: #071b3a;
  font-size: 20px;
}

.legal-contract-icon {
  display: inline-grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 900;
}

.legal-contract-icon.ready {
  border: 2px solid #22c55e;
  color: #16a34a;
}

.legal-contract-icon.missing {
  border: 2px solid #f97316;
  color: #f97316;
}

.legal-status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 4px;
  background: #f1f5f9;
  color: #334155;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 750;
}

.legal-status-pill.ready,
.legal-status-pill.pending {
  background: #fff7ed;
  color: #c2410c;
}

.legal-status-pill.forwarded {
  background: #dbeafe;
  color: #075bd8;
}

.legal-status-pill.under_review {
  background: #ede9fe;
  color: #6d28d9;
}

.legal-table-footer {
  justify-content: space-between;
  min-height: 58px;
  border-top: 1px solid #dbe3ef;
  padding: 0 18px;
  color: #344256;
  font-size: 14px;
}

.legal-pages {
  gap: 18px;
}

.legal-pages strong,
.legal-page-button {
  display: inline-grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 6px;
}

.legal-pages strong {
  background: #075bd8;
  color: #fff;
}

.legal-page-button {
  border: 0;
  background: transparent;
  color: #64748b;
  font-size: 22px;
}

.legal-drawer {
  min-width: 0;
  border-left: 1px solid #dbe3ef;
  background: #fff;
}

.legal-drawer.hidden {
  display: none !important;
}

.legal-drawer-backdrop {
  display: none;
}

.legal-drawer-panel {
  display: grid;
  align-content: start;
  gap: 14px;
  height: 100vh;
  overflow: auto;
  background: #fff;
  padding: 22px 26px 20px;
}

.legal-drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 42px;
  border-bottom: 1px solid #dbe3ef;
}

.legal-drawer-head button {
  border: 0;
  background: transparent;
  color: #46566d;
  font-size: 28px;
  line-height: 1;
}

.legal-stepper {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 2px 0 8px;
}

.legal-stepper span {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  color: #344256;
  font-size: 13px;
  font-weight: 800;
}

.legal-stepper span::after {
  content: "";
  height: 1px;
  flex: 1;
  background: #dbe3ef;
}

.legal-stepper span:last-child::after {
  display: none;
}

.legal-stepper b {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 1px solid #cfd8e6;
  border-radius: 999px;
  color: #94a3b8;
}

.legal-stepper .active b {
  border-color: #075bd8;
  background: #075bd8;
  color: #fff;
}

.legal-drawer-block {
  display: grid;
  gap: 12px;
  padding: 16px;
}

.legal-client-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px 28px;
}

.legal-client-grid span {
  display: block;
  color: #526176;
  font-size: 11px;
  font-weight: 700;
}

.legal-client-grid strong {
  display: block;
  margin-top: 7px;
  color: #071b3a;
  font-size: 13px;
  font-weight: 600;
}

.legal-selected-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.legal-selected-table th,
.legal-selected-table td {
  border-bottom: 1px solid #e4e9f1;
  padding: 10px 6px;
  text-align: left;
}

.legal-selected-table th {
  color: #071b3a;
  font-weight: 800;
}

.legal-drawer-totals {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: #071b3a;
  font-size: 13px;
}

.legal-drawer-totals > strong {
  color: #dc2626;
}

.legal-history-preview {
  display: grid;
  gap: 12px;
}

.legal-history-preview p {
  margin: 0;
  color: #526176;
  font-size: 12px;
}

.legal-contract-box {
  display: grid;
  gap: 7px;
  border: 1px solid #86efac;
  border-radius: 5px;
  background: #f0fdf4;
  padding: 14px;
  color: #071b3a;
  font-size: 12px;
}

.legal-customer-documents {
  margin-top: 10px;
}

.legal-sienge-documents {
  display: grid;
  gap: 8px;
}

.legal-sienge-documents label {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  border: 1px solid #dbeafe;
  border-radius: 10px;
  background: #eff6ff;
  padding: 9px;
  color: #1e3a8a;
  font-size: 12px;
}

.legal-sienge-documents strong,
.legal-sienge-documents small {
  display: block;
}

.legal-sienge-documents small {
  margin-top: 2px;
  color: #475569;
}

.legal-sienge-documents a {
  color: #2563eb;
  font-weight: 800;
}

.legal-document-checks {
  display: grid;
  gap: 9px;
}

.legal-document-checks label,
.legal-dossier-check {
  display: flex;
  align-items: center;
  gap: 9px;
  color: #243247;
  font-size: 13px;
  font-weight: 600;
}

.legal-document-checks label {
  min-height: 34px;
}

.legal-dossier-check {
  padding: 12px 14px;
}

.legal-drawer-actions {
  position: sticky;
  bottom: -20px;
  justify-content: flex-end;
  gap: 12px;
  border-top: 1px solid #dbe3ef;
  background: #fff;
  padding: 18px 0 0;
}

.legal-drawer-actions .btn {
  min-height: 38px;
  border-radius: 5px;
  padding-inline: 16px;
}

@media (max-width: 1600px) {
  .legal-layout {
    grid-template-columns: minmax(0, 1fr) 500px;
  }

  .legal-main-area {
    padding: 22px;
  }
}

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

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

  .legal-drawer {
    border-left: 0;
    border-top: 1px solid #dbe3ef;
  }

  .legal-drawer-panel {
    height: auto;
    max-height: none;
  }

  .legal-metrics,
  .legal-filters-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .legal-main-area,
  .legal-drawer-panel {
    padding: 16px;
  }

  .legal-page-head,
  .legal-card-heading,
  .legal-table-footer,
  .legal-drawer-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .legal-table-heading-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .legal-legend {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .legal-column-panel {
    grid-template-columns: 1fr;
  }

  .legal-metrics,
  .legal-filters-grid,
  .legal-client-grid,
  .legal-period-field > span {
    grid-template-columns: 1fr;
  }

  .legal-field-wide,
  .legal-period-field {
    grid-column: span 1;
  }
}

.filter-enhanced-native-select {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  min-height: 1px !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

.filter-search-select {
  position: relative;
  width: 100%;
  margin-top: 6px;
  z-index: 10;
}

.filter-search-select.open {
  z-index: 1200;
}

.filters-card > .field .filter-search-input,
.manual-filters-card .field .filter-search-input,
.manual-history-filters .filter-search-input,
.collection-filters-grid .field .filter-search-input,
.legal-filters-card .field .filter-search-input {
  width: 100%;
  min-height: 42px;
  height: 42px;
  margin-top: 0;
  border: 1px solid #d8e2f0;
  border-radius: 9px;
  background: #fff;
  color: #111827;
  padding: 8px 34px 8px 14px;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.2;
  outline: none;
}

.filter-search-select.open .filter-search-input,
.filter-search-input:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.16);
}

.filter-search-arrow {
  position: absolute;
  top: 50%;
  right: 12px;
  color: #111827;
  font-size: 16px;
  line-height: 1;
  pointer-events: none;
  transform: translateY(-50%);
}

.filter-search-options {
  position: absolute;
  left: 0;
  bottom: calc(100% + 4px);
  display: none;
  width: 100%;
  max-height: 540px;
  overflow: auto;
  border: 1px solid #d1d5db;
  border-radius: 2px;
  background: #fff;
  box-shadow: 0 14px 32px rgba(15, 23, 42, 0.16);
  padding: 4px 0;
}

.filter-search-select.open .filter-search-options {
  display: block;
}

.filter-search-option {
  display: block;
  width: 100%;
  min-height: 30px;
  border: 0;
  border-radius: 0;
  background: #fff;
  color: #03102b;
  padding: 6px 16px;
  font-size: 14px;
  font-weight: 400;
  line-height: 1.3;
  text-align: left;
  white-space: nowrap;
  cursor: pointer;
}

.filter-search-option:hover,
.filter-search-option.active,
.filter-search-option.selected {
  background: #7a7a7a;
  color: #fff;
}

.filter-search-empty {
  padding: 10px 14px;
  color: #64748b;
  font-size: 13px;
}

.collection-filters-grid {
  grid-template-columns: repeat(4, minmax(210px, 1fr));
  gap: 14px 16px;
  padding: 16px 18px 18px;
}

.collection-filters-card {
  overflow: visible;
}

.collection-filters-grid .field {
  color: #64748b;
  font-size: 12px;
  font-weight: 600;
}

.collection-filters-grid .field input,
.collection-filters-grid .field select {
  min-height: 42px;
  border: 1px solid #d8e2f0;
  border-radius: 9px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 500;
}

.collection-period-field > span {
  gap: 8px;
}

.collection-filter-actions {
  grid-column: 1 / -1;
  justify-content: flex-end;
}

@media (max-width: 1100px) {
  .collection-filters-grid {
    grid-template-columns: repeat(2, minmax(190px, 1fr));
  }
}

@media (max-width: 640px) {
  .collection-filters-grid {
    grid-template-columns: 1fr;
  }

  .filter-search-options {
    bottom: auto;
    top: calc(100% + 4px);
    max-height: 320px;
  }
}

/* Layout visual compacto para Contas a Receber e Cobrança Manual. */
.receivable-filter-heading {
  display: none;
}

body:has(.nav-link[data-resource="bills-to-receive"].nav-active) .receivable-filter-heading {
  display: flex;
  grid-column: 1 / -1;
  align-items: baseline;
  gap: 8px;
  min-height: 32px;
  padding-bottom: 10px;
  border-bottom: 1px solid #e5edf6;
}

body:has(.nav-link[data-resource="bills-to-receive"].nav-active) .receivable-filter-heading strong,
.manual-card-title-block .manual-card-title {
  color: #111827;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0;
}

body:has(.nav-link[data-resource="bills-to-receive"].nav-active) .receivable-filter-heading span,
.manual-card-title-block small {
  color: #64748b;
  font-size: 12px;
  font-weight: 400;
}

body:has(.nav-link[data-resource="bills-to-receive"].nav-active) .filters-card {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px 14px;
  margin-bottom: 16px;
  padding: 14px;
  border-color: #dbe4f0;
  border-radius: 14px;
  background: #fff;
  box-shadow: none;
}

body:has(.nav-link[data-resource="bills-to-receive"].nav-active) .filters-card .filter-toolbar {
  margin: 0;
  padding-bottom: 10px;
}

body:has(.nav-link[data-resource="bills-to-receive"].nav-active) .filters-card > .field,
.manual-filters-card .field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0;
  color: #64748b;
  font-size: 12px;
  font-weight: 600;
}

body:has(.nav-link[data-resource="bills-to-receive"].nav-active) .filters-card > .field input,
body:has(.nav-link[data-resource="bills-to-receive"].nav-active) .filters-card > .field select,
body:has(.nav-link[data-resource="bills-to-receive"].nav-active) .filters-card > .field .filter-search-input,
.manual-filters-card .field input,
.manual-filters-card .field select,
.manual-filters-card .field .filter-search-input {
  min-height: 40px;
  height: 40px;
  margin-top: 0;
  border: 1px solid #d8e2f0;
  border-radius: 9px;
  background: #fff;
  color: #111827;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: none;
}

body:has(.nav-link[data-resource="bills-to-receive"].nav-active) .filters-card > .field input:focus,
body:has(.nav-link[data-resource="bills-to-receive"].nav-active) .filters-card > .field select:focus,
body:has(.nav-link[data-resource="bills-to-receive"].nav-active) .filters-card > .field .filter-search-input:focus,
.manual-filters-card .field input:focus,
.manual-filters-card .field select:focus,
.manual-filters-card .field .filter-search-input:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

body:has(.nav-link[data-resource="bills-to-receive"].nav-active) .filters-card > button[type="submit"],
.manual-search-btn {
  min-height: 40px;
  border-radius: 9px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 700;
  box-shadow: none;
}

body:has(.nav-link[data-resource="bills-to-receive"].nav-active) .filters-card > button[type="submit"] {
  grid-column: span 2;
}

body:has(.nav-link[data-resource="bills-to-receive"].nav-active) .date-preset,
.manual-pill {
  min-height: 30px;
  padding: 5px 11px;
  border-color: #d8e2f0;
  background: #f8fafc;
  color: #64748b;
  font-size: 12px;
  font-weight: 600;
  box-shadow: none;
}

body:has(.nav-link[data-resource="bills-to-receive"].nav-active) .date-preset:hover,
body:has(.nav-link[data-resource="bills-to-receive"].nav-active) .date-preset.active,
.manual-pill:hover,
.manual-pill.active {
  border-color: #93c5fd;
  background: #eff6ff;
  color: #1d4ed8;
}

body:has(.nav-link[data-resource="bills-to-receive"].nav-active) .active-filters,
.manual-active-filters-bar {
  margin-top: 2px;
  padding-top: 10px;
  border-top: 1px dashed #dbe4f0;
}

body:has(.nav-link[data-resource="bills-to-receive"].nav-active) .metric-grid {
  gap: 12px;
  margin-bottom: 16px;
}

body:has(.nav-link[data-resource="bills-to-receive"].nav-active) .metric-card {
  min-height: auto;
  padding: 14px 16px;
  border-color: #dbe4f0;
  border-radius: 14px;
  background: #fff;
  box-shadow: none;
}

body:has(.nav-link[data-resource="bills-to-receive"].nav-active) .table-panel,
.manual-table-card,
.manual-card {
  border: 1px solid #dbe4f0;
  border-radius: 14px;
  background: #fff;
  box-shadow: none;
}

body:has(.nav-link[data-resource="bills-to-receive"].nav-active) .table-header,
.manual-table-header,
.manual-card-header {
  padding: 12px 14px;
  border-bottom: 1px solid #e5edf6;
  background: #fff;
}

body:has(.nav-link[data-resource="bills-to-receive"].nav-active) .table-header h3,
.manual-table-header h4 {
  font-size: 15px;
  font-weight: 700;
}

body:has(.nav-link[data-resource="bills-to-receive"].nav-active) .table-header p,
.manual-table-header p {
  margin-top: 3px;
  font-size: 12px;
}

body:has(.nav-link[data-resource="bills-to-receive"].nav-active) .data-table,
.manual-table {
  font-size: 13px;
}

body:has(.nav-link[data-resource="bills-to-receive"].nav-active) .data-table thead,
.manual-table th {
  background: #f8fafc;
  color: #475569;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

body:has(.nav-link[data-resource="bills-to-receive"].nav-active) .data-table th,
body:has(.nav-link[data-resource="bills-to-receive"].nav-active) .data-table td,
.manual-table th,
.manual-table td,
.manual-queue-table th,
.manual-queue-table td {
  padding: 9px 11px;
  border-color: #e5edf6;
}

body:has(.nav-link[data-resource="bills-to-receive"].nav-active) .badge,
.manual-table .badge,
.manual-sidebar-card .badge {
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 700;
}

body:has(.nav-link[data-resource="bills-to-receive"].nav-active) .data-table .btn,
.manual-table .btn,
.manual-icon-btn {
  min-height: 32px;
  border-radius: 8px;
  padding: 6px 9px;
  font-size: 12px;
  font-weight: 700;
  box-shadow: none;
}

.manual-workspace {
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 14px;
}

.manual-main-column,
.manual-sidebar-column {
  gap: 14px;
}

.manual-page-head {
  margin-bottom: 12px;
}

.manual-page-head .panel-title {
  font-size: 24px;
}

.manual-card-title-block {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}

.manual-card-actions,
.manual-actions-top {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.manual-card-actions .btn,
.manual-actions-top .btn,
.manual-table-footer .btn {
  min-height: 34px;
  padding: 7px 11px;
  border-radius: 9px;
  font-size: 12px;
}

.manual-filters-body {
  padding: 14px;
}

.manual-quick-pills {
  margin: 0 0 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid #e5edf6;
}

.manual-fields-grid-3,
.manual-fields-grid-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px 14px;
  margin-bottom: 12px;
}

.manual-fields-grid-3 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.manual-fields-grid-3 .field:nth-child(3) {
  grid-column: span 2;
}

.manual-active-filters-bar {
  gap: 10px;
  font-size: 12px;
}

body:has(.nav-link[data-resource="bills-to-receive"].nav-active) .filter-chip,
.manual-filters-card .filter-chip {
  padding: 4px 9px;
  border-color: #bfdbfe;
  background: #eff6ff;
  color: #1e40af;
  font-size: 12px;
  font-weight: 600;
}

.btn-clear-all-chips {
  color: #b91c1c;
  font-size: 12px;
  font-weight: 700;
}

.manual-table-scroll {
  overflow-x: auto;
}

.manual-table-footer {
  padding: 11px 14px;
  background: #fff;
}

.manual-sidebar-card {
  padding: 14px;
}

.manual-sidebar-card h4 {
  margin-bottom: 10px;
  font-size: 14px;
  font-weight: 700;
}

.summary-item,
.saved-filter-item,
.quick-action-btn {
  border-color: #e5edf6;
  border-radius: 9px;
  box-shadow: none;
}

.summary-item {
  padding: 10px;
}

.summary-item span {
  font-size: 10px;
  font-weight: 700;
}

.summary-item strong {
  font-size: 16px;
}

.quick-action-btn {
  padding: 9px 12px;
  font-size: 12px;
  font-weight: 700;
}

.manual-history-filters {
  gap: 10px;
  padding: 12px;
}

@media (max-width: 1280px) {
  body:has(.nav-link[data-resource="bills-to-receive"].nav-active) .filters-card,
  .manual-fields-grid-3,
  .manual-fields-grid-4 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .manual-fields-grid-3 .field:nth-child(3) {
    grid-column: span 1;
  }
}

@media (max-width: 980px) {
  body:has(.nav-link[data-resource="bills-to-receive"].nav-active) .filters-card,
  .manual-fields-grid-3,
  .manual-fields-grid-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .manual-workspace {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  body:has(.nav-link[data-resource="bills-to-receive"].nav-active) .filters-card,
  .manual-fields-grid-3,
  .manual-fields-grid-4,
  .manual-history-filters {
    grid-template-columns: 1fr;
  }

  body:has(.nav-link[data-resource="bills-to-receive"].nav-active) .filters-card > button[type="submit"] {
    grid-column: span 1;
  }

  body:has(.nav-link[data-resource="bills-to-receive"].nav-active) .receivable-filter-heading,
  .manual-card-title-block,
  .manual-card-header,
  .manual-table-header,
  .manual-active-filters-bar {
    align-items: flex-start;
    flex-direction: column;
  }

  .manual-card-actions,
  .manual-card-actions .btn,
  .manual-actions-top,
  .manual-actions-top .btn,
  .manual-search-btn {
    width: 100%;
  }
}

/* Fallback sem :has para navegadores/estados que nao aplicam seletor relacional. */
.receivable-layout-active .receivable-filter-heading {
  display: flex;
  grid-column: 1 / -1;
  align-items: baseline;
  gap: 8px;
  min-height: 32px;
  padding-bottom: 10px;
  border-bottom: 1px solid #e5edf6;
}

.receivable-layout-active .receivable-filter-heading strong {
  color: #111827;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0;
}

.receivable-layout-active .receivable-filter-heading span {
  color: #64748b;
  font-size: 12px;
  font-weight: 400;
}

.receivable-layout-active #filtersForm {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px 14px;
  margin-bottom: 16px;
  padding: 14px;
  border: 1px solid #dbe4f0;
  border-radius: 14px;
  background: #fff;
  box-shadow: none;
}

.receivable-layout-active #filtersForm .filter-toolbar {
  grid-column: 1 / -1;
  margin: 0;
  padding-bottom: 10px;
  border-bottom: 1px solid #e5edf6;
}

.receivable-layout-active #filtersForm > .field {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 6px;
  margin: 0;
  color: #64748b;
  font-size: 12px;
  font-weight: 600;
}

.receivable-layout-active #filtersForm > .field input,
.receivable-layout-active #filtersForm > .field select,
.receivable-layout-active #filtersForm > .field .filter-search-input {
  width: 100%;
  min-height: 40px;
  height: 40px;
  margin-top: 0;
  border: 1px solid #d8e2f0;
  border-radius: 9px;
  background: #fff;
  color: #111827;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: none;
}

.receivable-layout-active #filtersForm > .field input:focus,
.receivable-layout-active #filtersForm > .field select:focus,
.receivable-layout-active #filtersForm > .field .filter-search-input:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.receivable-layout-active #filtersForm > button[type="submit"] {
  grid-column: span 2;
  min-height: 40px;
  border-radius: 9px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 700;
  box-shadow: none;
}

.receivable-layout-active .date-preset {
  min-height: 30px;
  padding: 5px 11px;
  border-color: #d8e2f0;
  background: #f8fafc;
  color: #64748b;
  font-size: 12px;
  font-weight: 600;
  box-shadow: none;
}

.receivable-layout-active .date-preset:hover,
.receivable-layout-active .date-preset.active {
  border-color: #93c5fd;
  background: #eff6ff;
  color: #1d4ed8;
}

.receivable-layout-active .active-filters {
  grid-column: 1 / -1;
  margin-top: 2px;
  padding-top: 10px;
  border-top: 1px dashed #dbe4f0;
}

.receivable-layout-active .filter-chip {
  padding: 4px 9px;
  border-color: #bfdbfe;
  background: #eff6ff;
  color: #1e40af;
  font-size: 12px;
  font-weight: 600;
}

.receivable-layout-active .metric-grid {
  gap: 12px;
  margin-bottom: 16px;
}

.receivable-layout-active .metric-card {
  min-height: auto;
  padding: 14px 16px;
  border-color: #dbe4f0;
  border-radius: 14px;
  background: #fff;
  box-shadow: none;
}

.receivable-layout-active .table-panel {
  border: 1px solid #dbe4f0;
  border-radius: 14px;
  background: #fff;
  box-shadow: none;
  overflow: hidden;
}

.receivable-layout-active .table-header {
  padding: 12px 14px;
  border-bottom: 1px solid #e5edf6;
  background: #fff;
}

.receivable-layout-active .table-header h3 {
  font-size: 15px;
  font-weight: 700;
}

.receivable-layout-active .table-header p {
  margin-top: 3px;
  font-size: 12px;
}

.receivable-layout-active .data-table {
  font-size: 13px;
}

.receivable-layout-active .data-table thead {
  background: #f8fafc;
  color: #475569;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.receivable-layout-active .data-table th,
.receivable-layout-active .data-table td {
  padding: 9px 11px;
  border-color: #e5edf6;
}

.receivable-layout-active .badge {
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 700;
}

.receivable-layout-active .data-table .btn {
  min-height: 32px;
  border-radius: 8px;
  padding: 6px 9px;
  font-size: 12px;
  font-weight: 700;
  box-shadow: none;
}

@media (max-width: 1280px) {
  .receivable-layout-active #filtersForm {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 980px) {
  .receivable-layout-active #filtersForm {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .receivable-layout-active #filtersForm {
    grid-template-columns: 1fr;
  }

  .receivable-layout-active #filtersForm > button[type="submit"] {
    grid-column: span 1;
    width: 100%;
  }

  .receivable-layout-active .receivable-filter-heading {
    align-items: flex-start;
    flex-direction: column;
  }
}

/* Contas a Receber: estrutura final conforme card de filtros do anexo. */
.receivable-filter-grid,
.receivable-filter-actions {
  display: contents;
}

.receivable-period-field > span {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.receivable-layout-active #filtersForm {
  display: block;
  width: 100%;
  margin-bottom: 18px;
  padding: 0;
  overflow: hidden;
  border: 1px solid #dbe4f0;
  border-radius: 14px;
  background: #fff;
  box-shadow: none;
}

.receivable-layout-active #filtersForm .receivable-filter-heading {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 54px;
  padding: 0 22px;
  border-bottom: 1px solid #e5edf6;
}

.receivable-layout-active #filtersForm .receivable-filter-heading strong {
  color: #030712;
  font-size: 16px;
  font-weight: 800;
  line-height: 1;
}

.receivable-layout-active #filtersForm .receivable-filter-heading span {
  color: #52647f;
  font-size: 14px;
  font-weight: 400;
}

.receivable-layout-active #filtersForm .receivable-filter-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px 20px;
  padding: 22px 22px 16px;
}

.receivable-layout-active #filtersForm .field {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 8px;
  margin: 0;
  color: #64748b;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.2;
}

.receivable-layout-active #filtersForm .field input,
.receivable-layout-active #filtersForm .field select,
.receivable-layout-active #filtersForm .field .filter-search-input {
  width: 100%;
  min-height: 52px;
  height: 52px;
  margin-top: 0;
  border: 1px solid #d5e2f3;
  border-radius: 10px;
  background: #fff;
  color: #111827;
  padding: 0 18px;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.2;
  box-shadow: none;
}

.receivable-layout-active #filtersForm .field input::placeholder,
.receivable-layout-active #filtersForm .field .filter-search-input::placeholder {
  color: #8a96aa;
  font-weight: 500;
}

.receivable-layout-active #filtersForm .filter-search-select {
  width: 100%;
  margin-top: 0;
}

.receivable-layout-active #filtersForm .filter-search-options {
  top: calc(100% + 4px);
  bottom: auto;
  border: 1px solid #d5e2f3;
  border-radius: 10px;
}

.receivable-layout-active #filtersForm .field input:focus,
.receivable-layout-active #filtersForm .field select:focus,
.receivable-layout-active #filtersForm .field .filter-search-input:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.receivable-layout-active #filtersForm .receivable-period-field > span {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.receivable-layout-active #filtersForm .receivable-field-due {
  grid-column: span 2;
}

.receivable-layout-active #filtersForm .receivable-date-shortcuts {
  display: none;
}

.receivable-layout-active #filtersForm .receivable-filter-actions {
  display: flex;
  justify-content: flex-end;
  gap: 14px;
  padding: 0 22px 22px;
}

.receivable-layout-active #filtersForm #clearFilters,
.receivable-layout-active #filtersForm > .receivable-filter-actions .btn {
  min-width: 136px;
  min-height: 48px;
  border-radius: 10px;
  padding: 0 18px;
  font-size: 14px;
  font-weight: 700;
  box-shadow: none;
}

.receivable-layout-active #filtersForm > .receivable-filter-actions .btn-primary {
  border-color: transparent;
  background: linear-gradient(135deg, #2563eb, #0ea5e9);
  color: #fff;
}

.receivable-layout-active #filtersForm .active-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0 22px 18px;
  border-top: 0;
}

.receivable-layout-active #filtersForm .filter-chip {
  border: 1px solid #bfdbfe;
  border-radius: 999px;
  background: #eff6ff;
  color: #1e40af;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 700;
}

@media (max-width: 1280px) {
  .receivable-layout-active #filtersForm .receivable-filter-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 980px) {
  .receivable-layout-active #filtersForm .receivable-filter-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .receivable-layout-active #filtersForm .receivable-filter-heading,
  .receivable-layout-active #filtersForm .receivable-filter-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .receivable-layout-active #filtersForm .receivable-filter-grid {
    grid-template-columns: 1fr;
    padding: 18px 16px 14px;
  }

  .receivable-layout-active #filtersForm .receivable-field-due {
    grid-column: span 1;
  }

  .receivable-layout-active #filtersForm .receivable-filter-actions,
  .receivable-layout-active #filtersForm .active-filters {
    padding-right: 16px;
    padding-left: 16px;
  }

  .receivable-layout-active #filtersForm #clearFilters,
  .receivable-layout-active #filtersForm > .receivable-filter-actions .btn {
    width: 100%;
  }
}

/* Padrao visual definitivo do modulo financeiro: Contas a Receber, Cobranca Manual e Registro de Cobrancas. */
:root {
  --finance-card-bg: #fff;
  --finance-card-border: #dbe4f0;
  --finance-card-border-soft: #e5edf6;
  --finance-card-radius: 16px;
  --finance-field-height: 36px;
  --finance-field-radius: 10px;
  --finance-field-padding-x: 12px;
  --finance-label-color: #64748b;
  --finance-placeholder-color: #94a3b8;
  --finance-title-color: #030712;
  --finance-muted-color: #52647f;
  --finance-grid-gap-x: 20px;
  --finance-grid-gap-y: 18px;
}

.receivable-layout-active .topbar,
#manualBillingSection .manual-page-head,
#collectionRecordsSection .collection-page-head {
  align-items: center;
  margin-bottom: 14px;
}

.receivable-layout-active .page-title,
#manualBillingSection .manual-page-head .panel-title,
#collectionRecordsSection .collection-page-head .panel-title {
  color: var(--finance-title-color);
  font-size: clamp(21px, 2vw, 24px);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.receivable-layout-active .page-description,
#manualBillingSection .manual-page-head .panel-copy,
#collectionRecordsSection .collection-page-head .panel-copy {
  color: var(--finance-muted-color);
  font-size: 12px;
  font-weight: 400;
  line-height: 18px;
}

.receivable-layout-active #filtersForm,
#manualBillingSection .manual-filters-card,
#collectionRecordsSection .collection-filters-card {
  display: block;
  width: 100%;
  margin-bottom: 18px;
  padding: 0;
  overflow: visible;
  border: 1px solid var(--finance-card-border);
  border-radius: var(--finance-card-radius);
  background: var(--finance-card-bg);
  box-shadow: none;
}

.receivable-layout-active #filtersForm {
  display: flex;
  flex-direction: column;
}

.receivable-layout-active #filtersForm .receivable-filter-heading,
#manualBillingSection .manual-filters-card .manual-card-header,
#collectionRecordsSection .collection-filters-card > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 58px;
  border-bottom: 1px solid var(--finance-card-border-soft);
  background: var(--finance-card-bg);
  padding: 0 22px;
}

.receivable-layout-active #filtersForm .receivable-filter-heading {
  order: 1;
  justify-content: flex-start;
  gap: 12px;
}

#manualBillingSection .manual-card-title-block,
#collectionRecordsSection .collection-filters-card > summary {
  min-width: 0;
}

#manualBillingSection .manual-card-title-block {
  display: flex;
  align-items: baseline;
  gap: 12px;
}

.receivable-layout-active #filtersForm .receivable-filter-heading strong,
#manualBillingSection .manual-filters-card .manual-card-title,
#collectionRecordsSection .collection-filters-card > summary strong {
  color: var(--finance-title-color);
  font-size: 15px;
  font-weight: 600;
  line-height: 20px;
  letter-spacing: 0;
}

.receivable-layout-active #filtersForm .receivable-filter-heading span,
#manualBillingSection .manual-card-title-block small,
#collectionRecordsSection .collection-filters-card > summary span {
  color: var(--finance-muted-color);
  font-size: 12px;
  font-weight: 400;
  line-height: 18px;
}

#collectionRecordsSection .collection-filters-card > summary::-webkit-details-marker {
  display: none;
}

.receivable-layout-active #filtersForm .receivable-filter-grid,
#manualBillingSection .manual-filters-grid-unified,
#collectionRecordsSection .collection-filters-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--finance-grid-gap-y) var(--finance-grid-gap-x);
  align-items: end;
  padding: 22px 22px 16px;
}

.receivable-layout-active #filtersForm .receivable-filter-grid {
  order: 3;
}

#manualBillingSection .manual-filters-body {
  padding: 0;
}

.receivable-layout-active #filtersForm .field,
#manualBillingSection .manual-filters-card .field,
#collectionRecordsSection .collection-filters-grid .field {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 8px;
  margin: 0;
  color: var(--finance-label-color);
  font-size: 12px;
  font-weight: 500;
  line-height: 18px;
  letter-spacing: 0;
}

.receivable-layout-active #filtersForm .field input,
.receivable-layout-active #filtersForm .field select,
.receivable-layout-active #filtersForm .field .filter-search-input,
#manualBillingSection .manual-filters-card .field input,
#manualBillingSection .manual-filters-card .field select,
#manualBillingSection .manual-filters-card .field .filter-search-input,
#collectionRecordsSection .collection-filters-grid .field input,
#collectionRecordsSection .collection-filters-grid .field select,
#collectionRecordsSection .collection-filters-grid .field .filter-search-input {
  width: 100%;
  min-height: var(--finance-field-height);
  height: var(--finance-field-height);
  margin-top: 0;
  border: 1px solid #d5e2f3;
  border-radius: var(--finance-field-radius);
  background: #fff;
  color: #111827;
  padding: 0 var(--finance-field-padding-x);
  font-size: 14px;
  font-weight: 500;
  line-height: 20px;
  box-shadow: none;
}

.receivable-layout-active #filtersForm .field input::placeholder,
.receivable-layout-active #filtersForm .field .filter-search-input::placeholder,
#manualBillingSection .manual-filters-card .field input::placeholder,
#manualBillingSection .manual-filters-card .field .filter-search-input::placeholder,
#collectionRecordsSection .collection-filters-grid .field input::placeholder,
#collectionRecordsSection .collection-filters-grid .field .filter-search-input::placeholder {
  color: var(--finance-placeholder-color);
  font-size: 14px;
  font-weight: 400;
}

.receivable-layout-active #filtersForm .filter-search-select,
#manualBillingSection .manual-filters-card .filter-search-select,
#collectionRecordsSection .collection-filters-grid .filter-search-select,
.legal-filters-card .filter-search-select {
  width: 100%;
  margin-top: 0;
}

.receivable-layout-active #filtersForm .filter-search-options,
#manualBillingSection .manual-filters-card .filter-search-options,
#collectionRecordsSection .collection-filters-grid .filter-search-options,
.legal-filters-card .filter-search-options {
  top: calc(100% + 4px);
  bottom: auto;
  border: 1px solid #d5e2f3;
  border-radius: var(--finance-field-radius);
}

.receivable-layout-active #filtersForm .field input:focus,
.receivable-layout-active #filtersForm .field select:focus,
.receivable-layout-active #filtersForm .field .filter-search-input:focus,
#manualBillingSection .manual-filters-card .field input:focus,
#manualBillingSection .manual-filters-card .field select:focus,
#manualBillingSection .manual-filters-card .field .filter-search-input:focus,
#collectionRecordsSection .collection-filters-grid .field input:focus,
#collectionRecordsSection .collection-filters-grid .field select:focus,
#collectionRecordsSection .collection-filters-grid .field .filter-search-input:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.receivable-layout-active #filtersForm .receivable-period-field > span,
#manualBillingSection .finance-period-field > span,
#collectionRecordsSection .collection-period-field > span {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.receivable-layout-active #filtersForm .receivable-field-due,
#manualBillingSection .manual-field-due,
#collectionRecordsSection .collection-period-field {
  grid-column: span 2;
}

.receivable-layout-active #filtersForm .receivable-date-shortcuts,
#manualBillingSection .manual-quick-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0 22px 16px;
  border: 0;
}

.receivable-layout-active #filtersForm .receivable-date-shortcuts {
  order: 2;
  padding: 16px 22px 0;
}

.receivable-layout-active #filtersForm .date-preset,
#manualBillingSection .manual-pill {
  min-height: 34px;
  border: 1px solid var(--finance-card-border);
  border-radius: 999px;
  background: #f8fafc;
  color: var(--finance-label-color);
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  box-shadow: none;
}

.receivable-layout-active #filtersForm .date-preset:hover,
.receivable-layout-active #filtersForm .date-preset.active,
#manualBillingSection .manual-pill:hover,
#manualBillingSection .manual-pill.active {
  border-color: #93c5fd;
  background: #eff6ff;
  color: #1d4ed8;
}

.receivable-layout-active #filtersForm .receivable-filter-actions,
#manualBillingSection .manual-filter-actions,
#collectionRecordsSection .collection-filter-actions {
  display: flex;
  grid-column: 1 / -1;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  padding: 0 22px 22px;
}

.receivable-layout-active #filtersForm .receivable-filter-actions {
  order: 4;
}

#collectionRecordsSection .collection-filter-actions {
  padding: 0;
}

.receivable-layout-active #filtersForm #clearFilters,
.receivable-layout-active #filtersForm .receivable-filter-actions .btn,
#manualBillingSection .manual-filter-actions .manual-pill-clear,
#manualBillingSection .manual-filter-actions .manual-search-btn,
#collectionRecordsSection .collection-filter-actions .btn {
  min-width: 136px;
  min-height: var(--finance-field-height);
  border-radius: var(--finance-field-radius);
  padding: 0 18px;
  font-size: 14px;
  font-weight: 600;
  line-height: 20px;
  box-shadow: none;
}

#manualBillingSection .manual-filter-actions .manual-pill-clear,
.receivable-layout-active #filtersForm #clearFilters,
#collectionRecordsSection .collection-filter-actions .btn.btn-ghost {
  border: 1px solid var(--finance-card-border);
  background: #f8fafc;
  color: var(--finance-muted-color);
}

#manualBillingSection .manual-filter-actions .manual-search-btn,
.receivable-layout-active #filtersForm .receivable-filter-actions .btn-primary,
#collectionRecordsSection .collection-filter-actions .btn-primary {
  border: 1px solid transparent;
  background: linear-gradient(135deg, #2563eb, #0ea5e9);
  color: #fff;
}

.receivable-layout-active #filtersForm .active-filters,
#manualBillingSection .manual-active-filters-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0;
  padding: 0 22px 18px;
  border: 0;
  color: var(--finance-label-color);
  font-size: 12px;
}

.receivable-layout-active #filtersForm .active-filters {
  order: 5;
}

.receivable-layout-active #filtersForm .filter-chip,
#manualBillingSection .manual-filters-card .filter-chip,
#collectionRecordsSection .collection-filters-card .filter-chip {
  border: 1px solid #bfdbfe;
  border-radius: 999px;
  background: #eff6ff;
  color: #1e40af;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 700;
}

.receivable-layout-active .metric-card,
#manualBillingSection .manual-card,
#collectionRecordsSection .collection-metrics article,
#collectionRecordsSection .collection-table-card,
#collectionRecordsSection .collection-detail-panel,
#collectionRecordsSection .collection-quick-card,
#collectionRecordsSection .collection-timeline-card {
  border: 1px solid var(--finance-card-border);
  border-radius: var(--finance-card-radius);
  background: var(--finance-card-bg);
  box-shadow: none;
}

#collectionRecordsSection .collection-metrics {
  grid-template-columns: repeat(8, minmax(148px, 1fr));
  gap: 7px;
}

#collectionRecordsSection .collection-metrics article {
  min-height: 76px;
  padding: 10px 11px;
}

#collectionRecordsSection .collection-metrics article::before {
  width: 32px;
  height: 32px;
  right: -8px;
  top: -8px;
}

#collectionRecordsSection .collection-metrics article span {
  font-size: 11px;
  line-height: 1.2;
}

#collectionRecordsSection .collection-metrics article strong {
  margin: 6px 0 4px;
  font-size: 19px;
  line-height: 1.05;
  letter-spacing: -0.045em;
}

#collectionRecordsSection #collectionMetricAmount {
  overflow: visible;
  font-size: 16px;
  letter-spacing: -0.06em;
  text-overflow: clip;
}

#collectionRecordsSection .collection-metrics article small {
  font-size: 10px;
  line-height: 1.25;
}

@media (max-width: 1280px) {
  #collectionRecordsSection .collection-metrics {
    grid-template-columns: repeat(4, minmax(140px, 1fr));
  }
}

@media (max-width: 760px) {
  #collectionRecordsSection .collection-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.receivable-layout-active .table-panel,
#manualBillingSection .manual-table-card,
#collectionRecordsSection .collection-table-card {
  overflow: hidden;
  border: 1px solid var(--finance-card-border);
  border-radius: var(--finance-card-radius);
  background: var(--finance-card-bg);
  box-shadow: none;
}

.receivable-layout-active .table-header,
#manualBillingSection .manual-table-header,
#collectionRecordsSection .collection-card-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 54px;
  border-bottom: 1px solid var(--finance-card-border-soft);
  background: #fff;
  padding: 12px 16px;
}

.receivable-layout-active .table-header h3,
#manualBillingSection .manual-table-header h4,
#collectionRecordsSection .collection-card-heading h4 {
  margin: 0;
  color: var(--finance-title-color);
  font-size: 14px;
  font-weight: 700;
  line-height: 20px;
}

.receivable-layout-active .table-header p,
#manualBillingSection .manual-table-header p,
#collectionRecordsSection .collection-card-heading p,
#collectionRecordsSection .collection-card-heading > span {
  margin: 3px 0 0;
  color: var(--finance-muted-color);
  font-size: 11px;
  font-weight: 400;
  line-height: 16px;
}

.receivable-layout-active .table-scroll,
#manualBillingSection .manual-table-scroll,
#collectionRecordsSection .collection-table-scroll {
  overflow: auto;
}

.receivable-layout-active .data-table,
#manualBillingSection .manual-table,
#collectionRecordsSection .collection-table {
  width: 100%;
  border-collapse: collapse;
  color: #111827;
  font-size: 12px;
}

#manualBillingSection .manual-table {
  min-width: 1320px;
}

#collectionRecordsSection .collection-table {
  min-width: 1460px;
  table-layout: fixed;
}

.receivable-layout-active .data-table thead,
#manualBillingSection .manual-table thead,
#collectionRecordsSection .collection-table thead {
  background: #f8fafc;
}

.receivable-layout-active .data-table th,
#manualBillingSection .manual-table th,
#collectionRecordsSection .collection-table th {
  height: 40px;
  border-bottom: 1px solid var(--finance-card-border-soft);
  background: #f8fafc;
  color: #475569;
  padding: 9px 11px;
  text-align: left;
  font-size: 10px;
  font-weight: 700;
  line-height: 14px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.receivable-layout-active .data-table td,
#manualBillingSection .manual-table td,
#collectionRecordsSection .collection-table td {
  height: 46px;
  border-bottom: 1px solid var(--finance-card-border-soft);
  padding: 9px 11px;
  color: #111827;
  font-size: 12px;
  line-height: 16px;
  vertical-align: middle;
}

.receivable-layout-active .data-table tbody tr:hover,
#manualBillingSection .manual-table tbody tr:hover,
#collectionRecordsSection .collection-table tbody tr:hover {
  background: #f8fbff;
}

.receivable-layout-active .badge,
#manualBillingSection .badge,
#collectionRecordsSection .badge,
#collectionRecordsSection .collection-status,
#collectionRecordsSection .collection-financial {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 11px;
  font-weight: 700;
  line-height: 14px;
}

.receivable-layout-active .data-table .btn,
#manualBillingSection .manual-table .btn,
#manualBillingSection .manual-icon-btn,
#collectionRecordsSection .collection-row-actions button {
  min-width: 32px;
  min-height: 32px;
  height: 32px;
  border-radius: 8px;
  padding: 0 9px;
  font-size: 11px;
  font-weight: 700;
  box-shadow: none;
}

#manualBillingSection .manual-table-footer,
#collectionRecordsSection .collection-table-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 50px;
  border-top: 1px solid var(--finance-card-border-soft);
  background: #fff;
  color: var(--finance-muted-color);
  padding: 10px 16px;
  font-size: 12px;
}

#manualBillingSection .manual-table-footer .btn,
#collectionRecordsSection .collection-table-footer .btn,
#collectionRecordsSection .collection-table-footer select {
  min-height: 36px;
  border-radius: 9px;
  padding: 7px 12px;
  font-size: 12px;
  font-weight: 600;
}

#manualBillingSection .manual-workspace,
#collectionRecordsSection .collection-workspace {
  gap: 16px;
}

#manualBillingSection .manual-main-column,
#manualBillingSection .manual-sidebar-column {
  gap: 16px;
}

#manualBillingSection .manual-sidebar-card {
  padding: 16px;
}

#manualBillingSection .manual-sidebar-card h4,
#collectionRecordsSection .collection-detail-content h5,
#collectionRecordsSection .collection-quick-card h5,
#collectionRecordsSection .collection-timeline-card h5 {
  color: var(--finance-title-color);
  font-size: 14px;
  font-weight: 700;
  line-height: 20px;
}

#manualBillingSection .summary-item,
#manualBillingSection .saved-filter-item,
#manualBillingSection .quick-action-btn {
  border: 1px solid var(--finance-card-border-soft);
  border-radius: 10px;
  background: #f8fafc;
  box-shadow: none;
}

#manualBillingSection .quick-action-btn {
  min-height: 42px;
  padding: 9px 12px;
  font-size: 12px;
  font-weight: 700;
}

@media (max-width: 1280px) {
  .receivable-layout-active #filtersForm .receivable-filter-grid,
  #manualBillingSection .manual-filters-grid-unified,
  #collectionRecordsSection .collection-filters-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 980px) {
  .receivable-layout-active #filtersForm .receivable-filter-grid,
  #manualBillingSection .manual-filters-grid-unified,
  #collectionRecordsSection .collection-filters-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #manualBillingSection .manual-workspace,
  #collectionRecordsSection .collection-workspace {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .receivable-layout-active #filtersForm .receivable-filter-grid,
  #manualBillingSection .manual-filters-grid-unified,
  #collectionRecordsSection .collection-filters-grid,
  .receivable-layout-active #filtersForm .receivable-period-field > span,
  #manualBillingSection .finance-period-field > span,
  #collectionRecordsSection .collection-period-field > span {
    grid-template-columns: 1fr;
  }

  .receivable-layout-active #filtersForm .receivable-field-due,
  #manualBillingSection .manual-field-due,
  #collectionRecordsSection .collection-period-field {
    grid-column: span 1;
  }

  .receivable-layout-active #filtersForm .receivable-filter-heading,
  #manualBillingSection .manual-filters-card .manual-card-header,
  #collectionRecordsSection .collection-filters-card > summary,
  .receivable-layout-active #filtersForm .receivable-filter-actions,
  #manualBillingSection .manual-filter-actions,
  #collectionRecordsSection .collection-filter-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .receivable-layout-active #filtersForm .receivable-filter-grid,
  #manualBillingSection .manual-filters-grid-unified,
  #collectionRecordsSection .collection-filters-grid {
    padding: 18px 16px 14px;
  }

  .receivable-layout-active #filtersForm .receivable-filter-actions,
  #manualBillingSection .manual-filter-actions,
  .receivable-layout-active #filtersForm .receivable-date-shortcuts,
  #manualBillingSection .manual-quick-pills,
  .receivable-layout-active #filtersForm .active-filters,
  #manualBillingSection .manual-active-filters-bar {
    padding-right: 16px;
    padding-left: 16px;
  }

  .receivable-layout-active #filtersForm .receivable-filter-actions .btn,
  #manualBillingSection .manual-filter-actions .manual-pill-clear,
  #manualBillingSection .manual-filter-actions .manual-search-btn,
  #collectionRecordsSection .collection-filter-actions .btn {
    width: 100%;
  }
}

/* Correcao final da composicao do filtro de Contas a Receber. */
.receivable-layout-active #filtersForm {
  display: grid !important;
  grid-template-areas:
    "heading"
    "shortcuts"
    "fields"
    "actions"
    "chips";
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
  overflow: hidden;
}

.receivable-layout-active #filtersForm .receivable-filter-heading {
  grid-area: heading;
  order: initial;
  display: flex !important;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  min-height: 54px;
  padding: 0 22px;
  border-bottom: 1px solid var(--finance-card-border-soft);
}

.receivable-layout-active #filtersForm .receivable-date-shortcuts {
  grid-area: shortcuts;
  order: initial;
  display: flex !important;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  margin: 0;
  padding: 14px 22px 0;
  border: 0;
}

.receivable-layout-active #filtersForm .receivable-filter-grid {
  grid-area: fields;
  order: initial;
  display: grid !important;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px 20px;
  align-items: end;
  padding: 16px 22px 16px;
}

.receivable-layout-active #filtersForm .receivable-filter-actions {
  grid-area: actions;
  order: initial;
  display: flex !important;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  padding: 0 22px 18px;
}

.receivable-layout-active #filtersForm .active-filters {
  grid-area: chips;
  order: initial;
  display: flex !important;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0 22px 18px;
  border: 0;
}

@media (max-width: 1280px) {
  .receivable-layout-active #filtersForm .receivable-filter-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 980px) {
  .receivable-layout-active #filtersForm .receivable-filter-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .receivable-layout-active #filtersForm .receivable-filter-heading,
  .receivable-layout-active #filtersForm .receivable-filter-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .receivable-layout-active #filtersForm .receivable-filter-grid,
  .receivable-layout-active #filtersForm .receivable-period-field > span {
    grid-template-columns: 1fr;
  }

  .receivable-layout-active #filtersForm .receivable-field-due {
    grid-column: span 1;
  }

  .receivable-layout-active #filtersForm .receivable-filter-heading,
  .receivable-layout-active #filtersForm .receivable-date-shortcuts,
  .receivable-layout-active #filtersForm .receivable-filter-grid,
  .receivable-layout-active #filtersForm .receivable-filter-actions,
  .receivable-layout-active #filtersForm .active-filters {
    padding-right: 16px;
    padding-left: 16px;
  }
}

/* Padrao compacto financeiro global. */
:root {
  --ui-bg: #f7f9fc;
  --ui-surface: #ffffff;
  --ui-border: #d6deea;
  --ui-border-soft: #e4e9f1;
  --ui-title-color: #071b3a;
  --ui-muted-color: #526176;
  --ui-primary: #075bd8;
  --ui-font-body: 13px;
  --ui-font-label: 12px;
  --ui-font-table: 12px;
  --ui-font-table-head: 11px;
  --ui-title-size: 28px;
  --ui-section-title: 18px;
  --ui-card-title: 15px;
  --ui-input-height: 40px;
  --ui-button-height: 40px;
  --ui-card-padding: 16px;
  --ui-radius: 8px;
  --ui-card-shadow: 0 10px 28px rgba(15, 23, 42, 0.045);
}

body {
  background: var(--ui-bg);
  color: var(--ui-title-color);
  font-size: var(--ui-font-body);
}

.main-panel {
  background: var(--ui-bg);
}

.page-title,
.panel-title {
  color: var(--ui-title-color);
  font-size: var(--ui-title-size);
  font-weight: 850;
  letter-spacing: -0.04em;
  line-height: 1.08;
}

.panel-copy,
.page-description,
.page-kicker,
.hint,
.table-header p,
.manual-table-header p,
.collection-card-heading p,
.legal-card-heading p {
  color: var(--ui-muted-color);
  font-size: var(--ui-font-body);
  line-height: 1.35;
}

.panel,
.filters-card,
.metric-card,
.table-panel,
.settings-card,
.report-card,
.billing-engine-card,
.billing-action-card,
.manual-card,
.collection-filters-card,
.collection-table-card,
.collection-detail-panel,
.legal-filters-card,
.legal-table-card,
.legal-drawer-block {
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius);
  background: var(--ui-surface);
  box-shadow: var(--ui-card-shadow);
}

.settings-card,
.manual-card,
.collection-detail-panel,
.legal-drawer-block,
.billing-engine-card,
.billing-action-card {
  padding: var(--ui-card-padding);
}

.panel-header,
.table-header,
.manual-card-header,
.manual-table-header,
.collection-card-heading,
.legal-filter-heading,
.legal-card-heading,
.report-card-heading,
.wa-card-heading,
.wa-inner-heading {
  min-height: 52px;
  padding: 12px 16px;
}

.panel-header h3,
.table-header h3,
.manual-table-header h4,
.manual-sidebar-card h4,
.collection-card-heading h4,
.collection-detail-content h5,
.legal-card-heading h4,
.legal-drawer-block h4,
.report-card-heading h4,
.settings-card h4,
.wa-card-heading h3,
.wa-inner-heading h4 {
  color: var(--ui-title-color);
  font-size: var(--ui-card-title);
  font-weight: 800;
  line-height: 1.2;
}

.field,
.report-field,
.manual-filters-card .field,
.collection-filters-grid .field,
.legal-filters-grid .field,
.filters-card .field {
  color: var(--ui-title-color);
  font-size: var(--ui-font-label);
  font-weight: 700;
  line-height: 1.25;
}

.field input,
.field select,
.field textarea,
.input,
.filters-card input,
.filters-card select,
.report-field input,
.report-field select,
.report-select-trigger,
.manual-filters-card .field input,
.manual-filters-card .field select,
.manual-filters-card .field .filter-search-input,
.collection-filters-grid input,
.collection-filters-grid select,
.legal-filters-grid input,
.legal-filters-grid select {
  min-height: var(--ui-input-height);
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius);
  background: #fff;
  color: #243247;
  font-size: var(--ui-font-body);
}

.btn,
button.btn,
.manual-search-btn,
.manual-pill-clear,
.quick-action-btn,
.payment-slip-button,
.report-pdf-btn,
.wa-outline-primary,
.wa-outline-danger {
  min-height: var(--ui-button-height);
  border-radius: var(--ui-radius);
  font-size: var(--ui-font-body);
  font-weight: 700;
}

.btn-primary,
.manual-search-btn,
.report-pdf-btn {
  background: var(--ui-primary);
}

.metric-grid,
.billing-metrics,
.collection-metrics,
.legal-metrics {
  gap: 12px;
}

.metric-card,
.billing-metrics article,
.collection-metrics article {
  min-height: 96px;
  padding: 14px 16px;
}

.metric-card strong,
.billing-metrics strong,
.collection-metrics strong {
  font-size: 24px;
  line-height: 1.05;
}

.metric-card p,
.billing-metrics p,
.collection-metrics span {
  font-size: 11px;
  font-weight: 800;
}

.metric-card span,
.billing-metrics span,
.collection-metrics small {
  font-size: 10px;
  line-height: 1.25;
}

.data-table,
.manual-table,
.collection-table,
.legal-table,
.report-table {
  color: var(--ui-title-color);
  font-size: var(--ui-font-table);
}

.data-table th,
.manual-table th,
.collection-table th,
.legal-table th,
.report-table th {
  background: #f8fafc;
  color: var(--ui-title-color);
  font-size: var(--ui-font-table-head);
  font-weight: 800;
  line-height: 1.25;
}

.data-table th,
.data-table td,
.manual-table th,
.manual-table td,
.collection-table th,
.collection-table td,
.legal-table th,
.legal-table td,
.report-table th,
.report-table td {
  border-bottom: 1px solid var(--ui-border-soft);
  padding: 10px 12px;
  vertical-align: middle;
}

.data-table tbody tr:hover,
.manual-table tbody tr:hover,
.collection-table tbody tr:hover,
.legal-table tbody tr:hover {
  background: #f8fbff;
}

.badge {
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 800;
}

.manual-filters-grid-unified,
.collection-filters-grid,
.legal-filters-grid,
.receivable-layout-active #filtersForm .receivable-filter-grid,
.form-grid.three,
.form-grid.four {
  gap: 14px 16px;
}

.manual-filter-actions,
.collection-filter-actions,
.legal-filter-actions,
.receivable-layout-active #filtersForm .receivable-filter-actions {
  justify-content: flex-end;
  gap: 10px;
}

@media (max-width: 1280px) {
  .manual-filters-grid-unified,
  .collection-filters-grid,
  .legal-filters-grid,
  .receivable-layout-active #filtersForm .receivable-filter-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .manual-filters-grid-unified,
  .collection-filters-grid,
  .legal-filters-grid,
  .receivable-layout-active #filtersForm .receivable-filter-grid,
  .form-grid.three,
  .form-grid.four {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  :root {
    --ui-title-size: 24px;
    --ui-input-height: 38px;
    --ui-button-height: 38px;
    --ui-card-padding: 14px;
  }

  .manual-filters-grid-unified,
  .collection-filters-grid,
  .legal-filters-grid,
  .receivable-layout-active #filtersForm .receivable-filter-grid,
  .form-grid.three,
  .form-grid.four {
    grid-template-columns: 1fr;
  }

  .manual-filter-actions,
  .collection-filter-actions,
  .legal-filter-actions,
  .receivable-layout-active #filtersForm .receivable-filter-actions {
    align-items: stretch;
    flex-direction: column;
  }
}

body.screen-payable .table-panel:not(.hidden) {
  max-width: 100% !important;
  overflow: hidden !important;
  border-radius: 18px !important;
}

body.screen-payable .table-panel .tw-toolbar {
  margin: 0 !important;
  border-right: 0 !important;
  border-left: 0 !important;
  border-radius: 0 !important;
}

body.screen-payable .table-panel .table-scroll {
  display: block !important;
  width: 100% !important;
  max-width: 100% !important;
  height: 420px !important;
  max-height: calc(100vh - 330px) !important;
  min-height: 260px !important;
  overflow: auto !important;
  scrollbar-width: auto !important;
  scrollbar-color: #64748b #dbe4ef !important;
  scrollbar-gutter: stable both-edges !important;
}

body.screen-payable .table-panel .data-table {
  width: 1460px !important;
  min-width: 1460px !important;
  table-layout: fixed !important;
}

body.screen-payable .table-panel .data-table th,
body.screen-payable .table-panel .data-table td {
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

body.screen-payable .table-panel .table-scroll::-webkit-scrollbar {
  width: 14px !important;
  height: 14px !important;
}

body.screen-payable .table-panel .table-scroll::-webkit-scrollbar-track {
  background: #dbe4ef !important;
}

body.screen-payable .table-panel .table-scroll::-webkit-scrollbar-thumb {
  border: 3px solid #dbe4ef !important;
  border-radius: 999px !important;
  background: #64748b !important;
}

.management-section {
  display: block;
  padding: 16px;
  background: #f8fafc;
  min-height: 100vh;
}
.management-section.hidden {
  display: none;
}
.management-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.management-title {
  font-size: 22px;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.03em;
}
.management-subtitle {
  font-size: 12px;
  color: #64748b;
  margin-top: 2px;
}
.management-header-actions {
  display: flex;
  gap: 8px;
}
.management-filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  gap: 8px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 10px;
  margin-bottom: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.02);
  align-items: flex-end;
}
.management-filters label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
  color: #475569;
}
.management-filters select,
.management-filters input {
  height: 32px;
  border: 1px solid #cbd5e1;
  border-radius: 7px;
  padding: 0 8px;
  font-size: 12px;
  background: #fff;
  color: #0f172a;
}
.management-active-filters {
  font-size: 11px;
  color: #64748b;
  margin-bottom: 10px;
}
.management-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}
@media (max-width: 900px) {
  .management-card-grid {
    grid-template-columns: repeat(1, minmax(0, 1fr));
  }
}
.management-kpi-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 11px;
  padding: 12px;
  text-align: left;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 3px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.03);
  transition: all 0.15s ease;
}
.management-kpi-card:hover {
  border-color: #94a3b8;
  box-shadow: 0 4px 12px rgba(0,0,0,0.06);
  transform: translateY(-1px);
}
.management-kpi-card span {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #64748b;
}
.management-kpi-card strong {
  font-size: 18px;
  font-weight: 900;
  color: #0f172a;
  letter-spacing: -0.03em;
}
.management-kpi-card small {
  font-size: 10px;
  color: #64748b;
  line-height: 1.3;
}
.management-kpi-card.danger strong {
  color: #dc2626;
}
.management-kpi-card.cash strong {
  color: #2563eb;
}
.management-layout {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
@media (max-width: 1020px) {
  .management-layout {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 720px) {
  .management-layout {
    grid-template-columns: 1fr;
  }
}
.management-panel {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 11px;
  padding: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.03);
}
.management-panel-wide {
  grid-column: span 2;
}
@media (max-width: 1020px) {
  .management-panel-wide {
    grid-column: span 1;
  }
}
.management-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.management-panel-head h4 {
  font-size: 13px;
  font-weight: 800;
  color: #0f172a;
}
.management-panel-head p {
  font-size: 10px;
  color: #64748b;
}
.management-chart {
  height: 132px;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 6px 0 14px 0;
  border-bottom: 1px solid #f1f5f9;
}
.management-bar-group {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  height: 100%;
  justify-content: flex-end;
}
.management-bars {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  width: 100%;
  height: 100%;
  justify-content: center;
}
.management-bar {
  flex: 1;
  max-width: 10px;
  border-radius: 3px 3px 0 0;
  border: 0;
  cursor: pointer;
  transition: opacity 0.15s;
}
.management-bar:hover {
  opacity: 0.85;
}
.management-bar.metric-0 {
  background: #16a34a;
}
.management-bar.metric-1 {
  background: #dc2626;
}
.management-bar-group span {
  font-size: 9px;
  color: #64748b;
  white-space: nowrap;
}
.management-line-chart {
  height: 132px;
  position: relative;
}
.management-line-chart svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}
.management-line-chart polyline {
  fill: none;
  stroke: #dc2626;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.management-line-point {
  cursor: pointer;
}
.management-line-point circle {
  fill: #fff;
  stroke: #dc2626;
  stroke-width: 2.5;
  transition: r 0.15s;
}
.management-line-point:hover circle {
  r: 6;
}
.management-line-point text {
  font-size: 9px;
  font-weight: 700;
  fill: #334155;
}
.management-cash-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}
@media (max-width: 1000px) {
  .management-cash-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
.management-cash-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 8px;
  text-align: left;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.management-cash-card:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
}
.management-cash-card span {
  font-size: 10px;
  font-weight: 700;
  color: #64748b;
}
.management-cash-card strong {
  font-size: 13px;
  font-weight: 800;
  color: #0f172a;
}
.management-cash-card small {
  font-size: 9px;
  color: #64748b;
}
.management-donut {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 160px;
  overflow-y: auto;
}
.management-donut button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 7px;
  padding: 6px 8px;
  cursor: pointer;
  text-align: left;
  width: 100%;
}
.management-donut button:hover {
  background: #f1f5f9;
}
.management-donut span {
  font-size: 11px;
  font-weight: 700;
  color: #334155;
}
.management-donut strong {
  font-size: 11px;
  font-weight: 800;
  color: #0f172a;
}
.management-donut small {
  font-size: 10px;
  color: #64748b;
}
.management-table-wrap {
  overflow-x: auto;
}
.management-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}
.management-table th {
  background: #f1f5f9;
  color: #475569;
  font-weight: 800;
  text-align: left;
  padding: 7px 8px;
  border-bottom: 2px solid #e2e8f0;
}
.management-table td {
  padding: 7px 8px;
  border-bottom: 1px solid #f1f5f9;
  color: #0f172a;
}
.management-table tr:hover td {
  background: #f8fafc;
}
.management-funnel {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.management-funnel button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #fff;
  border: 0;
  border-radius: 7px;
  padding: 7px 10px;
  cursor: pointer;
  margin: 0 auto;
  font-size: 11px;
  transition: opacity 0.15s;
}
.management-funnel button:hover {
  opacity: 0.9;
}
.management-alerts {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 160px;
  overflow-y: auto;
}
.management-alert {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 7px 8px;
  font-size: 11px;
  color: #334155;
}
.management-alert i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-top: 4px;
  flex-shrink: 0;
}
.management-alert-danger i {
  background: #dc2626;
}
.management-alert-warning i {
  background: #f59e0b;
}
.management-alert-success i {
  background: #16a34a;
}
.management-alert-info i {
  background: #2563eb;
}
.management-ranking {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.management-ranking button {
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 7px;
  padding: 7px 8px;
  text-align: left;
  cursor: pointer;
}
.management-ranking button:hover {
  background: #f1f5f9;
}
.management-ranking span {
  font-size: 11px;
  font-weight: 800;
  color: #0f172a;
}
.management-ranking strong {
  font-size: 12px;
  font-weight: 900;
  color: #dc2626;
}
.management-ranking small {
  font-size: 10px;
  color: #64748b;
}
.management-summary-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.management-summary-list div {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 7px;
  padding: 7px 9px;
  font-size: 11px;
}
.management-summary-list span {
  color: #64748b;
  font-weight: 700;
}
.management-summary-list strong {
  color: #0f172a;
  font-weight: 900;
}
.management-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.management-modal-backdrop.hidden {
  display: none;
}
.management-modal {
  background: #fff;
  border-radius: 16px;
  width: 100%;
  max-width: 1180px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 25px -5px rgba(0,0,0,0.1);
  overflow: hidden;
}
.management-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid #e2e8f0;
}
.management-modal-head h3 {
  font-size: 18px;
  font-weight: 900;
  color: #0f172a;
}
.management-modal-head p {
  font-size: 12px;
  color: #64748b;
}
.management-modal-tools {
  display: flex;
  gap: 12px;
  padding: 14px 24px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
}
.management-modal-tools input {
  flex: 1;
  height: 38px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 0 12px;
  font-size: 13px;
}
.management-detail-table-wrap {
  flex: 1;
  overflow: auto;
  max-height: 60vh;
}
.management-modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  border-top: 1px solid #e2e8f0;
  background: #f8fafc;
  font-size: 13px;
  color: #64748b;
}
.management-modal-footer > div {
  display: flex;
  align-items: center;
  gap: 12px;
}
.management-empty {
  padding: 20px;
  text-align: center;
  color: #64748b;
  font-size: 13px;
}

.incorporation-section { min-height: 100vh; padding: 12px; background: linear-gradient(135deg, #f7fbff 0%, #edf6ff 100%); color: #061a44; }
.incorporation-section.hidden { display: none; }
.incorporation-page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.incorporation-page-head h3 { margin: 0; font-size: 22px; font-weight: 900; letter-spacing: -0.04em; color: #061a44; }
.incorporation-page-head p { margin: 2px 0 0; color: #476184; font-size: 12px; }
.incorporation-refresh, .incorporation-primary, .incorporation-outline, .incorporation-link { border-radius: 8px; font-weight: 800; cursor: pointer; }
.incorporation-refresh, .incorporation-primary { border: 0; background: linear-gradient(135deg, #1a73e8, #075fd6); color: #fff; padding: 8px 14px; box-shadow: 0 8px 18px rgba(26, 115, 232, 0.18); }
.incorporation-outline { border: 1px solid #9ac4ff; color: #075fd6; background: #f8fbff; padding: 9px 14px; }
.incorporation-outline.danger { color: #dc2626; border-color: #fecaca; }
.incorporation-link { border: 0; background: transparent; color: #075fd6; padding: 0; }
.incorporation-filters, .inventory-top-filters { display: grid; align-items: end; gap: 6px; background: #fff; border: 1px solid #dbeafe; border-radius: 10px; padding: 8px; box-shadow: 0 8px 20px rgba(15, 23, 42, 0.05); margin-bottom: 8px; overflow-x: auto; }
.incorporation-filters { grid-template-columns: 52px minmax(118px, .8fr) minmax(190px, 1.2fr) minmax(165px, 1fr) minmax(118px, .8fr) minmax(126px, .8fr) minmax(126px, .8fr) minmax(170px, 1fr) auto; }
.incorporation-filters.compact { grid-template-columns: 52px minmax(105px, .7fr) minmax(128px, .9fr) minmax(88px, .6fr) minmax(118px, .8fr) minmax(118px, .8fr) minmax(120px, .8fr) minmax(120px, .8fr) auto auto; }
.inventory-top-filters { grid-template-columns: repeat(4, minmax(150px, 1fr)); margin: 0; box-shadow: none; }
.incorporation-filters strong { align-self: center; font-size: 13px; color: #061a44; }
.incorporation-filters label, .inventory-top-filters label { display: flex; flex-direction: column; gap: 3px; min-width: 0; color: #355071; font-size: 11px; font-weight: 800; white-space: nowrap; }
.incorporation-filters select, .incorporation-filters input, .inventory-top-filters select { height: 30px; min-width: 0; border: 1px solid #c8d9ef; border-radius: 7px; padding: 0 8px; color: #061a44; background: #fff; font-size: 12px; }
.incorporation-filters .incorporation-primary, .incorporation-filters .incorporation-outline { height: 30px; min-width: max-content; padding: 0 12px; font-size: 12px; }
.incorporation-message { margin-bottom: 8px; padding: 8px 10px; border-radius: 9px; border: 1px solid #bfdbfe; background: #eff6ff; color: #1d4ed8; font-size: 12px; }
.incorporation-message.hidden { display: none; }
.incorporation-message.error { border-color: #fecaca; background: #fef2f2; color: #b91c1c; }
.incorporation-message.warning { border-color: #fde68a; background: #fffbeb; color: #92400e; }
.incorporation-kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; margin-bottom: 8px; }
.incorporation-kpis button { min-height: 70px; display: grid; grid-template-columns: 36px 1fr; align-items: center; gap: 1px 9px; text-align: left; background: #fff; border: 1px solid #dbeafe; border-radius: 10px; padding: 9px; color: #061a44; cursor: pointer; box-shadow: 0 8px 20px rgba(15, 23, 42, 0.05); }
.incorporation-kpis i { grid-row: span 3; width: 30px; height: 30px; display: grid; place-items: center; border-radius: 8px; font-style: normal; font-weight: 900; }
.incorporation-kpis i.blue { background: #dbeafe; color: #1d4ed8; }
.incorporation-kpis i.green { background: #dcfce7; color: #16a34a; }
.incorporation-kpis i.amber { background: #fef3c7; color: #f59e0b; }
.incorporation-kpis i.cyan { background: #ccfbf1; color: #0f766e; }
.incorporation-kpis i.red { background: #fee2e2; color: #dc2626; }
.incorporation-kpis span { color: #355071; font-size: 12px; }
.incorporation-kpis strong { font-size: 18px; font-weight: 900; color: #061a44; letter-spacing: -0.03em; }
.incorporation-kpis small { color: #476184; font-size: 11px; }
.incorporation-cockpit-grid { display: grid; grid-template-columns: 1.2fr 0.9fr 0.9fr; gap: 8px; }
.incorporation-card, .inventory-hero, .inventory-towers, .inventory-map-card, .inventory-drawer, .inventory-summary { background: #fff; border: 1px solid #dbeafe; border-radius: 10px; padding: 10px; box-shadow: 0 8px 20px rgba(15, 23, 42, 0.05); }
.incorporation-card.wide { grid-column: span 2; }
.incorporation-card.full { grid-column: 1 / -1; }
.incorporation-card h4, .inventory-towers h4, .inventory-map-head h4, .inventory-summary h4 { margin: 0 0 8px; font-size: 14px; font-weight: 900; color: #061a44; }
.incorporation-card-head, .inventory-map-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.inc-line-chart { height: 125px; display: flex; align-items: end; gap: 9px; border-bottom: 1px solid #e8f1ff; }
.inc-line-chart div { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 5px; height: 100%; justify-content: end; }
.inc-line-chart i { width: 70%; max-width: 22px; border-radius: 8px 8px 0 0; background: linear-gradient(180deg, #1a73e8, #54d38a); }
.inc-line-chart span, .inc-line-chart strong { font-size: 10px; color: #476184; }
.inc-donut-row { display: grid; grid-template-columns: 120px 1fr; align-items: center; gap: 10px; }
.inc-donut { width: 112px; height: 112px; border-radius: 50%; display: grid; place-items: center; position: relative; }
.inc-donut::after { content: ""; position: absolute; inset: 26px; border-radius: 50%; background: #fff; }
.inc-donut strong, .inc-donut span { position: relative; z-index: 1; display: block; text-align: center; }
.inc-donut strong { align-self: end; font-size: 18px; }
.inc-donut span { align-self: start; font-size: 11px; color: #476184; }
.inc-legend { display: flex; flex-direction: column; gap: 5px; }
.inc-legend span { display: flex; align-items: center; justify-content: space-between; gap: 6px; color: #355071; font-size: 12px; }
.inc-legend i { width: 11px; height: 11px; border-radius: 50%; flex: 0 0 11px; }
.inc-work-progress .empty-state, .inc-alerts .empty-state { color: #64748b; font-size: 13px; }
.inc-table-wrap { overflow: auto; }
.incorporation-card.full .inc-table-wrap { max-height: 300px; }
.inc-table-wrap table { width: 100%; border-collapse: collapse; font-size: 12px; }
.inc-table-wrap th { background: #f3f8ff; color: #355071; padding: 7px 8px; text-align: left; border-bottom: 1px solid #dbeafe; white-space: nowrap; }
.inc-table-wrap td { padding: 7px 8px; border-bottom: 1px solid #edf5ff; color: #061a44; white-space: nowrap; }
.inc-dev-cell { display: flex; align-items: center; gap: 8px; }
.inc-dev-cell img, .inc-dev-cell span { width: 36px; height: 28px; border-radius: 5px; object-fit: cover; background: #dbeafe; flex: 0 0 auto; }
.inc-status-pill, .unit-detail-title span { display: inline-flex; align-items: center; border-radius: 999px; padding: 4px 9px; background: #dcfce7; color: #166534; font-weight: 800; font-size: 11px; }
.inc-alert { display: flex; gap: 8px; align-items: flex-start; padding: 8px; border-radius: 8px; background: #f8fbff; color: #355071; font-size: 13px; }
.inc-alert i { width: 10px; height: 10px; margin-top: 4px; border-radius: 50%; background: #1a73e8; }
.image-card .inc-image-placeholder, .inventory-photo { min-height: 150px; display: grid; place-items: center; overflow: hidden; border-radius: 9px; background: linear-gradient(135deg, #dbeafe, #eff6ff); color: #476184; font-weight: 800; text-align: center; cursor: pointer; }
.image-card img, .inventory-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.inventory-head { align-items: center; }
.inventory-hero { display: grid; grid-template-columns: 380px 1fr; gap: 24px; align-items: center; margin-bottom: 12px; }
.inventory-photo { height: 210px; min-height: 210px; }
.inventory-hero-info h3 { margin: 0 0 4px; font-size: 26px; font-weight: 900; }
.inventory-hero-info > span { display: block; color: #355071; margin-bottom: 8px; }
.inventory-hero-info p { color: #476184; margin: 0 0 18px; }
.inventory-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(135px, 1fr)); gap: 12px; }
.inventory-stats span, .inventory-stats button { display: grid; grid-template-columns: 36px 1fr; align-items: center; gap: 0 10px; padding: 12px; border: 0; border-radius: 9px; background: #f4f9ff; text-align: left; cursor: pointer; }
.inventory-stats i { grid-row: span 2; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 8px; font-style: normal; background: #dbeafe; color: #1d4ed8; }
.inventory-stats i.sold { background: #dcfce7; color: #16a34a; }
.inventory-stats i.available { background: #dbeafe; color: #1d4ed8; }
.inventory-stats i.reserved { background: #fef3c7; color: #f59e0b; }
.inventory-stats i.negotiation { background: #dbeafe; color: #2563eb; }
.inventory-stats i.blocked { background: #e2e8f0; color: #64748b; }
.inventory-stats i.cancelled { background: #fee2e2; color: #dc2626; }
.inventory-stats strong { font-size: 20px; font-weight: 900; }
.inventory-stats small { color: #476184; }
.inventory-layout { display: grid; grid-template-columns: 190px minmax(0, 1fr) 390px; gap: 12px; align-items: stretch; }
.inventory-towers #incTowerList { display: flex; flex-direction: column; gap: 8px; }
.inventory-towers button { text-align: left; border: 0; border-radius: 8px; background: #f4f9ff; padding: 12px; color: #061a44; cursor: pointer; }
.inventory-towers button.active { background: #dbeafe; box-shadow: inset 3px 0 #1a73e8; }
.inventory-towers strong { display: block; font-size: 15px; }
.inventory-towers span { color: #355071; }
.inventory-legend { display: flex; flex-wrap: wrap; gap: 10px; color: #355071; font-size: 12px; }
.inventory-legend span::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 5px; }
.inventory-legend .available::before { background: #22c55e; }
.inventory-legend .sold::before { background: #ef4444; }
.inventory-legend .reserved::before { background: #fbbf24; }
.inventory-legend .negotiation::before { background: #1a73e8; }
.inventory-legend .blocked::before { background: #94a3b8; }
.inventory-legend .cancelled::before { background: #f97316; }
.inventory-unit-grid { overflow-x: auto; padding-top: 6px; }
.inventory-floor-row { display: grid; grid-template-columns: 46px 1fr; align-items: center; gap: 8px; margin-bottom: 6px; }
.inventory-floor-row > strong { text-align: right; color: #061a44; }
.inventory-floor-row > div { display: grid; grid-template-columns: repeat(auto-fill, minmax(66px, 1fr)); gap: 5px; }
.inventory-floor-row button { min-height: 32px; border: 1px solid rgba(15,23,42,.08); border-radius: 5px; font-weight: 800; color: #061a44; cursor: pointer; }
.inventory-floor-row button small { display: none; }
.inventory-floor-row button.available { background: linear-gradient(135deg, #74e3a2, #31c875); }
.inventory-floor-row button.sold { background: linear-gradient(135deg, #ff8585, #f05252); }
.inventory-floor-row button.reserved { background: linear-gradient(135deg, #fde68a, #fbbf24); }
.inventory-floor-row button.negotiation { background: linear-gradient(135deg, #93c5fd, #3b82f6); color: #fff; }
.inventory-floor-row button.blocked { background: linear-gradient(135deg, #cbd5e1, #94a3b8); }
.inventory-floor-row button.cancelled { background: linear-gradient(135deg, #fdba74, #f97316); }
.inventory-floor-row button.selected { outline: 3px solid #075fd6; outline-offset: 1px; }
.inventory-drawer { position: relative; }
.inventory-drawer.hidden { display: none; }
.inventory-drawer > button { position: absolute; right: 12px; top: 10px; border: 0; background: transparent; font-size: 24px; color: #061a44; cursor: pointer; }
.unit-detail-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 14px; padding-right: 26px; }
.unit-detail-title h4 { margin: 0; font-size: 18px; font-weight: 900; }
.unit-detail-title span.sold { background: #dcfce7; color: #166534; }
.unit-detail-title span.available { background: #dbeafe; color: #1d4ed8; }
.unit-detail-title span.reserved { background: #fef3c7; color: #92400e; }
.unit-detail-title span.negotiation { background: #dbeafe; color: #1d4ed8; }
.unit-detail-title span.blocked { background: #e2e8f0; color: #475569; }
.unit-detail-title span.cancelled { background: #ffedd5; color: #c2410c; }
.inventory-drawer dl { display: grid; grid-template-columns: 120px 1fr; gap: 8px 14px; margin: 0 0 18px; font-size: 13px; }
.inventory-drawer dt { color: #476184; }
.inventory-drawer dd { margin: 0; color: #061a44; font-weight: 700; }
.unit-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 18px; }
.unit-actions button { border: 1px solid #9ac4ff; background: #f8fbff; color: #075fd6; border-radius: 7px; padding: 9px; font-weight: 800; cursor: pointer; }
.unit-actions button:disabled { opacity: .5; cursor: not-allowed; color: #64748b; border-color: #dbeafe; }
.inventory-summary { margin-top: 12px; }
.inc-image-modal { position: fixed; inset: 0; z-index: 1100; display: grid; place-items: center; background: rgba(2, 6, 23, .55); padding: 20px; }
.inc-image-modal.hidden { display: none; }
.inc-image-dialog { width: min(720px, 96vw); background: #fff; border-radius: 14px; padding: 20px; box-shadow: 0 24px 80px rgba(2,6,23,.28); }
.inc-image-dialog h3 { margin: 0 0 4px; font-size: 22px; font-weight: 900; }
.inc-image-dialog p { margin: 0 0 12px; color: #476184; }
.inc-image-preview { height: 320px; display: grid; place-items: center; margin: 12px 0; border-radius: 10px; overflow: hidden; background: #eff6ff; color: #476184; font-weight: 800; }
.inc-image-preview img { width: 100%; height: 100%; object-fit: cover; transition: transform .15s ease; }
.inc-image-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 14px; }
.inc-detail-modal { position: fixed; inset: 0; z-index: 1090; display: grid; place-items: center; background: rgba(2, 6, 23, .55); padding: 20px; }
.inc-detail-modal.hidden { display: none; }
.inc-detail-dialog { position: relative; width: min(920px, 96vw); max-height: 86vh; overflow: auto; background: #fff; border-radius: 14px; padding: 20px; box-shadow: 0 24px 80px rgba(2,6,23,.28); }
.inc-detail-dialog > button { position: absolute; right: 14px; top: 10px; border: 0; background: transparent; color: #061a44; font-size: 26px; cursor: pointer; }
.inc-detail-dialog h3 { margin: 0 34px 14px 0; color: #061a44; font-size: 22px; font-weight: 900; }
.inc-detail-summary { display: grid; gap: 4px; margin-bottom: 14px; border: 1px solid #dbeafe; border-radius: 10px; background: #f8fbff; padding: 14px; color: #355071; }
.inc-detail-summary strong { color: #061a44; font-size: 28px; font-weight: 950; }
.inc-detail-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.inc-detail-table th, .inc-detail-table td { padding: 10px; border-bottom: 1px solid #edf5ff; text-align: left; color: #061a44; }
.inc-detail-table th { background: #f3f8ff; color: #355071; }
.inc-detail-list { display: grid; grid-template-columns: 160px 1fr; gap: 10px 14px; margin: 0; }
.inc-detail-list dt { color: #476184; }
.inc-detail-list dd { margin: 0; color: #061a44; font-weight: 800; }
.inc-detail-history { display: grid; gap: 8px; color: #061a44; }
.inc-detail-history p { margin: 0; border-bottom: 1px solid #edf5ff; padding-bottom: 8px; }
@media (max-width: 1440px) {
  .incorporation-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .incorporation-cockpit-grid { grid-template-columns: 1fr 1fr; }
  .incorporation-card.full { grid-column: 1 / -1; }
  .inventory-layout { grid-template-columns: 170px minmax(0, 1fr) 340px; }
}
@media (max-width: 1100px) {
  .incorporation-page-head, .inventory-head { flex-direction: column; }
  .incorporation-filters, .incorporation-filters.compact, .inventory-top-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; }
  .incorporation-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .incorporation-cockpit-grid, .inventory-hero, .inventory-layout { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .incorporation-section { padding: 12px; }
  .incorporation-filters, .incorporation-filters.compact, .inventory-top-filters, .incorporation-kpis { grid-template-columns: 1fr; }
  .inventory-drawer dl { grid-template-columns: 1fr; }
}
