:root {
  --bg: #081221;
  --bg-soft: #0f1b2d;
  --surface: #13243a;
  --surface-2: #1b304b;
  --surface-3: #223b5c;
  --line: rgba(77, 163, 255, 0.14);
  --line-strong: rgba(61, 217, 197, 0.24);
  --ink: #f5fbff;
  --muted: #a3b5ca;
  --muted-2: #7d91aa;
  --accent: #ff9b3d;
  --accent-2: #ffb24d;
  --teal: #3dd9c5;
  --blue: #4da3ff;
  --violet: #7b61ff;
  --approved: #22c55e;
  --pending: #f4b740;
  --rejected: #ef4444;
  --shadow: 0 24px 74px rgba(0, 0, 0, 0.42);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 12% 0%, rgba(61, 217, 197, 0.16), transparent 30%),
    radial-gradient(circle at 84% 8%, rgba(123, 97, 255, 0.16), transparent 28%),
    radial-gradient(circle at 68% 82%, rgba(77, 163, 255, 0.11), transparent 34%),
    linear-gradient(135deg, var(--bg) 0%, var(--bg-soft) 48%, #0b1728 100%);
  color: var(--ink);
  font-family: Inter, Arial, sans-serif;
}

button,
input,
select {
  font: inherit;
  min-width: 0;
}

button,
a,
input,
select {
  transition:
    background-color 180ms ease,
    border-color 180ms ease,
    color 180ms ease,
    box-shadow 180ms ease,
    transform 180ms ease;
}

.app-shell {
  display: grid;
  grid-template-columns: 292px minmax(0, 1fr);
  height: 100vh;
  overflow: hidden;
  transition: grid-template-columns 180ms ease;
}

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

.is-hidden {
  display: none !important;
}

.login-screen {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(360px, 460px);
  gap: 34px;
  align-items: center;
  min-height: 100vh;
  padding: 42px;
}

.login-brand {
  display: grid;
  gap: 42px;
  max-width: 760px;
}

.login-logo {
  align-self: start;
}

.login-copy {
  max-width: 620px;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 1.06rem;
  line-height: 1.65;
}

.login-card {
  display: grid;
  gap: 16px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.085), rgba(255, 255, 255, 0.048));
  box-shadow: var(--shadow);
  animation: riseIn 460ms ease both;
}

.sidebar {
  position: relative;
  height: 100vh;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 18px;
  border-right: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(61, 217, 197, 0.1), transparent 34%),
    linear-gradient(180deg, rgba(15, 27, 45, 0.98), rgba(8, 18, 33, 0.98));
  backdrop-filter: blur(18px);
  overflow: hidden;
  transition: padding 180ms ease;
}

.sidebar-toggle {
  display: grid;
  width: 38px;
  height: 38px;
  margin: 12px 0 0;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  cursor: pointer;
}

.sidebar-toggle span {
  display: block;
  width: 16px;
  height: 2px;
  background: currentColor;
  transition: transform 180ms ease;
}

.sidebar-toggle span + span {
  margin-top: -12px;
}

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

.brand .sidebar-toggle {
  margin: 0 0 0 auto;
  flex: 0 0 auto;
}

.brand-mark {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #081221;
  font-weight: 800;
  letter-spacing: 0;
  box-shadow: 0 14px 36px rgba(255, 155, 61, 0.24);
}

.brand strong,
.brand span,
.sidebar-stats span,
.sidebar-stats strong {
  display: block;
}

.brand span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.86rem;
}

.side-nav {
  display: grid;
  gap: 6px;
  flex: 0 1 auto;
  min-height: 0;
  margin: 18px 0 12px;
  padding-right: 2px;
  overflow-y: auto;
}

.side-nav a {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 9px 10px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: #cfd6e6;
  text-decoration: none;
}

.nav-icon {
  display: grid;
  flex: 0 0 28px;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  font-size: 0.82rem;
  font-weight: 800;
}

.nav-text {
  white-space: nowrap;
}

.side-nav a.active,
.side-nav a:hover {
  border-color: var(--line);
  background: rgba(61, 217, 197, 0.12);
  color: #ffffff;
  transform: translateX(2px);
}

.side-nav a.active .nav-icon {
  background: linear-gradient(135deg, var(--teal), var(--blue));
  color: #081221;
}

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

.sidebar-collapsed .brand {
  justify-content: center;
}

.sidebar-collapsed .brand > div,
.sidebar-collapsed .nav-text,
.sidebar-collapsed .sidebar-stats,
.sidebar-collapsed .policy-panel {
  display: none;
}

.sidebar-collapsed .sidebar-toggle {
  margin-inline: auto;
}

.sidebar-collapsed .sidebar-toggle span:first-child {
  transform: rotate(90deg);
}

.sidebar-collapsed .side-nav {
  margin-top: 18px;
}

.sidebar-collapsed .side-nav a {
  justify-content: center;
  padding: 12px 8px;
}

