:root {
  color-scheme: light;
  --ink: #172026;
  --muted: #66727c;
  --line: #d9e1e6;
  --surface: #ffffff;
  --soft: #f5f7f8;
  --accent: #006b5f;
  --accent-strong: #004b45;
  --warn: #b54708;
  --danger: #b42318;
  --blue: #1d5b9f;
  --shadow: 0 18px 50px rgba(24, 39, 50, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--soft);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
select {
  font: inherit;
}

button {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  border-radius: 6px;
  padding: 10px 12px;
  cursor: pointer;
}

button:hover {
  border-color: var(--accent);
}

select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
  background: var(--surface);
  color: var(--ink);
}

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding: 28px 32px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.topbar h1,
.panel-heading h2 {
  margin: 0;
  letter-spacing: 0;
}

.topbar h1 {
  font-size: clamp(28px, 4vw, 46px);
  line-height: 1;
}

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

.status-stack {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 6px 10px;
  border: 1px solid rgba(0, 107, 95, 0.28);
  border-radius: 999px;
  background: #e7f5f2;
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 700;
}

.status-pill.unavailable {
  border-color: rgba(180, 35, 24, 0.25);
  background: #fff1ef;
  color: var(--danger);
}

.status-pill.razorpay {
  border-color: rgba(29, 91, 159, 0.22);
  background: #edf5ff;
  color: var(--blue);
}

.app-shell {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 24px;
}

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

.metric,
.queue-panel,
.detail-panel,
.agent-panel,
.tools-section,
.audit-section {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.metric {
  min-height: 124px;
  padding: 18px;
}

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

.metric strong {
  display: block;
  margin: 10px 0 4px;
  font-size: clamp(24px, 3vw, 34px);
  line-height: 1;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(300px, 0.95fr) minmax(420px, 1.35fr) minmax(300px, 0.9fr);
  gap: 16px;
  margin-top: 16px;
  align-items: start;
}

.queue-panel,
.detail-panel,
.agent-panel,
.tools-section,
.audit-section {
  padding: 16px;
}

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

.panel-heading.compact {
  align-items: flex-start;
}

.panel-heading h2 {
  font-size: 20px;
}

.payment-list {
  display: grid;
  gap: 10px;
}

.payment-card {
  width: 100%;
  display: block;
  text-align: left;
  padding: 14px;
}

.payment-card.active {
  border-color: var(--accent);
  box-shadow: inset 3px 0 0 var(--accent);
}

.payment-card strong,
.detail-title strong {
  display: block;
  margin-bottom: 5px;
}

.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.muted {
  color: var(--muted);
}

.tag {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.tag.danger {
  background: #fff1ef;
  color: var(--danger);
}

.tag.warn {
  background: #fff7ed;
  color: var(--warn);
}

.tag.ok {
  background: #e7f5f2;
  color: var(--accent-strong);
}

.detail-card {
  display: grid;
  gap: 16px;
}

.detail-title {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 14px;
}

.detail-title h2 {
  margin: 0 0 6px;
  font-size: 26px;
  letter-spacing: 0;
}

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

.detail-item {
  min-height: 82px;
  padding: 12px;
  background: var(--soft);
  border-radius: 8px;
}

.detail-item span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.detail-item strong {
  display: block;
  margin-top: 6px;
  font-size: 18px;
}

.rule-box {
  padding: 14px;
  border-left: 4px solid var(--accent);
  background: #f0faf7;
  border-radius: 6px;
}

.rule-box p {
  margin: 0;
}

.field {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-weight: 700;
  margin-bottom: 12px;
}

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

.button-grid button:first-child {
  grid-column: 1 / -1;
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.button-grid button[data-action="pay"] {
  border-color: rgba(29, 91, 159, 0.35);
  background: #edf5ff;
  color: var(--blue);
}

.razorpay-box {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid rgba(29, 91, 159, 0.22);
  background: #f4f8ff;
  border-radius: 8px;
}

.razorpay-box code {
  display: block;
  overflow-wrap: anywhere;
  color: var(--blue);
}

.agent-output {
  min-height: 210px;
  margin-top: 12px;
  padding: 14px;
  background: #101820;
  color: #eff8f6;
  border-radius: 8px;
  white-space: pre-wrap;
  line-height: 1.5;
  overflow: auto;
}

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

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

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

.tool-card {
  min-height: 116px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
}

.tool-card h3 {
  margin: 0 0 8px;
  font-size: 16px;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.tool-card p {
  margin: 0 0 12px;
  color: var(--muted);
  line-height: 1.45;
}

.audit-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 22px;
}

.audit-list li {
  padding: 10px 12px;
  background: var(--soft);
  border-radius: 6px;
}

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

  .detail-panel {
    grid-column: 1 / -1;
    order: -1;
  }
}

@media (max-width: 760px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
    padding: 22px 18px;
  }

  .status-stack {
    justify-content: flex-start;
  }

  .app-shell {
    padding: 14px;
  }

  .summary-grid,
  .workspace,
  .tool-grid,
  .detail-grid {
    grid-template-columns: 1fr;
  }

  .detail-panel {
    grid-column: auto;
  }
}
