:root {
  --bg: #f4f7fb;
  --surface: #ffffff;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --line-strong: #cbd5e1;
  --primary: #1d4ed8;
  --primary-hover: #1e40af;
  --primary-soft: #eff6ff;
  --accent: #0ea5e9;
  --danger: #b91c1c;
  --danger-soft: #fef2f2;
  --success-soft: #ecfdf5;
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.06), 0 8px 24px rgba(15, 23, 42, 0.05);
  --radius: 10px;
  --radius-lg: 14px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  min-height: 100vh;
  color: var(--ink);
  font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.5;
  background: var(--bg);
  background-image: linear-gradient(180deg, #f8fafc 0%, var(--bg) 40%, #eef2f7 100%);
}
button, input, select { font: inherit; color: inherit; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.mark {
  width: 44px;
  height: 44px;
  position: relative;
  flex-shrink: 0;
}
.mark.small { width: 32px; height: 32px; }
.mark::before,
.mark::after {
  content: "";
  position: absolute;
  border-radius: 8px;
}
.mark::before {
  inset: 0;
  background: linear-gradient(145deg, #1d4ed8, #2563eb);
}
.mark::after {
  inset: 8px 0 0 8px;
  background: rgba(255, 255, 255, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 6px;
}
.mark.small::before { border-radius: 6px; }
.mark.small::after { inset: 6px 0 0 6px; border-radius: 4px; }

body.hold {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 20px;
}
.hold-card {
  width: min(440px, 100%);
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 48px 40px 40px;
}
.hold-card .mark { margin: 0 auto; }
.hold-card .lede { margin-left: auto; margin-right: auto; }
.sign-card { text-align: left; }
.sign-card .mark { margin: 0; }
.sign-card .lede { margin-left: 0; max-width: none; }
.sign-card .stack { text-align: left; }

.eyebrow {
  margin: 20px 0 0;
  color: var(--primary);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
h1 {
  margin: 10px 0 0;
  font-family: Inter, system-ui, sans-serif;
  font-weight: 700;
  font-size: clamp(2.5rem, 8vw, 3.25rem);
  letter-spacing: -0.03em;
  line-height: 1.1;
  color: var(--ink);
}
.sign-title { font-size: clamp(1.75rem, 5vw, 2.25rem); font-weight: 700; }
.lede {
  max-width: 32ch;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.55;
}
.stack { display: grid; gap: 10px; margin-top: 22px; }
label { font-weight: 600; font-size: 0.875rem; color: var(--ink); }
input, select {
  width: 100%;
  min-height: 46px;
  padding: 10px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus, select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}
.go, .ghost, .text {
  border: 0;
  cursor: pointer;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.9375rem;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.go {
  min-height: 46px;
  margin-top: 8px;
  color: #fff;
  background: var(--primary);
}
.go:hover { background: var(--primary-hover); }
.ghost {
  min-height: 38px;
  padding: 0 16px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  color: var(--ink);
}
.ghost:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-soft);
}
.text {
  padding: 0 4px;
  background: transparent;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.875rem;
}
.text:hover { color: var(--danger); }
.alert, .note {
  margin: 16px 0 0;
  padding: 12px 14px;
  border-radius: var(--radius);
  font-size: 0.9375rem;
  border: 1px solid transparent;
}
.alert {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: #fecaca;
}
.note {
  background: var(--success-soft);
  color: #047857;
  border-color: #a7f3d0;
}
.hint { margin: 0; color: var(--muted); font-size: 0.8125rem; line-height: 1.45; }

.desk { padding: 0 24px 56px; }
.wrap { width: min(1100px, 100%); margin: 0 auto; }
.top {
  position: sticky;
  top: 0;
  z-index: 4;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 16px 0;
  margin-bottom: 8px;
  background: rgba(244, 247, 251, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.brand:hover { text-decoration: none; color: var(--primary); }
.who { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.who span {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.who strong { font-weight: 600; font-size: 0.9375rem; }
.who form { margin: 0; }
.intro { margin-top: 8px; }
.intro h1 { font-size: clamp(1.75rem, 4vw, 2.25rem); margin-top: 6px; }
.intro p:last-child { max-width: 60ch; color: var(--muted); line-height: 1.6; margin-top: 12px; }
.intro-with-stat {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px;
  flex-wrap: wrap;
}
.intro-stat {
  margin: 0;
  text-align: right;
  font-size: 0.8125rem;
  color: var(--muted);
  line-height: 1.4;
}
.intro-stat-label {
  display: block;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 0.6875rem;
}
.intro-stat strong {
  display: block;
  margin-top: 4px;
  font-size: 1.0625rem;
  font-weight: 700;
  color: var(--ink);
}
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 24px; }
.panel, .person, .slip {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}
.panel { padding: 24px; }
.panel h2, .block h2, .person h3 {
  margin: 0;
  font-family: Inter, system-ui, sans-serif;
  font-weight: 700;
  font-size: 1.125rem;
  color: var(--ink);
}
.block { margin-top: 32px; }
.block-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.block-head h2 { font-size: 1.25rem; }
.person { padding: 20px; margin-bottom: 14px; }
.person-top, .actions, .nested-row, .order, .name-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.person-top p, .nested-row span, .name-list span, .order span, .order time {
  color: var(--muted);
  font-size: 0.875rem;
}
.person-top p, .nested-row span { margin: 4px 0 0; }
.person-top h3 { font-size: 1.05rem; }
.actions { flex-wrap: wrap; justify-content: flex-start; margin-top: 14px; }
.actions form, .inline { margin: 0; }
.inline { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.inline input, .inline select { min-height: 40px; flex: 1; min-width: 140px; }
.pill {
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border: 1px solid #bfdbfe;
}
.pill.paused {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: #fecaca;
}
.nested {
  display: grid;
  gap: 10px;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.nested-row {
  align-items: flex-start;
  padding: 14px;
  border-radius: var(--radius);
  background: #f8fafc;
  border: 1px solid var(--line);
  flex-wrap: wrap;
}
.name-list { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 0; }
.name-list li, .order {
  padding: 14px 0;
  border-top: 1px solid var(--line);
}
.name-list li:first-child, .order:first-child { border-top: 0; padding-top: 0; }
.empty {
  margin-top: 14px;
  padding: 32px 16px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: #f8fafc;
  font-size: 0.9375rem;
}
.order-list { margin-top: 8px; }
.order-list.scroll-x { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.supplier-orders {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
.order-table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 0.875rem;
}
.order-table .col-order { width: 7%; }
.order-table .col-amount { width: 11%; }
.order-table .col-due { width: 9%; }
.order-table .col-wallet { width: 28%; }
.order-table .col-customer { width: 28%; }
.order-table .col-status { width: 17%; }
.order-table thead th {
  text-align: left;
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  padding: 0 12px 10px;
  border-bottom: 2px solid var(--line-strong);
  white-space: nowrap;
}
.order-table thead th.order-col-customer,
.order-table tbody td.order-person,
.order-table thead th.order-col-status,
.order-table tbody td.order-status-cell {
  text-align: right;
}
.order-table thead th.order-col-status,
.order-table tbody td.order-status-cell {
  padding-right: 0;
}
.order-table tbody td {
  padding: 14px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.order-table tbody td.order-ref,
.order-table tbody td.order-amount {
  padding-left: 0;
}
.order-table tbody td.order-person {
  padding-right: 12px;
}
.order-table tbody tr:last-child td { border-bottom: 0; }
.order-row-paid td { color: #8b949e; }
.order-row-paid .order-num,
.order-row-paid .order-amt-main { color: #94a3b8; }
.order-num {
  font-weight: 700;
  color: var(--primary);
  white-space: nowrap;
}
.order-amount,
.order-due { white-space: nowrap; }
.order-due-main {
  font-weight: 700;
  color: var(--ink);
}
.order-row-paid .order-due-main { color: #94a3b8; }
.order-amt-main {
  display: block;
  font-weight: 700;
  color: var(--primary);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.order-amt-sub {
  display: block;
  margin-top: 4px;
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: 500;
  text-decoration: none;
}
.order-wallet code {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--ink);
  background: transparent;
  padding: 0;
  word-break: break-all;
}
.order-person {
  text-align: right;
  min-width: 160px;
}
.order-person-name {
  display: block;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.35;
}
.order-person-email,
.order-person-tx {
  display: block;
  margin-top: 4px;
  font-size: 0.75rem;
  color: var(--muted);
  line-height: 1.35;
  word-break: break-word;
}
.muted-dash { color: var(--muted); }
.order-status-cell { white-space: nowrap; }
.order-status-main {
  display: block;
  font-weight: 700;
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--ink);
  line-height: 1.35;
}
.order-row-paid .order-status-main { color: #94a3b8; }
.order-status {
  font-style: normal;
  font-weight: 600;
  color: var(--primary);
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.slip {
  margin-top: 16px;
  padding: 24px;
  color: #f8fafc;
  background: linear-gradient(135deg, #1e3a8a 0%, #1d4ed8 100%);
  border: none;
}
.slip .eyebrow { color: #93c5fd; }
.slip p { color: rgba(248, 250, 252, 0.85); margin: 8px 0 0; font-size: 0.9375rem; }
.slip h2 {
  margin: 6px 0 0;
  font-family: Inter, system-ui, sans-serif;
  font-weight: 700;
  font-size: 1.35rem;
  color: #fff;
}
.slip code {
  display: block;
  margin: 14px 0;
  padding: 12px 14px;
  overflow-wrap: anywhere;
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 0.8125rem;
  color: #e2e8f0;
}
.slip .ghost {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.08);
}
.slip .ghost:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: #fff;
  color: #fff;
}

.signin-url {
  margin-top: 16px;
  padding: 14px;
  border-radius: var(--radius);
  background: #f8fafc;
  border: 1px solid var(--line);
}
.signin-url code {
  display: block;
  margin: 8px 0 10px;
  padding: 10px 12px;
  font-size: 0.8125rem;
  overflow-wrap: anywhere;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink);
}
.signin-url .hint { margin: 0; }
.signin-url .hint strong { font-weight: 600; color: var(--ink); }

.intro-admin-link { margin-top: 12px; }
.section-fold { padding: 0; overflow: hidden; }
.section-fold + .section-fold { margin-top: 16px; }
.enduser-supplier-tag {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
  background: #f1f5f9;
  padding: 3px 8px;
  border-radius: 6px;
  flex-shrink: 0;
}
.fold { border: 0; margin: 0; }
.fold-title {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 24px;
  font-weight: 700;
  font-size: 1.125rem;
  color: var(--ink);
  user-select: none;
}
.fold-title::-webkit-details-marker { display: none; }
.fold-title::after {
  content: "";
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg);
  transition: transform 0.15s;
  flex-shrink: 0;
}
.fold[open] > .fold-title::after { transform: rotate(-135deg); }
.fold-title-label { flex-shrink: 0; }
.fold-title-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-left: auto;
  margin-right: 12px;
}
.fold-title-link { font-size: 0.875rem; white-space: nowrap; }
.fold-count {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--muted);
  background: #f1f5f9;
  padding: 2px 10px;
  border-radius: 999px;
  flex-shrink: 0;
}
.fold-body { padding: 0 24px 22px; border-top: 1px solid var(--line); }
.linkish {
  background: none;
  border: 0;
  padding: 0;
  color: var(--primary);
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  font-size: 0.9375rem;
}
.linkish:hover { color: var(--primary-hover); }
.supplier-acc { list-style: none; margin: 16px 0 0; padding: 0; display: grid; gap: 8px; }
.supplier-fold > .supplier-name {
  list-style: none;
  cursor: pointer;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f8fafc;
  font-weight: 600;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
}
.supplier-fold > .supplier-name::-webkit-details-marker { display: none; }
.supplier-fold > .supplier-name::before {
  content: "";
  width: 6px;
  height: 6px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(-45deg);
  flex-shrink: 0;
  margin-right: 2px;
}
.supplier-fold[open] > .supplier-name::before { transform: rotate(45deg); }
.supplier-summary-title { font-weight: 700; min-width: 120px; }
.supplier-summary-url {
  flex: 1 1 220px;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  justify-content: flex-start;
}
.summary-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  flex-shrink: 0;
}
.summary-status { flex-shrink: 0; }
.summary-form { margin: 0; display: inline-flex; }
.btn-create-new { white-space: nowrap; }
.icon-btn {
  width: 32px;
  min-height: 32px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
}
.icon-btn:hover { color: var(--danger); border-color: #fecaca; background: var(--danger-soft); }
.supplier-fold[open] .icon-btn:hover { color: var(--primary); background: var(--primary-soft); border-color: #bfdbfe; }
.url-preview {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: min(420px, 52vw);
  padding: 4px 8px;
  border-radius: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
}
.url-missing {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--muted);
  text-align: left;
}
.btn-mini {
  min-height: 32px;
  padding: 0 10px;
  font-size: 0.8125rem;
  flex-shrink: 0;
}
.pill-quiet {
  background: #f1f5f9;
  color: var(--muted);
  border-color: var(--line);
}
.supplier-detail { padding: 8px 4px 12px 20px; }
.supplier-detail > .detail-block { margin-top: 0; padding-top: 12px; border-top: 1px solid var(--line); }
.supplier-endusers-label { margin: 0 0 8px; font-weight: 600; color: var(--ink); }
.supplier-enduser-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.enduser-jump {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 8px 12px;
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--primary);
  cursor: pointer;
}
.enduser-jump:hover {
  background: var(--primary-soft);
  border-color: #bfdbfe;
}
.enduser-fold.enduser-focus > .enduser-name {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}
.detail-row { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.detail-label { font-size: 0.8125rem; font-weight: 600; color: var(--muted); min-width: 72px; }
.detail-block { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); }
.detail-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.detail-head h3 { margin: 0; font-size: 1rem; font-weight: 700; }
.enduser-acc { list-style: none; margin: 16px 0 0; padding: 0; display: grid; gap: 6px; }
.enduser-fold > .enduser-name {
  list-style: none;
  cursor: pointer;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  font-weight: 600;
}
.enduser-fold > .enduser-name::-webkit-details-marker { display: none; }
.enduser-fold > .enduser-name::before {
  content: "";
  width: 5px;
  height: 5px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(-45deg);
  flex-shrink: 0;
}
.enduser-fold[open] > .enduser-name::before { transform: rotate(45deg); }
.enduser-summary-title { font-weight: 700; min-width: 100px; }
.enduser-summary-url { flex: 1 1 200px; }
.enduser-detail { padding: 10px 8px 10px 20px; }
.enduser-move { margin: 0; align-items: center; }
.enduser-move .detail-label { margin: 0; min-width: auto; font-size: 0.8125rem; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal[hidden] { display: none; }
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
}
.modal-card {
  position: relative;
  width: min(440px, 100%);
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.18);
  padding: 24px;
}
.modal-card h2 { margin: 0; font-size: 1.25rem; }
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 8px;
}
.modal-actions .go { margin-top: 0; min-height: 42px; width: auto; padding: 0 20px; }
body.modal-open { overflow: hidden; }
.slip .hint { margin-top: 12px; }

@media (max-width: 800px) {
  .split, .who, .top, .block-head, .inline { display: grid; }
  .who { justify-items: start; }
  .hold-card { padding: 36px 24px; }
  .supplier-summary-url,
  .enduser-summary-url {
    flex: 1 1 100%;
    margin-left: 18px;
  }
  .summary-status {
    margin-left: 18px;
  }
  .url-preview { max-width: 100%; }
}