.sidebar-collapsed .side-nav a:hover::after,
.sidebar-collapsed .side-nav a:focus-visible::after {
  position: absolute;
  left: calc(100% + 10px);
  z-index: 20;
  min-width: max-content;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(13, 18, 31, 0.96);
  color: #ffffff;
  box-shadow: var(--shadow);
  content: attr(title);
}

.content {
  width: 100%;
  max-width: 1540px;
  min-width: 0;
  height: 100vh;
  padding: 24px;
  overflow-x: hidden;
  overflow-y: auto;
}

.content > section[id]:not(.active-section) {
  display: none;
}

.mobile-menu-button {
  display: none;
}

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

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  white-space: nowrap;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--teal);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

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

.topbar h1 {
  color: rgba(245, 251, 255, 0.88);
  font-size: clamp(1.28rem, 2vw, 1.72rem);
  font-weight: 850;
  letter-spacing: 0;
}

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

.live-pill,
.user-pill,
.health-link,
.primary-action,
.secondary-action,
.details-button,
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border-radius: var(--radius);
  font-weight: 800;
}

.live-pill {
  padding: 0 10px;
  border: 1px solid rgba(34, 197, 94, 0.35);
  background: rgba(34, 197, 94, 0.1);
  color: var(--approved);
}

.user-pill {
  max-width: 160px;
  padding: 0 10px;
  border: 1px solid rgba(255, 255, 255, 0.11);
  background: rgba(255, 255, 255, 0.06);
  color: #ffffff;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.health-link,
.secondary-action,
.details-button,
.icon-button {
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.06);
  color: var(--ink);
  cursor: pointer;
  text-decoration: none;
}

.health-link {
  padding: 0 16px;
}

.primary-action {
  width: 100%;
  margin-top: 10px;
  border: 0;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #081221;
  cursor: pointer;
  box-shadow: 0 18px 46px rgba(255, 155, 61, 0.22);
}

.primary-action:hover,
.secondary-action:hover,
.details-button:hover,
.icon-button:hover,
.health-link:hover {
  transform: translateY(-1px);
}

.primary-action:hover {
  box-shadow: 0 24px 60px rgba(255, 155, 61, 0.3);
}

.primary-action.danger-action {
  background: linear-gradient(135deg, #ef4444, #fb7185);
  color: #fff7f7;
  box-shadow: 0 18px 46px rgba(239, 68, 68, 0.22);
}

.primary-action.success-action {
  background: linear-gradient(135deg, #22c55e, #3dd9c5);
  color: #081221;
  box-shadow: 0 18px 46px rgba(34, 197, 94, 0.2);
}

.primary-action:disabled {
  cursor: wait;
  opacity: 0.7;
  transform: none;
}

.dashboard-groups {
  display: grid;
  gap: 18px;
  margin-bottom: 18px;
}

.dashboard-group {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(13, 31, 47, 0.58);
}

.group-heading {
  margin-bottom: 16px;
}

.group-heading h2 {
  font-size: 1.1rem;
}

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

.metric,
.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(20, 54, 78, 0.82), rgba(8, 22, 36, 0.86));
  box-shadow: var(--shadow);
}

.metric {
  position: relative;
  overflow: hidden;
  min-height: 142px;
  padding: 18px;
  animation: riseIn 420ms ease both;
}

.metric::after {
  position: absolute;
  right: -18px;
  bottom: -18px;
  width: 86px;
  height: 86px;
  border-radius: 999px;
  background: rgba(53, 230, 193, 0.14);
  content: '';
}

.metric:nth-child(2)::after {
  background: rgba(255, 122, 69, 0.15);
}

.metric:nth-child(3)::after {
  background: rgba(53, 230, 193, 0.13);
}

.metric:nth-child(4)::after {
  background: rgba(242, 189, 61, 0.13);
}

.risk-card::after {
  background: rgba(255, 92, 92, 0.16);
}

.metric span,
.metric small,
.numbers span {
  color: var(--muted);
}

.metric strong {
  display: block;
  margin: 10px 0 4px;
  font-size: clamp(1.7rem, 2.5vw, 2.35rem);
  line-height: 1.05;
}

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

.decision-engine-card {
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.045);
}

.decision-engine-card span {
  color: var(--teal);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.decision-engine-card strong {
  display: block;
  margin: 8px 0 6px;
  line-height: 1.25;
}

.decision-engine-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

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

.panel {
  padding: 22px;
  animation: riseIn 460ms ease both;
}

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

.panel-subtitle {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.panel-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
}

.badge {
  padding: 7px 10px;
  border-radius: 999px;
  border: 1px solid rgba(61, 217, 197, 0.22);
  background: rgba(61, 217, 197, 0.1);
  color: var(--teal);
  font-size: 0.8rem;
  font-weight: 800;
}

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

label {
  display: grid;
  gap: 8px;
  color: #dce4f3;
  font-size: 0.88rem;
  font-weight: 700;
}

input,
select {
  width: 100%;
  min-height: 46px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: rgba(7, 10, 18, 0.76);
  color: var(--ink);
  outline: none;
}

input::placeholder {
  color: var(--muted-2);
}

.field-hint {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1.35;
}

.field-validation-message:empty {
  display: none;
}

.field-validation-message.error {
  color: var(--rejected);
}

input:focus,
select:focus {
  border-color: rgba(36, 211, 167, 0.72);
  box-shadow: 0 0 0 4px rgba(36, 211, 167, 0.12);
}

input.field-error,
select.field-error,
textarea.field-error {
  border-color: rgba(255, 92, 92, 0.88);
  background: rgba(255, 92, 92, 0.08);
  box-shadow: 0 0 0 4px rgba(255, 92, 92, 0.14);
}

.form-message {
  min-height: 22px;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.form-message.success {
  color: var(--approved);
}

.form-message.error {
  color: var(--rejected);
}

.form-message.warning {
  color: var(--pending);
}

.decision-card {
  min-height: 170px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.055);
}

.decision-card span,
.decision-card strong {
  display: block;
}

.decision-card span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.decision-card strong {
  margin: 9px 0;
  font-size: 1.85rem;
  line-height: 1.08;
}

.decision-card p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.55;
}

