:root {
  color-scheme: light;
  --bg: #f6f8f7;
  --panel: #ffffff;
  --ink: #111815;
  --muted: #5e6a64;
  --line: #dce4df;
  --green: #0e7a4f;
  --green-strong: #095f3c;
  --green-soft: #e5f4ee;
  --red: #b42318;
  --amber: #9a6700;
  --shadow: 0 18px 50px rgba(17, 24, 21, 0.08);
}

* {
  box-sizing: border-box;
}

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

button {
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
}

.shell {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
}

.payment-panel {
  width: min(760px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 28px;
}

.topbar,
.dialog-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

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

h1,
h2,
p,
dl {
  margin: 0;
}

h1 {
  font-size: clamp(30px, 5vw, 48px);
  line-height: 1.02;
}

h2 {
  font-size: 22px;
}

.voice-toggle {
  flex: 0 0 auto;
  background: var(--green-soft);
  color: var(--green-strong);
  padding: 10px 14px;
}

.status {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 26px 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fbfdfc;
}

.status-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 5px var(--green-soft);
}

.status[data-state="failed"] .status-dot,
.status[data-state="cancelled"] .status-dot {
  background: var(--red);
  box-shadow: 0 0 0 5px #fde8e7;
}

.status[data-state="pending"] .status-dot,
.status[data-state="processing"] .status-dot {
  background: var(--amber);
  box-shadow: 0 0 0 5px #fff4d6;
}

.status p {
  margin-top: 3px;
  color: var(--muted);
}

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

.details-grid div,
.line-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

dt,
.line-label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}

dd {
  margin: 6px 0 0;
  font-size: 18px;
  font-weight: 800;
}

.monthly-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-top: 18px;
  border: 1px solid var(--green);
  border-radius: 8px;
  background: var(--green-soft);
  padding: 18px;
}

.monthly-summary strong {
  display: block;
  font-size: 28px;
  line-height: 1.1;
}

.monthly-summary span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-weight: 700;
}

.total-pay {
  min-height: 62px;
  min-width: 190px;
  background: var(--green);
  color: #fff;
  font-size: 20px;
  padding: 0 24px;
}

.line-items,
.bill-list {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.line-row,
.bill-card {
  display: flex;
  justify-content: space-between;
  gap: 14px;
}

.bill-card {
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}

.bill-main {
  min-width: 0;
}

.bill-main h3 {
  margin: 0;
  font-size: 18px;
}

.bill-main p {
  margin-top: 5px;
  color: var(--muted);
}

.bill-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.pill {
  border-radius: 999px;
  background: #eef2ef;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  padding: 6px 9px;
  text-transform: capitalize;
}

.pill.payable {
  background: var(--green-soft);
  color: var(--green-strong);
}

.pill.warning {
  background: #fff4d6;
  color: var(--amber);
}

.bill-action {
  flex: 0 0 auto;
  min-height: 54px;
  padding: 0 14px;
  background: var(--green);
  color: #fff;
}

.bill-action[disabled],
.total-pay[disabled] {
  cursor: not-allowed;
  opacity: 0.55;
}

.line-amount {
  flex: 0 0 auto;
  font-weight: 800;
}

.actions {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 12px;
  margin-top: 24px;
}

.primary,
.secondary {
  min-height: 48px;
  padding: 0 18px;
}

.primary {
  background: var(--green);
  color: white;
}

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

.secondary {
  border: 1px solid var(--line);
  background: white;
  color: var(--ink);
}

.compact {
  min-height: 38px;
  padding: 0 12px;
}

.history-section {
  margin-top: 26px;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.history-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.history-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

.history-item strong {
  display: block;
}

.history-item p {
  margin-top: 5px;
  color: var(--muted);
}

.empty {
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  padding: 14px;
}

.security-note {
  margin-top: 16px;
  color: var(--muted);
  font-size: 14px;
}

dialog {
  width: min(620px, calc(100% - 32px));
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0;
}

dialog::backdrop {
  background: rgba(17, 24, 21, 0.42);
}

.dialog-body {
  padding: 22px;
}

.dialog-header button {
  width: 34px;
  height: 34px;
  background: #eef2ef;
}

.dialog-section {
  border-top: 1px solid var(--line);
  margin-top: 18px;
  padding-top: 18px;
}

.dialog-section p {
  margin-top: 8px;
  color: var(--muted);
}

.full-width {
  margin-top: 18px;
  width: 100%;
}

@media (max-width: 680px) {
  .shell {
    padding: 12px;
    place-items: stretch;
  }

  .payment-panel {
    padding: 20px;
  }

  .details-grid,
  .actions,
  .monthly-summary,
  .bill-card {
    grid-template-columns: 1fr;
  }

  .monthly-summary {
    align-items: stretch;
    flex-direction: column;
  }

  .total-pay {
    width: 100%;
  }

  .bill-card {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar {
    align-items: stretch;
    flex-direction: column;
  }
}
