:root {
  --bg: #f7f8fa;
  --surface: #ffffff;
  --surface-subtle: #f1f4f7;
  --surface-raised: #fbfcfe;
  --border: #d8dee7;
  --divider: #e6eaf0;
  --text: #111827;
  --text-secondary: #4b5563;
  --text-muted: #6b7280;
  --text-disabled: #9ca3af;
  --text-inverted: #f9fafb;
  --sidebar: #121826;
  --sidebar-active: #1d2740;
  --purple: #6e54ff;
  --blue: #2563eb;
  --green: #16a34a;
  --amber: #d97706;
  --red: #dc2626;
  --cyan: #0891b2;
  --shadow: 0 18px 48px rgba(17, 24, 39, 0.12);
  --radius: 8px;
  --radius-sm: 6px;
  --sidebar-width: 220px;
  --header-height: 64px;
  --receipt-height: 88px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
}

* {
  box-sizing: border-box;
}

html,
body,
#app {
  min-height: 100%;
  margin: 0;
}

body {
  background: var(--bg);
}

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

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
}

.app-shell {
  min-height: 100vh;
  background: var(--bg);
}

.app-header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 14px;
  height: var(--header-height);
  padding: 10px 18px 10px 20px;
  border-bottom: 1px solid var(--border);
  background: rgba(247, 248, 250, 0.94);
  backdrop-filter: blur(12px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 190px;
  font-weight: 700;
  color: var(--text);
}

.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid rgba(110, 84, 255, 0.28);
  border-radius: var(--radius);
  background: #ffffff;
  color: var(--purple);
  font-weight: 800;
  letter-spacing: 0;
}

.brand small {
  display: block;
  margin-top: 1px;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 500;
}

.search {
  position: relative;
  flex: 1;
  max-width: 360px;
}

.search input {
  width: 100%;
  height: 38px;
  padding: 0 12px 0 34px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  outline: none;
}

.search input:focus {
  border-color: rgba(37, 99, 235, 0.55);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.search::before {
  position: absolute;
  top: 10px;
  left: 12px;
  color: var(--text-muted);
  content: "/";
  font-weight: 700;
}

.segment {
  display: flex;
  min-width: 310px;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.segment button {
  height: 30px;
  padding: 0 10px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
}

.segment button.active {
  background: var(--sidebar);
  color: var(--text-inverted);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  font-weight: 650;
  line-height: 1;
  white-space: nowrap;
  transition: border-color 0.15s ease, background-color 0.15s ease,
    color 0.15s ease, transform 0.15s ease;
}

.btn:hover:not(:disabled) {
  border-color: #b9c2d0;
  background: #f9fafb;
}

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

.btn.primary {
  border-color: var(--blue);
  background: var(--blue);
  color: #ffffff;
}

.btn.primary:hover:not(:disabled) {
  background: #1d4ed8;
}

.btn.success {
  border-color: var(--green);
  background: var(--green);
  color: #ffffff;
}

.btn.danger {
  border-color: var(--red);
  background: var(--red);
  color: #ffffff;
}

.btn.ghost {
  border-color: transparent;
  background: transparent;
}

.btn.small {
  min-height: 30px;
  padding: 0 9px;
  font-size: 12px;
}

.btn:disabled {
  border-color: var(--border);
  background: #edf1f5;
  color: var(--text-disabled);
}

.health {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
}

.health .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
}

.health .dot.success {
  background: var(--green);
}

.health .dot.warning {
  background: var(--amber);
}

.health .dot.danger {
  background: var(--red);
}

.health .dot.pending,
.health .dot.neutral {
  background: var(--blue);
}

.sidebar {
  position: fixed;
  inset: var(--header-height) auto 0 0;
  z-index: 15;
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: var(--sidebar-width);
  padding: 18px 12px;
  background: var(--sidebar);
  color: #cbd5e1;
}

.sidebar-nav {
  min-height: 0;
  flex: 1;
  overflow-y: auto;
  padding-right: 2px;
  scrollbar-width: thin;
}

.sidebar-section {
  margin-bottom: 18px;
}

.sidebar-label {
  margin: 0 10px 8px;
  color: #758297;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.nav-item {
  display: flex;
  align-items: center;
  width: 100%;
  gap: 10px;
  min-height: 38px;
  padding: 0 10px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: #cbd5e1;
  font-size: 13px;
  font-weight: 650;
  text-align: left;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.06);
}

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