.decision-card.approved {
  border-color: rgba(47, 209, 124, 0.35);
  background: rgba(47, 209, 124, 0.1);
}

.decision-card.conditional {
  border-color: rgba(242, 189, 61, 0.38);
  background: rgba(242, 189, 61, 0.11);
}

.decision-card.rejected {
  border-color: rgba(255, 92, 92, 0.38);
  background: rgba(255, 92, 92, 0.11);
}

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

.numbers div {
  min-height: 86px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.045);
}

.numbers strong {
  display: block;
  margin-top: 8px;
  font-size: 1.18rem;
}

.history-panel {
  margin-top: 18px;
}

.user-panel {
  margin-top: 18px;
}

.customers-panel,
.sales-panel {
  margin-bottom: 18px;
}

.credit-analysis-box,
.credit-summary {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.04);
}

.customer-check {
  min-height: 42px;
  align-self: end;
}

.credit-summary {
  margin-top: 10px;
  border-color: rgba(36, 211, 167, 0.18);
  background: rgba(36, 211, 167, 0.055);
}

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

.credit-summary-header span {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
  text-transform: uppercase;
}

.credit-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.credit-summary-grid span {
  display: grid;
  gap: 4px;
  padding: 7px 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
}

.credit-summary-grid strong {
  color: var(--ink);
  font-size: 0.86rem;
  text-transform: none;
}

.credit-alerts {
  display: grid;
  gap: 5px;
  margin-top: 8px;
}

.credit-alerts p {
  margin: 0;
  padding: 6px 8px;
  border: 1px solid rgba(255, 92, 92, 0.22);
  border-radius: 10px;
  background: rgba(255, 92, 92, 0.08);
  color: #ffb0b0;
  font-size: 0.8rem;
}

.customers-list-panel {
  display: grid;
  gap: 10px;
  margin-top: 0;
}

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

.customer-filters label {
  gap: 4px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
}

.customer-filters input,
.customer-filters select {
  min-height: 34px;
  padding: 6px 9px;
}

.customer-grid {
  grid-template-columns: repeat(4, minmax(130px, 1fr));
  gap: 10px;
}

.customer-grid label {
  gap: 5px;
}

.customer-grid input,
.customer-grid select {
  min-height: 36px;
  padding: 7px 10px;
}

.compact-grid {
  grid-template-columns: repeat(4, minmax(120px, 1fr));
}

.customers-table-wrap {
  max-width: 100%;
  overflow: visible;
}

.customers-table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
}

.customers-table th,
.customers-table td {
  height: 42px;
  padding: 6px 6px;
  overflow: hidden;
  font-size: 0.76rem;
  line-height: 1.2;
  text-overflow: ellipsis;
  vertical-align: middle;
  white-space: nowrap;
}

.customers-table th {
  color: var(--muted);
  font-size: 0.68rem;
  letter-spacing: 0;
}

.customers-table th:nth-child(1),
.customers-table td:nth-child(1) {
  width: 30%;
}

.customers-table th:nth-child(2),
.customers-table td:nth-child(2) {
  width: 112px;
}

.customers-table th:nth-child(3),
.customers-table td:nth-child(3) {
  width: 126px;
}

.customers-table th:nth-child(4),
.customers-table td:nth-child(4) {
  width: 14%;
}

.customers-table th:nth-child(5),
.customers-table td:nth-child(5) {
  width: 92px;
}

.customers-table th:nth-child(6),
.customers-table td:nth-child(6) {
  width: 106px;
}

.customers-table th:nth-child(7),
.customers-table td:nth-child(7) {
  width: 224px;
  overflow: visible;
}

