:root {
  color-scheme: light;
  --bg: #f3f5f8;
  --surface: #ffffff;
  --surface-subtle: #f8fafc;
  --ink: #101828;
  --muted: #667085;
  --line: #e4e7ec;
  --line-strong: #d0d5dd;
  --primary: #175cd3;
  --primary-dark: #1849a9;
  --success: #067647;
  --warning: #b54708;
  --danger: #b42318;
  --soft-blue: #eff4ff;
  --soft-green: #ecfdf3;
  --soft-yellow: #fffaeb;
  --soft-red: #fef3f2;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.5;
}

a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; }

.shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 18px 0 36px;
}

.topbar,
.hero,
.panel,
.notice {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.topbar {
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 10px 16px;
  margin-bottom: 16px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}

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

.brand-mark {
  width: 48px;
  height: 38px;
  display: grid;
  place-items: center;
}

.brand img {
  max-width: 48px;
  max-height: 34px;
  object-fit: contain;
}

.brand > span:last-child {
  display: grid;
  gap: 1px;
}

.brand b { font-size: 16px; }
.brand small { color: var(--muted); font-size: 12px; }

.topbar nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.topbar nav a,
.link-btn,
.secondary {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: #344054;
  padding: 0 14px;
  border-radius: 7px;
  font-weight: 700;
}

.topbar nav a:hover,
.link-btn:hover,
.secondary:hover { background: var(--surface-subtle); }

.topbar nav .nav-primary {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(390px, 0.8fr);
  gap: 44px;
  align-items: center;
  padding: 32px;
  margin-bottom: 16px;
  border-top: 3px solid var(--primary);
}

.hero-copy { max-width: 620px; }

.eyebrow,
.label {
  display: block;
  margin: 0 0 7px;
  color: #475467;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

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

h1 {
  font-size: 30px;
  line-height: 1.2;
  margin-bottom: 9px;
  letter-spacing: 0;
}

h2 { font-size: 19px; margin-bottom: 10px; }
h3 { font-size: 15px; margin-bottom: 3px; }
.muted { color: var(--muted); }

.trust-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin-top: 20px;
  color: #475467;
  font-size: 12px;
  font-weight: 700;
}

.trust-row span::before {
  content: "";
  width: 7px;
  height: 7px;
  display: inline-block;
  margin-right: 7px;
  border-radius: 50%;
  background: var(--success);
}

.search {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-subtle);
}

.search label,
.pay-form label {
  display: block;
  font-weight: 700;
  margin-bottom: 8px;
  color: #344054;
}

.search small {
  display: block;
  margin-top: 9px;
  color: var(--muted);
}

.search-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

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

input:focus,
select:focus {
  border-color: #84adff;
  box-shadow: 0 0 0 3px rgba(23, 92, 211, 0.1);
}

button,
.primary {
  min-height: 44px;
  border: 1px solid var(--primary);
  border-radius: 7px;
  padding: 0 16px;
  background: var(--primary);
  color: #fff;
  font-weight: 800;
  cursor: pointer;
}

button:hover,
.primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }

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

.summary-grid,
.detail-grid {
  grid-template-columns: minmax(0, 1fr) 310px;
  margin-bottom: 14px;
}

.pay-grid { grid-template-columns: minmax(0, 1.2fr) minmax(340px, 0.8fr); }
.panel { padding: 20px; }

.amount-panel {
  display: grid;
  align-content: center;
  gap: 5px;
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}