.nav-icon {
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  font-size: 12px;
  font-weight: 800;
}

.sidebar-foot {
  flex: 0 0 auto;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.05);
}

.sidebar-foot strong {
  display: block;
  margin-bottom: 5px;
  color: #ffffff;
  font-size: 12px;
}

.sidebar-foot span {
  color: #94a3b8;
  font-size: 12px;
  line-height: 1.4;
}

.main {
  min-height: 100vh;
  padding: calc(var(--header-height) + 18px) 18px
    calc(var(--receipt-height) + 18px) calc(var(--sidebar-width) + 18px);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(300px, 410px) minmax(420px, 1fr) minmax(300px, 360px);
  gap: 14px;
  min-height: calc(100vh - var(--header-height) - var(--receipt-height) - 36px);
}

.panel {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 14px 12px;
  border-bottom: 1px solid var(--divider);
}

.panel-title {
  margin: 0;
  color: var(--text);
  font-size: 15px;
  font-weight: 720;
}

.panel-subtitle {
  margin: 3px 0 0;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.4;
}

.queue-panel {
  overflow: hidden;
}

.queue-scroll,
.inspector-scroll {
  max-height: calc(100vh - var(--header-height) - var(--receipt-height) - 108px);
  overflow: auto;
}

.queue-group {
  padding: 12px 0;
  border-bottom: 1px solid var(--divider);
}

.queue-group:last-child {
  border-bottom: 0;
}

.queue-group-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px 8px;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 750;
  text-transform: uppercase;
}

.queue-row {
  width: 100%;
  padding: 12px 14px;
  border: 0;
  border-left: 3px solid transparent;
  background: transparent;
  color: inherit;
  text-align: left;
}

.queue-row:hover {
  background: #f8fafc;
}

.queue-row.active {
  border-left-color: var(--purple);
  background: #f5f7ff;
}

.queue-row-main {
  display: flex;
  gap: 10px;
}

.avatar {
  display: grid;
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: var(--radius-sm);
  background: var(--surface-subtle);
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
}

.avatar.agent {
  background: #eff6ff;
  color: var(--blue);
}

.avatar.vendor {
  background: #ecfdf5;
  color: var(--green);
}

.queue-body {
  min-width: 0;
  flex: 1;
}

.queue-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--text);
  font-size: 13px;
  font-weight: 750;
}

.queue-title span:first-child,
.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.queue-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 5px;
  color: var(--text-muted);
  font-size: 12px;
}

.queue-actions {
  display: flex;
  gap: 7px;
  margin-top: 9px;
}

.badge,
.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 750;
  white-space: nowrap;
}

.badge.neutral,
.pill.neutral {
  background: #eef2f7;
  color: var(--text-secondary);
}

.badge.pending,
.pill.pending {
  background: #eff6ff;
  color: var(--blue);
}

.badge.success,
.pill.success {
  background: #ecfdf5;
  color: var(--green);
}

.badge.warning,
.pill.warning {
  background: #fffbeb;
  color: var(--amber);
}

.badge.danger,
.pill.danger {
  background: #fef2f2;
  color: var(--red);
}

.badge.purple,
.pill.purple {
  background: #f1efff;
  color: var(--purple);
}

.content-column {
  display: grid;
  grid-template-rows: minmax(260px, auto) 1fr;
  gap: 14px;
}

.intent-hero {
  padding: 16px;
}

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

.intent-id {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
}

.intent-title {
  margin: 5px 0 0;
  color: var(--text);
  font-size: 24px;
  font-weight: 760;
  line-height: 1.15;
}

.intent-copy {
  max-width: 630px;
  margin: 8px 0 0;
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.5;
}

.amount-stack {
  min-width: 160px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-raised);
  text-align: right;
}

.amount-stack span {
  display: block;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 750;
  text-transform: uppercase;
}

.amount-stack strong {
  display: block;
  margin-top: 3px;
  color: var(--text);
  font-size: 24px;
}

.stepper {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  margin-top: 18px;
}

.step {
  position: relative;
  min-height: 70px;
  padding: 11px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #ffffff;
}

.step::before {
  display: block;
  width: 18px;
  height: 18px;
  margin-bottom: 8px;
  border-radius: 50%;
  background: #d1d5db;
  color: #ffffff;
  content: "";
}