.customer-name-cell,
.truncate-cell {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.table-actions,
.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.customer-row-actions {
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-end;
  gap: 3px;
  white-space: nowrap;
}

.compact-action {
  width: auto;
  min-height: 40px;
  margin-top: 0;
  padding-inline: 16px;
}

.ghost-action {
  min-height: 26px;
  padding: 0 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(77, 163, 255, 0.055);
  color: var(--ink);
  font-size: 0.68rem;
  font-weight: 800;
  cursor: pointer;
}

.row-actions-menu {
  position: relative;
  flex: 0 0 auto;
}

.row-actions-menu summary {
  display: grid;
  width: 28px;
  height: 26px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(77, 163, 255, 0.055);
  color: var(--ink);
  cursor: pointer;
  font-weight: 900;
  list-style: none;
}

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

.row-actions-menu div {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 30;
  display: grid;
  min-width: 120px;
  gap: 6px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(15, 27, 45, 0.98);
  box-shadow: var(--shadow);
}

.row-actions-menu div .ghost-action {
  justify-content: flex-start;
  width: 100%;
}

.credit-policy-suggestion {
  padding: 10px 12px;
  border: 1px solid rgba(61, 217, 197, 0.2);
  border-radius: var(--radius);
  background: rgba(61, 217, 197, 0.07);
  color: #d9fff7;
  font-size: 0.86rem;
  line-height: 1.45;
}

.hidden-field {
  display: none !important;
}

.equifax-consult-actions {
  display: grid;
  grid-template-columns: minmax(220px, 320px) auto minmax(220px, 1fr);
  gap: 10px;
  align-items: end;
  margin-top: 10px;
  padding: 10px;
  border: 1px solid rgba(61, 217, 197, 0.18);
  border-radius: var(--radius);
  background: rgba(61, 217, 197, 0.055);
}

.external-report-panel {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.external-report-section {
  padding: 10px;
  border: 1px solid rgba(77, 163, 255, 0.16);
  border-radius: var(--radius);
  background: rgba(8, 18, 33, 0.46);
}

.external-report-section h4 {
  margin: 0 0 8px;
  color: var(--ink);
  font-size: 0.88rem;
}

.external-report-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.external-report-grid span,
.external-report-list li {
  min-width: 0;
  padding: 7px 8px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--muted);
  font-size: 0.78rem;
}

.external-report-grid strong {
  display: block;
  margin-top: 3px;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.external-report-list {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.external-alert {
  padding: 8px 10px;
  border: 1px solid rgba(244, 183, 64, 0.28);
  border-radius: 8px;
  background: rgba(244, 183, 64, 0.08);
  color: #fde68a;
  font-size: 0.82rem;
}

.external-ok {
  color: #bbf7d0;
}

.external-risk {
  color: #fecaca;
}

.credit-policy-admin {
  display: grid;
  gap: 12px;
  margin-bottom: 14px;
  padding: 14px;
  border: 1px solid rgba(61, 217, 197, 0.18);
  border-radius: var(--radius);
  background: rgba(61, 217, 197, 0.055);
}

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

.policy-band-table-wrap {
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.policy-band-table {
  min-width: 980px;
}

.policy-band-table th,
.policy-band-table td {
  padding: 6px;
  font-size: 0.74rem;
}

.policy-band-table input,
.policy-band-table select {
  min-height: 30px;
  padding: 5px 7px;
  font-size: 0.74rem;
}

.policy-band-table input[data-policy-field="note"] {
  min-width: 160px;
}

.policy-negative-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.policy-negative-card {
  display: grid;
  gap: 7px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.035);
}

.policy-negative-card strong {
  color: var(--ink);
  font-size: 0.86rem;
}

.policy-negative-card label {
  gap: 4px;
  font-size: 0.72rem;
}

.policy-negative-card input,
.policy-negative-card select {
  min-height: 32px;
  padding: 5px 8px;
}

.ghost-action:hover {
  border-color: rgba(61, 217, 197, 0.44);
  background: rgba(61, 217, 197, 0.1);
  color: var(--teal);
}

.ghost-action.danger-action {
  border-color: rgba(239, 68, 68, 0.24);
  color: #fecaca;
}

.ghost-action.success-action {
  border-color: rgba(34, 197, 94, 0.26);
  color: #bbf7d0;
}

.customers-cards {
  display: none;
}

.intelligence-table-wrap {
  max-width: 100%;
  overflow: hidden;
}

.intelligence-table {
  width: 100%;
  table-layout: fixed;
}

.intelligence-table th,
.intelligence-table td {
  height: 42px;
  padding: 6px 5px;
  overflow: hidden;
  font-size: 0.72rem;
  line-height: 1.2;
  text-overflow: ellipsis;
  vertical-align: middle;
  white-space: nowrap;
}

.intelligence-table th:nth-child(1),
.intelligence-table td:nth-child(1) {
  width: 18%;
}

.intelligence-table th:nth-child(2),
.intelligence-table td:nth-child(2) {
  width: 104px;
}

.intelligence-table th:nth-child(3),
.intelligence-table td:nth-child(3) {
  width: 64px;
}

.intelligence-table th:nth-child(4),
.intelligence-table td:nth-child(4) {
  width: 118px;
}

.intelligence-table th:nth-child(5),
.intelligence-table td:nth-child(5),
.intelligence-table th:nth-child(9),
.intelligence-table td:nth-child(9) {
  width: 92px;
}

.intelligence-table th:nth-child(6),
.intelligence-table td:nth-child(6),
.intelligence-table th:nth-child(7),
.intelligence-table td:nth-child(7),
.intelligence-table th:nth-child(8),
.intelligence-table td:nth-child(8) {
  width: 64px;
}

.intelligence-table th:nth-child(10),
.intelligence-table td:nth-child(10) {
  width: 132px;
}

.intelligence-table th:nth-child(11),
.intelligence-table td:nth-child(11) {
  width: 76px;
}

.intelligence-cards {
  display: none;
}

.reason-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.45;
}

.customer-card {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.045);
}

.customer-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.customer-dialog {
  width: min(1120px, calc(100vw - 28px));
}

.customer-edit-form {
  max-height: min(78vh, 780px);
  overflow-y: auto;
}

.customer-form-content {
  display: grid;
  gap: 12px;
  max-height: min(78vh, 780px);
  padding: 22px;
  overflow-y: auto;
}

.form-section {
  display: grid;
  gap: 10px;
}

.user-form,
.customer-form,
.sale-form {
  display: grid;
  gap: 12px;
}

.sale-form {
  gap: 8px;
}

.sale-sections {
  display: grid;
  gap: 8px;
}

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

.section-label {
  color: var(--teal);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.sale-grid {
  gap: 8px;
  align-items: end;
}

.sale-grid-identification {
  grid-template-columns: minmax(260px, 1fr) minmax(150px, 0.38fr);
}

.sale-grid-editable {
  grid-template-columns: minmax(130px, 0.55fr) minmax(120px, 0.5fr) minmax(180px, 0.75fr) minmax(150px, 0.55fr);
}

.sale-grid-calculated {
  grid-template-columns: repeat(5, minmax(118px, 1fr));
}

.sale-grid-entry-policy {
  grid-template-columns: minmax(120px, 0.35fr) minmax(150px, 0.45fr) minmax(260px, 1fr);
}

.sale-section label {
  gap: 4px;
  font-size: 0.82rem;
}

.sale-section input,
.sale-section select {
  min-height: 34px;
  padding: 0 10px;
}

.money-field input,
.money-field select {
  max-width: 150px;
}

.compact-field input,
.compact-field select {
  max-width: 160px;
}

.calculated-section,
.sale-entry-policy-section {
  padding: 9px;
  border: 1px solid rgba(36, 211, 167, 0.14);
  border-radius: var(--radius);
  background: rgba(36, 211, 167, 0.045);
}

.calculated-field {
  color: #cdd8e6;
}

.calculated-field input[readonly] {
  border-color: rgba(255, 255, 255, 0.09);
  background: rgba(255, 255, 255, 0.055);
  color: #dfe7f5;
  cursor: default;
}

.calculated-field::after {
  color: var(--muted-2);
  font-size: 0.72rem;
  font-weight: 700;
  content: 'calculado automaticamente';
}

.sales-list-heading {
  margin-top: 18px;
}

.sale-guidance,
.sale-summary-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.045);
}