.amount-panel .label,
.amount-panel small { color: #d0d5dd; }
.amount-panel strong { font-size: 30px; line-height: 1.2; }

.settled-note,
.security-note {
  width: fit-content;
  margin-top: 6px;
  padding: 5px 9px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
}

.kv {
  display: grid;
  gap: 0;
  margin: 0;
}

.kv div {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid #f0f2f5;
}

.kv dt,
.kv dd { margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { font-weight: 700; overflow-wrap: anywhere; }

.section-head,
.invoice-main,
.invoice-actions,
.items div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.invoice-section { padding: 0; overflow: hidden; }
.invoice-section > .section-head { padding: 18px 20px; border-bottom: 1px solid var(--line); }
.invoice-section > .invoice-list { padding: 12px; }

.invoice-list { display: grid; gap: 9px; }

.invoice-card {
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 14px;
  background: #fff;
}

.invoice-card:hover { border-color: #b2ccff; }

.invoice-main {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 150px 170px;
}

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

.invoice-icon {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  flex: 0 0 40px;
  border-radius: 7px;
  background: var(--soft-blue);
  color: var(--primary);
  font-size: 10px;
  font-weight: 900;
}

.invoice-meta {
  display: grid;
  gap: 2px;
  color: var(--muted);
  font-size: 12px;
}

.invoice-meta b { color: var(--ink); font-size: 13px; }

.invoice-total {
  display: grid;
  justify-items: end;
  gap: 6px;
}

.invoice-total strong { font-size: 19px; }

.badge {
  min-height: 25px;
  display: inline-flex;
  align-items: center;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  text-transform: capitalize;
}

.is-paid { background: var(--soft-green); color: var(--success); }
.is-pending, .is-due { background: var(--soft-yellow); color: var(--warning); }
.is-muted { background: var(--soft-red); color: var(--danger); }

.items {
  display: grid;
  gap: 7px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #f0f2f5;
}

.items div { align-items: flex-start; }
.items span { display: grid; gap: 2px; color: #344054; }
.items small { color: var(--muted); }
.items b { white-space: nowrap; }
.items.large { gap: 0; }
.items.large div { padding: 12px 0; border-bottom: 1px solid #f0f2f5; }

.invoice-actions {
  justify-content: flex-end;
  margin-top: 12px;
}

.primary,
.secondary,
.link-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.notice {
  padding: 13px 15px;
  margin-bottom: 14px;
  font-weight: 700;
}

.notice.is-warning { background: var(--soft-yellow); color: var(--warning); }
.notice.is-success { background: var(--soft-green); color: var(--success); }

.empty-state {
  margin: 20px;
  padding: 34px 20px;
  border: 1px dashed var(--line-strong);
  border-radius: 7px;
  text-align: center;
  color: var(--muted);
  background: var(--surface-subtle);
}

.empty-state b { display: block; margin-bottom: 5px; color: var(--ink); }
.empty-state p { margin: 0; }

.bank-info {
  white-space: pre-wrap;
  background: var(--surface-subtle);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 14px;
  color: #344054;
  font: inherit;
  line-height: 1.6;
}

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

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 20px 4px 0;
  color: var(--muted);
  font-size: 12px;
}

.site-footer > div { display: grid; gap: 3px; }
.footer-links { display: flex !important; flex-wrap: wrap; justify-content: flex-end; gap: 8px 16px !important; }
.footer-links a:hover { color: var(--primary); }

@media (max-width: 840px) {
  .shell { width: min(100% - 18px, 1180px); padding-top: 9px; }
  .topbar { align-items: flex-start; }
  .topbar,
  .section-head,
  .site-footer { flex-direction: column; }
  .topbar nav { width: 100%; }
  .topbar nav a { flex: 1; }
  .hero,
  .summary-grid,
  .detail-grid,
  .pay-grid,
  .invoice-main { grid-template-columns: 1fr; }
  .hero { gap: 22px; padding: 22px; }
  h1 { font-size: 26px; }
  .invoice-main { align-items: start; }
  .invoice-total { justify-items: start; }
  .invoice-actions { justify-content: stretch; }
  .invoice-actions a { flex: 1; }
  .footer-links { justify-content: flex-start; }
}

@media (max-width: 520px) {
  .search-row { grid-template-columns: 1fr; }
  .trust-row { display: grid; }
  .kv div { grid-template-columns: 1fr; gap: 3px; }
  .panel { padding: 16px; }
  .invoice-section > .section-head { padding: 16px; }
  .invoice-section > .invoice-list { padding: 8px; }
  .invoice-actions { flex-direction: column; }
  .invoice-actions a { width: 100%; }
}