.step.done::before {
  background: var(--green);
}

.step.current {
  border-color: rgba(110, 84, 255, 0.55);
  box-shadow: inset 0 0 0 1px rgba(110, 84, 255, 0.2);
}

.step.current::before {
  background: var(--purple);
}

.step.blocked {
  border-color: rgba(220, 38, 38, 0.35);
  background: #fff8f8;
}

.step.blocked::before {
  background: var(--red);
}

.step-title {
  color: var(--text);
  font-size: 12px;
  font-weight: 760;
}

.step-meta {
  margin-top: 2px;
  color: var(--text-muted);
  font-size: 11px;
}

.matrix {
  padding: 8px 0;
}

.matrix-row {
  display: grid;
  grid-template-columns: 1.2fr 0.9fr auto;
  align-items: center;
  gap: 12px;
  min-height: 46px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--divider);
}

.matrix-row:last-child {
  border-bottom: 0;
}

.matrix-label {
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
}

.matrix-value {
  color: var(--text-secondary);
  font-size: 13px;
}

.inspector {
  overflow: hidden;
}

.module {
  padding: 13px 14px;
  border-bottom: 1px solid var(--divider);
}

.module:last-child {
  border-bottom: 0;
}

.module-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.module-title {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-size: 13px;
  font-weight: 750;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-disabled);
}

.status-dot.success {
  background: var(--green);
}

.status-dot.warning {
  background: var(--amber);
}

.status-dot.danger {
  background: var(--red);
}

.status-dot.pending {
  background: var(--blue);
}

.module-reason {
  margin: 7px 0 0;
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.45;
}

.module-ref {
  margin-top: 7px;
  color: var(--text-muted);
  font-family: "JetBrains Mono", "IBM Plex Mono", ui-monospace, SFMono-Regular,
    Menlo, monospace;
  font-size: 11px;
}

.decision {
  margin: 14px;
  padding: 12px;
  border-radius: var(--radius);
}

.decision.success {
  border: 1px solid rgba(22, 163, 74, 0.28);
  background: #ecfdf5;
}

.decision.warning {
  border: 1px solid rgba(217, 119, 6, 0.28);
  background: #fffbeb;
}

.decision.danger {
  border: 1px solid rgba(220, 38, 38, 0.28);
  background: #fef2f2;
}

.decision strong {
  display: block;
  margin-bottom: 3px;
  color: var(--text);
  font-size: 13px;
}

.decision span {
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.45;
}

.settlement-list {
  display: grid;
  gap: 0;
}

.settlement-row {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr) auto auto auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 13px 14px;
  border: 0;
  border-bottom: 1px solid var(--divider);
  background: transparent;
  color: inherit;
  text-align: left;
}

.settlement-row:last-child {
  border-bottom: 0;
}

.settlement-row:hover {
  background: #f8fafc;
}

.settlement-row.active {
  background: #f5f7ff;
}

.settlement-check {
  display: inline-flex;
  justify-content: center;
  width: 76px;
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 760;
}

.settlement-row.active .settlement-check {
  border-color: rgba(37, 99, 235, 0.36);
  background: #eff6ff;
  color: var(--blue);
}

.settlement-main {
  display: grid;
  min-width: 0;
  gap: 3px;
}

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

.settlement-main strong {
  color: var(--text);
  font-size: 13px;
}

.settlement-main span {
  color: var(--text-muted);
  font-size: 12px;
}

.settlement-actions {
  display: grid;
  gap: 8px;
  padding: 14px;
  border-top: 1px solid var(--divider);
}

.settlement-notes {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  padding: 14px;
}

.settlement-notes div {
  display: grid;
  gap: 5px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-raised);
}

.settlement-notes strong {
  color: var(--text);
  font-size: 13px;
}

.settlement-notes span {
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.45;
}

.evidence-actions {
  display: grid;
  gap: 8px;
  padding: 14px;
  border-top: 1px solid var(--divider);
}

.evidence-policy {
  display: grid;
  gap: 0;
}

.evidence-policy div {
  display: grid;
  gap: 5px;
  padding: 14px;
  border-bottom: 1px solid var(--divider);
}

.evidence-policy div:last-child {
  border-bottom: 0;
}

.evidence-policy strong {
  color: var(--text);
  font-size: 13px;
}