.sale-guidance {
  padding: 12px;
}

.sale-guidance strong,
.summary-heading strong {
  display: block;
  color: #ffffff;
}

.sale-guidance ul {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px 16px;
  margin: 10px 0 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.35;
}

.sale-summary-card {
  padding: 10px;
}

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

.summary-heading span,
.sale-summary-grid span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.sale-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.sale-summary-grid div {
  min-width: 0;
  min-height: 54px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(7, 10, 18, 0.4);
}

.sale-summary-grid strong {
  display: block;
  margin-top: 4px;
  overflow-wrap: anywhere;
  font-size: 0.9rem;
}

.sale-actions {
  display: grid;
  grid-template-columns: minmax(160px, 0.34fr) minmax(220px, 0.66fr);
  gap: 12px;
  justify-content: end;
  align-items: center;
}

.sale-actions .primary-action,
.sale-actions .secondary-action {
  width: 100%;
  min-height: 46px;
}

.sale-actions .primary-action {
  margin-top: 0;
}

.wide-field {
  grid-column: 1 / -1;
}

.table-heading {
  align-items: flex-start;
}

.filters {
  display: grid;
  grid-template-columns: minmax(170px, 230px) minmax(150px, 190px) auto;
  gap: 10px;
}

.filters input {
  min-height: 42px;
}

.receivables-filters {
  grid-template-columns: minmax(220px, 1.4fr) repeat(4, minmax(140px, 1fr)) auto;
  align-items: end;
  margin-bottom: 12px;
}

.receivables-filters label,
.history-filters label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.history-filters {
  grid-template-columns: minmax(220px, 1.4fr) repeat(5, minmax(130px, 1fr)) auto;
  align-items: end;
  margin-bottom: 12px;
}

.collection-filters {
  grid-template-columns: minmax(220px, 1.5fr) minmax(150px, 0.8fr) minmax(180px, 0.9fr) auto;
  align-items: end;
  margin-bottom: 12px;
}

.collection-filters label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.collection-templates {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 10px 0;
}

.receivables-cards,
.sales-cards {
  display: none;
}

.receivable-card,
.sale-list-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.045);
}

.receivable-card > div:first-child span,
.sale-list-card > div:first-child span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
}

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