.evidence-policy span {
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.45;
}

.compliance-modules {
  display: grid;
  gap: 0;
}

.compliance-module {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(150px, 0.42fr);
  align-items: center;
  gap: 12px;
  padding: 14px;
  border-bottom: 1px solid var(--divider);
}

.compliance-module:last-child {
  border-bottom: 0;
}

.compliance-module strong {
  display: block;
  color: var(--text);
  font-size: 13px;
}

.compliance-module span {
  display: block;
  margin-top: 3px;
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.45;
}

.compliance-module code {
  overflow: hidden;
  padding: 7px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-raised);
  color: var(--text-secondary);
  font-family: "JetBrains Mono", "IBM Plex Mono", ui-monospace, SFMono-Regular,
    Menlo, monospace;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.adapter-contracts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  padding: 14px;
}

.adapter-contracts div {
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-raised);
}

.adapter-contracts strong {
  color: var(--text);
  font-size: 13px;
}

.adapter-contracts span {
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.45;
}

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

.policy-form textarea {
  min-height: 104px;
}

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

.check-option {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 38px;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-raised);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 700;
}

.check-option input {
  width: 15px;
  height: 15px;
  margin: 0;
  accent-color: var(--blue);
}

.scenario-list {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.scenario-card {
  position: relative;
  display: grid;
  gap: 6px;
  width: 100%;
  padding: 12px 74px 12px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-raised);
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.scenario-card.active {
  border-color: rgba(37, 99, 235, 0.45);
  background: var(--blue-soft);
  box-shadow: inset 3px 0 0 var(--blue);
}

.scenario-card span,
.scenario-card small {
  color: var(--text-secondary);
  font-size: 11px;
  line-height: 1.4;
}

.scenario-card strong {
  font-size: 13px;
}

.scenario-card .badge {
  position: absolute;
  top: 12px;
  right: 12px;
}

.code-card {
  margin: 14px;
  padding: 12px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-raised);
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.6;
}

.code-card pre {
  margin: 0;
  white-space: pre-wrap;
  font: inherit;
}

.quote-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 14px;
  border-bottom: 1px solid var(--divider);
}

.quote-summary div {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-raised);
}

.quote-summary span {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 780;
  text-transform: uppercase;
}

.quote-summary strong {
  overflow: hidden;
  color: var(--text);
  font-size: 18px;
  font-weight: 780;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.quote-summary small {
  overflow: hidden;
  color: var(--text-secondary);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.quote-history {
  display: grid;
  gap: 0;
}

.quote-history div:not(.empty-state) {
  display: grid;
  gap: 5px;
  padding: 13px 14px;
  border-bottom: 1px solid var(--divider);
}

.quote-history div:last-child {
  border-bottom: 0;
}

.quote-history strong {
  color: var(--text);
  font-size: 13px;
}

.quote-history span {
  color: var(--text-secondary);
  font-size: 12px;
}

.quote-history code {
  overflow: hidden;
  color: var(--text-muted);
  font-family: "JetBrains Mono", "IBM Plex Mono", ui-monospace, SFMono-Regular,
    Menlo, monospace;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.policy-checks.single {
  grid-template-columns: 1fr;
}

.policy-check {
  display: grid;
  gap: 9px;
  min-height: 112px;
  padding: 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-raised);
}

.policy-check.success {
  border-color: rgba(22, 163, 74, 0.24);
  background: #f0fdf4;
}

.policy-check.warning,
.policy-check.pending {
  border-color: rgba(217, 119, 6, 0.24);
  background: #fffbeb;
}

.policy-check.danger {
  border-color: rgba(220, 38, 38, 0.24);
  background: #fef2f2;
}

.policy-check strong {
  color: var(--text);
  font-size: 13px;
}

.policy-check span {
  display: block;
  margin-top: 5px;
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.45;
}

.policy-check code {
  overflow: hidden;
  color: var(--text-muted);
  font-family: "JetBrains Mono", "IBM Plex Mono", ui-monospace, SFMono-Regular,
    Menlo, monospace;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.review-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  padding: 14px;
  border-bottom: 1px solid var(--divider);
}

.review-summary div {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-raised);
}

.review-summary span {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 780;
  text-transform: uppercase;
}

.review-summary strong {
  color: var(--text);
  font-size: 22px;
  font-weight: 780;
}

.review-summary small {
  overflow: hidden;
  color: var(--text-secondary);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.score-cell {
  display: grid;
  gap: 6px;
  min-width: 88px;
}

.score-cell strong {
  color: var(--text);
  font-size: 13px;
}

.score-bar {
  display: block;
  width: 100%;
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: #e5e7eb;
}

.score-bar i {
  display: block;
  width: var(--score);
  height: 100%;
  border-radius: inherit;
  background: var(--blue);
}

.score-bar.success i {
  background: var(--green);
}

.score-bar.warning i {
  background: var(--amber);
}

.score-bar.danger i {
  background: var(--red);
}

.review-selected {
  display: grid;
  gap: 0;
}

.review-score {
  display: grid;
  gap: 6px;
  margin: 14px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-raised);
}

.review-score strong {
  color: var(--text);
  font-size: 32px;
  line-height: 1;
}

.review-score span {
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.45;
}

.review-checks {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  padding: 14px;
}

.review-check {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  min-height: 108px;
  padding: 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-raised);
}

.review-check.success {
  border-color: rgba(22, 163, 74, 0.24);
  background: #f0fdf4;
}

.review-check.warning {
  border-color: rgba(217, 119, 6, 0.24);
  background: #fffbeb;
}

.review-check.danger {
  border-color: rgba(220, 38, 38, 0.24);
  background: #fef2f2;
}

.review-check.pending {
  border-color: rgba(37, 99, 235, 0.24);
  background: #eff6ff;
}

.review-check strong {
  display: block;
  color: var(--text);
  font-size: 13px;
}

.review-check span:not(.badge) {
  display: block;
  margin-top: 5px;
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.45;
}

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

.link-button {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--blue);
  font: inherit;
  font-weight: 750;
}

.receipt-strip {
  position: fixed;
  right: 18px;
  bottom: 0;
  left: calc(var(--sidebar-width) + 18px);
  z-index: 18;
  display: grid;
  grid-template-columns: minmax(200px, 1.1fr) repeat(5, minmax(120px, 0.75fr)) auto;
  gap: 12px;
  min-height: var(--receipt-height);
  padding: 13px 14px;
  border: 1px solid var(--border);
  border-bottom: 0;
  border-radius: var(--radius) var(--radius) 0 0;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(12px);
}

.receipt-item {
  min-width: 0;
}

.receipt-label {
  display: block;
  margin-bottom: 5px;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 760;
  text-transform: uppercase;
}