.receivable-card-grid span {
  display: grid;
  gap: 3px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.receivable-card-grid strong {
  color: var(--ink);
  font-size: 0.96rem;
  text-transform: none;
}

.pagination-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin-top: 14px;
}

.pagination-bar > div {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.pagination-bar label {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.pagination-bar select {
  min-height: 38px;
}

.pagination-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.pagination-actions span {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.receivables-table-wrap table {
  min-width: 1160px;
}

.sales-filters {
  grid-template-columns: minmax(220px, 1.4fr) minmax(130px, 0.7fr) repeat(2, minmax(130px, 0.7fr)) auto;
  align-items: end;
  margin-bottom: 12px;
}

.sales-table-wrap table {
  min-width: 980px;
}

.sales-table th,
.sales-table td {
  padding: 9px 8px;
  font-size: 0.82rem;
}

.history-table-wrap table {
  min-width: 1040px;
}

.collection-table-wrap table {
  min-width: 1080px;
}

.receivables-table-wrap th,
.receivables-table-wrap td,
.history-table-wrap th,
.history-table-wrap td,
.collection-table-wrap th,
.collection-table-wrap td {
  padding: 9px 8px;
  font-size: 0.84rem;
}

.collection-table-wrap th {
  padding: 9px 8px;
}

.collection-table-wrap .payment-button {
  min-height: 32px;
  padding-inline: 10px;
}

.truncate-cell {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.truncate-cell strong,
.truncate-cell span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.collection-pagination {
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.pagination-summary {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
}

.receivables-table-wrap th:first-child,
.receivables-table-wrap td:first-child,
.receivables-table-wrap th:nth-child(9),
.receivables-table-wrap td:nth-child(9) {
  width: 86px;
}

.receivables-table-wrap th:nth-child(2),
.receivables-table-wrap td:nth-child(2),
.receivables-table-wrap th:nth-child(4),
.receivables-table-wrap td:nth-child(4) {
  min-width: 170px;
}

.status-pill.audit-action {
  background: rgba(36, 211, 167, 0.13);
  color: var(--teal);
}

.audit-detail-block {
  margin-top: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.04);
}

.audit-detail-block h3 {
  margin: 0 0 12px;
  font-size: 1rem;
}

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

.audit-data-grid div {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(7, 10, 18, 0.28);
}

.audit-data-grid span {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.audit-data-grid strong {
  display: block;
  margin-top: 5px;
  overflow-wrap: anywhere;
  font-size: 0.9rem;
  font-weight: 700;
}

.table-wrap {
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  min-width: 1180px;
  border-collapse: collapse;
}

th,
td {
  padding: 15px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

th {
  color: var(--muted);
  background: rgba(255, 255, 255, 0.045);
  font-size: 0.74rem;
  text-transform: uppercase;
}

td {
  color: #dce4f3;
  font-size: 0.9rem;
}

tbody tr {
  transition: background-color 160ms ease;
}

tbody tr:hover {
  background: rgba(255, 255, 255, 0.05);
}

.client-name,
.row-muted {
  display: block;
}

.client-name {
  color: #ffffff;
}

.row-muted {
  margin-top: 4px;
  color: var(--muted-2);
  font-size: 0.78rem;
}

.score-chip,
.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 0.72rem;
  font-weight: 800;
}

.score-chip {
  min-width: 44px;
  padding: 0 10px;
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.status-pill {
  padding: 0 9px;
}

.status-pill.approved {
  border-color: rgba(34, 197, 94, 0.26);
  background: rgba(34, 197, 94, 0.12);
  color: var(--approved);
}

.status-pill.conditional {
  border-color: rgba(244, 183, 64, 0.28);
  background: rgba(244, 183, 64, 0.13);
  color: var(--pending);
}

.status-pill.rejected {
  border-color: rgba(239, 68, 68, 0.3);
  background: rgba(239, 68, 68, 0.12);
  color: var(--rejected);
}

.status-pill.sale-active,
.status-pill.installment-pending {
  border-color: rgba(244, 183, 64, 0.28);
  background: rgba(244, 183, 64, 0.13);
  color: var(--pending);
}

.status-pill.installment-partial,
.status-pill.installment-partial_transferred {
  border-color: rgba(77, 163, 255, 0.28);
  background: rgba(77, 163, 255, 0.13);
  color: var(--blue);
}

.status-pill.sale-paid,
.status-pill.installment-paid {
  border-color: rgba(34, 197, 94, 0.26);
  background: rgba(34, 197, 94, 0.12);
  color: var(--approved);
}

.status-pill.sale-overdue,
.status-pill.installment-overdue {
  border-color: rgba(239, 68, 68, 0.3);
  background: rgba(239, 68, 68, 0.12);
  color: var(--rejected);
}

.status-pill.sale-canceled,
.status-pill.installment-canceled {
  border-color: rgba(163, 181, 202, 0.22);
  background: rgba(153, 164, 184, 0.16);
  color: var(--muted);
}

.status-pill.paid {
  border-color: rgba(34, 197, 94, 0.26);
  background: rgba(34, 197, 94, 0.12);
  color: var(--approved);
}

.status-pill.pending {
  border-color: rgba(123, 97, 255, 0.34);
  background: rgba(123, 97, 255, 0.14);
  color: #c6bcff;
}

.status-pill.overdue {
  border-color: rgba(239, 68, 68, 0.3);
  background: rgba(239, 68, 68, 0.12);
  color: var(--rejected);
}

.status-pill.inactive {
  border-color: rgba(163, 181, 202, 0.2);
  background: rgba(153, 164, 184, 0.16);
  color: var(--muted);
}

.empty-state {
  padding: 28px 12px;
  color: var(--muted);
  text-align: center;
}

.details-button {
  min-height: 34px;
  padding: 0 12px;
}

.payment-button {
  white-space: nowrap;
}

.details-button:hover,
.icon-button:hover,
.secondary-action:hover,
.health-link:hover {
  border-color: rgba(36, 211, 167, 0.45);
  color: var(--teal);
}

.details-dialog {
  width: min(760px, calc(100vw - 32px));
  max-height: calc(100vh - 40px);
  overflow: auto;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 0;
  background: #111827;
  color: var(--ink);
  box-shadow: 0 34px 100px rgba(0, 0, 0, 0.58);
}

.details-dialog::backdrop {
  background: rgba(0, 0, 0, 0.68);
  backdrop-filter: blur(4px);
}

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

.icon-button {
  width: 38px;
  height: 38px;
  padding: 0;
}

.details-content {
  padding: 22px;
}

.confirmation-dialog {
  width: min(620px, calc(100vw - 32px));
}

.confirmation-copy {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
}

.confirmation-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
  margin-top: 18px;
}

.confirmation-actions .primary-action {
  margin-top: 0;
}

.authorization-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.authorization-fields .field-hint {
  grid-column: 1 / -1;
}

.final-sale-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 16px;
}

.final-sale-summary div {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.045);
}

.final-sale-summary span {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.final-sale-summary strong {
  display: block;
  margin-top: 5px;
  overflow-wrap: anywhere;
  font-size: 0.94rem;
}

.payment-dialog {
  width: min(860px, calc(100vw - 32px));
}

.payment-form {
  display: grid;
  gap: 16px;
}

.payment-readonly-grid,
.payment-edit-grid,
.payment-confirmation-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.payment-readonly-grid div,
.payment-confirmation-summary div {
  min-width: 0;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.045);
}

.payment-readonly-grid span,
.payment-confirmation-summary span {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.payment-readonly-grid strong,
.payment-confirmation-summary strong {
  display: block;
  margin-top: 6px;
  overflow-wrap: anywhere;
}

.payment-edit-grid label {
  min-width: 0;
}

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

.calculated-payment-field input[readonly] {
  border-color: rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.055);
  color: var(--ink);
  cursor: default;
}

.payment-waiver-controls {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.035);
}

.inline-option {
  display: flex;
  align-items: center;
  gap: 8px;
}

.inline-option input {
  width: auto;
}

.payment-confirmation {
  padding: 14px;
  border: 1px solid rgba(36, 211, 167, 0.28);
  border-radius: var(--radius);
  background: rgba(36, 211, 167, 0.07);
}

.payment-confirmation h3 {
  margin: 0 0 8px;
  font-size: 1rem;
}

.payment-confirmation-summary {
  margin-top: 12px;
}

.installments-section .table-wrap {
  overflow-x: visible;
}

.installments-section table {
  table-layout: auto;
}

.installments-section th,
.installments-section td {
  padding: 10px 8px;
  white-space: normal;
}

.installments-section th:nth-child(1),
.installments-section td:nth-child(1) {
  width: 64px;
}

.installments-section th:nth-child(8),
.installments-section td:nth-child(8) {
  width: 116px;
}

.detail-status {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.05);
}

.detail-status.approved {
  border-color: rgba(47, 209, 124, 0.34);
}

.detail-status.conditional {
  border-color: rgba(242, 189, 61, 0.34);
}

.detail-status.rejected {
  border-color: rgba(255, 92, 92, 0.34);
}

.detail-status p {
  margin: 12px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

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

.detail-grid div {
  min-height: 78px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.045);
}

.detail-grid span {
  display: block;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
}

.detail-grid strong {
  display: block;
  margin-top: 8px;
  font-size: 1rem;
}

.installments-section {
  margin-top: 18px;
}

@keyframes riseIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

@media (max-width: 1160px) {
  .workspace,
  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .sale-grid-identification,
  .sale-grid-editable,
  .sale-grid-calculated {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

@media (max-width: 920px) {
  .login-screen {
    grid-template-columns: 1fr;
    padding: 24px;
  }

  .app-shell {
    height: 100vh;
    grid-template-columns: 1fr;
  }

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

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 50;
    width: min(292px, calc(100vw - 48px));
    height: 100vh;
    transform: translateX(-104%);
    box-shadow: var(--shadow);
  }

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

  .app-shell.sidebar-mobile-open::after {
    position: fixed;
    inset: 0;
    z-index: 40;
    background: rgba(0, 0, 0, 0.52);
    content: '';
  }

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

  .sidebar-collapsed .brand > div,
  .sidebar-collapsed .nav-text,
  .sidebar-collapsed .sidebar-stats,
  .sidebar-collapsed .policy-panel {
    display: block;
  }

  .sidebar-collapsed .brand {
    justify-content: flex-start;
  }

  .sidebar-collapsed .side-nav a {
    justify-content: flex-start;
    padding: 13px 14px;
  }

  .sidebar-collapsed .side-nav a:hover::after,
  .sidebar-collapsed .side-nav a:focus-visible::after {
    display: none;
  }

  .side-nav {
    grid-template-columns: 1fr;
  }

  .content {
    height: 100vh;
    padding: 18px;
  }

  .mobile-menu-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 36px;
    margin-bottom: 8px;
    padding: 0 12px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.06);
    color: var(--ink);
    font-weight: 800;
    cursor: pointer;
  }

  .workspace,
  .metric-grid,
  .decision-engine-grid,
  .filters,
  .history-filters,
  .collection-filters,
  .receivables-filters,
  .sales-filters,
  .sale-guidance ul,
  .sale-grid,
  .sale-grid-identification,
  .sale-grid-editable,
  .sale-grid-calculated,
  .sale-grid-entry-policy {
    grid-template-columns: 1fr;
  }

  .money-field input,
  .money-field select,
  .compact-field input,
  .compact-field select {
    max-width: 100%;
  }

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

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

@media (max-width: 640px) {
  .app-shell,
  .content,
  .panel,
  .dashboard-group,
  .table-wrap,
  .details-dialog {
    max-width: 100%;
  }

  .content,
  .sidebar {
    padding: 18px;
  }

  .topbar,
  .topbar-actions,
  .panel-heading,
  .panel-actions {
    align-items: flex-start;
    flex-direction: column;
  }

  .panel-actions,
  .panel-actions .primary-action,
  .panel-actions .secondary-action {
    width: 100%;
  }

  .side-nav,
  .form-grid,
  .customer-filters,
  .customer-grid,
  .compact-grid,
  .numbers,
  .detail-grid,
  .credit-summary-grid,
  .sale-summary-grid,
  .sale-actions,
  .authorization-fields,
  .equifax-consult-actions,
  .external-report-grid,
  .payment-card-fields,
  .final-sale-summary,
  .payment-readonly-grid,
  .payment-edit-grid,
  .policy-negative-grid,
  .payment-confirmation-summary {
    grid-template-columns: 1fr;
  }

  .receivables-table-wrap {
    display: none;
  }

  .sales-table-wrap {
    display: none;
  }

  .customers-table-wrap {
    display: none;
  }

  .intelligence-table-wrap {
    display: none;
  }

  .customers-cards {
    display: grid;
    gap: 12px;
  }

  .intelligence-cards {
    display: grid;
    gap: 12px;
  }

  .receivables-cards,
  .sales-cards,
  .audit-cards {
    display: grid;
    gap: 12px;
  }

  .receivable-card .details-button,
  .sale-list-card .details-button {
    width: 100%;
  }

  .history-table-wrap {
    display: none;
  }

  .collection-table-wrap {
    display: none;
  }

  .collection-cards {
    display: grid;
    gap: 12px;
  }

  .collection-templates {
    display: grid;
  }

  .pagination-bar,
  .pagination-actions,
  .pagination-bar > div {
    width: 100%;
  }

  .pagination-actions,
  .pagination-bar > div {
    display: grid;
    grid-template-columns: 1fr;
  }

  .panel,
  .dashboard-group,
  .metric,
  .credit-analysis-box,
  .credit-summary,
  .sale-guidance,
  .sale-summary-card,
  .customer-form-content,
  .details-content {
    padding: 16px;
  }

  .customer-dialog {
    width: 100%;
    max-width: 100%;
    min-height: 100vh;
    border-radius: 0;
  }

  .customer-edit-form,
  .customer-form-content {
    max-height: calc(100vh - 92px);
  }

  .primary-action,
  .secondary-action,
  .confirmation-actions {
    width: 100%;
  }

  .confirmation-actions {
    grid-template-columns: 1fr;
  }

  .wide-field {
    grid-column: auto;
  }

  .login-screen {
    padding: 20px;
  }

  h1 {
    font-size: 2rem;
  }

  .installments-section table,
  .installments-section thead,
  .installments-section tbody,
  .installments-section tr,
  .installments-section th,
  .installments-section td {
    display: block;
  }

  .installments-section thead {
    display: none;
  }

  .installments-section tr {
    margin-bottom: 12px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.035);
  }

  .installments-section td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid var(--line);
    text-align: right;
  }

  .installments-section td:last-child {
    border-bottom: 0;
  }

  .installments-section td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 800;
    text-align: left;
    text-transform: uppercase;
  }

  .installments-section .empty-state::before {
    content: '';
  }

  .installments-section .payment-button {
    width: auto;
    min-width: 120px;
  }

  .audit-data-grid {
    grid-template-columns: 1fr;
  }
}