.receipt-value {
  display: block;
  overflow: hidden;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mono {
  font-family: "JetBrains Mono", "IBM Plex Mono", ui-monospace, SFMono-Regular,
    Menlo, monospace;
}

.views {
  display: grid;
  gap: 14px;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.kpi-card {
  min-width: 0;
  padding: 13px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.kpi-card span {
  display: block;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 780;
  text-transform: uppercase;
}

.kpi-card strong {
  display: block;
  overflow: hidden;
  margin-top: 5px;
  color: var(--text);
  font-size: 20px;
  font-weight: 780;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.kpi-card small {
  display: block;
  overflow: hidden;
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.page-grid > *,
.workspace > * {
  min-width: 0;
}

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

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

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

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

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

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

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

.table th,
.table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--divider);
  color: var(--text-secondary);
  font-size: 13px;
  text-align: left;
  vertical-align: top;
}

.table th {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 780;
  text-transform: uppercase;
}

.table tr:last-child td {
  border-bottom: 0;
}

.page-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.page-title-row h1 {
  margin: 0;
  color: var(--text);
  font-size: 24px;
}

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

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

.settings-stack {
  display: grid;
  gap: 14px;
  padding: 14px;
}

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

.provider-card {
  display: grid;
  gap: 6px;
  min-height: 116px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-raised);
  color: inherit;
  text-align: left;
}

.provider-card:hover {
  border-color: rgba(37, 99, 235, 0.55);
  background: #f8fbff;
}

.provider-card strong {
  color: var(--text);
  font-size: 13px;
}

.provider-card span {
  overflow: hidden;
  color: var(--blue);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.provider-card small,
.help-text {
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.45;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.action-row.padded {
  padding: 0 14px 14px;
}

.filter-row,
.workspace-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 14px;
}

.workspace-tools {
  align-items: center;
}

.workspace-tools .help-text {
  flex: 1 1 360px;
}

.help-text {
  margin: 0;
}

.field {
  display: grid;
  gap: 6px;
}

.field label {
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 740;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 38px;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  outline: none;
}

.field textarea {
  min-height: 150px;
  resize: vertical;
  font-family: "JetBrains Mono", "IBM Plex Mono", ui-monospace, SFMono-Regular,
    Menlo, monospace;
  font-size: 12px;
  line-height: 1.45;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: rgba(37, 99, 235, 0.55);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

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

.modal {
  width: min(720px, 100%);
  max-height: calc(100vh - 36px);
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

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

.modal-head h2 {
  margin: 0;
  font-size: 18px;
}

.modal-body {
  padding: 16px;
}

.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 16px;
  border-top: 1px solid var(--divider);
}

.toast-stack {
  position: fixed;
  right: 18px;
  top: 78px;
  z-index: 60;
  display: grid;
  gap: 8px;
}

.toast {
  width: min(360px, calc(100vw - 36px));
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  color: var(--text-secondary);
  font-size: 13px;
}

.toast strong {
  display: block;
  margin-bottom: 2px;
  color: var(--text);
}

.empty-state {
  padding: 40px 18px;
  color: var(--text-muted);
  font-size: 14px;
  text-align: center;
}

.empty-state.compact {
  padding: 18px 14px;
  font-size: 12px;
}

.mobile-menu {
  display: none;
}

.mobile-view-switch {
  display: none;
}

@media (max-width: 1180px) {
  .segment {
    display: none;
  }

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

  .workspace {
    grid-template-columns: minmax(300px, 390px) minmax(430px, 1fr);
  }

  .inspector {
    grid-column: 1 / -1;
  }

  .inspector-scroll {
    max-height: none;
  }

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

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

@media (max-width: 900px) {
  .app-header {
    gap: 10px;
    padding-inline: 12px;
  }

  .brand {
    min-width: 0;
  }

  .brand small,
  .health,
  .header-actions .btn:not(.primary) {
    display: none;
  }

  .mobile-menu {
    display: inline-flex;
  }

  .mobile-view-switch {
    display: block;
    min-width: 132px;
  }

  .mobile-view-switch select {
    width: 100%;
    height: 36px;
    padding: 0 9px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    font-size: 12px;
    font-weight: 700;
  }

  .sidebar {
    display: none;
  }

  .main {
    padding: calc(var(--header-height) + 12px) 12px
      12px;
  }

  .workspace,
  .content-column,
  .page-grid {
    display: grid;
    grid-template-columns: 1fr;
  }

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

  .span-4,
  .span-3,
  .span-5,
  .span-6,
  .span-8,
  .span-12 {
    grid-column: span 1;
  }

  .queue-scroll {
    max-height: none;
  }

  .intent-top,
  .page-title-row {
    display: grid;
  }

  .amount-stack {
    text-align: left;
  }

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

  .matrix-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .settlement-row {
    grid-template-columns: 1fr;
    gap: 7px;
  }

  .settlement-check {
    width: fit-content;
  }

  .settlement-notes {
    grid-template-columns: 1fr;
  }

  .compliance-module {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .adapter-contracts {
    grid-template-columns: 1fr;
  }

  .review-summary,
  .two-col,
  .quote-summary,
  .policy-checks,
  .review-checks {
    grid-template-columns: 1fr;
  }

  .review-check {
    display: grid;
  }

  .receipt-strip {
    position: static;
    right: auto;
    bottom: auto;
    left: auto;
    grid-template-columns: 1fr 1fr;
    margin: 14px 12px 0;
    min-height: auto;
    max-height: 42vh;
    overflow: auto;
    border-bottom: 1px solid var(--border);
    border-radius: var(--radius);
  }

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

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

@media (max-width: 560px) {
  .search {
    display: none;
  }

  .mobile-view-switch {
    min-width: 118px;
  }

  .header-actions .btn.primary {
    width: 38px;
    padding: 0;
    font-size: 0;
  }

  .header-actions .btn.primary::before {
    content: "+";
    font-size: 18px;
    line-height: 1;
  }

  .intent-title {
    font-size: 21px;
  }

  .receipt-strip {
    grid-template-columns: 1fr;
  }

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

  .queue-actions {
    flex-wrap: wrap;
  }
}
