/* ==========================================================================
   Minvoice — "Ledger"
   Fine accounting stationery: warm paper, ink, hunter green, hairline rules,
   tabular numerals. Fraunces (display) + Instrument Sans (UI).
   ========================================================================== */

/* Local delivery uses system fonts. No external font request is required. */
/* --------------------------------------------------------------------------
   Merchant workspace — CityGo-inspired information architecture
   -------------------------------------------------------------------------- */

.admin-workspace {
  margin: 0;
  min-height: 100vh;
  background: #f4f5f7;
  color: #171a1f;
  color-scheme: light;
  --paper: #f4f5f7;
  --paper-deep: #f8f9fa;
  --surface: #ffffff;
  --ink: #171a1f;
  --ink-soft: #6f757d;
  --ink-faint: #858b94;
  --line: #e7e8eb;
  --line-strong: #d8dadd;
  --green: #1d7b46;
  --green-deep: #145f35;
  --green-tint: #edf7f0;
  --green-line: #d5e9db;
  --amber: #936b08;
  --amber-tint: #fff7df;
  --amber-line: #ead48c;
  --rust: #a8402a;
  --rust-deep: #7c2f1e;
  --rust-tint: #f7e9e4;
  --rust-line: #e6c6ba;
  --stone: #6b655a;
  --stone-tint: #edeae2;
  --stone-line: #ddd8cc;
  --on-accent: #fff;
}

.admin-workspace .admin-shell {
  min-height: 100vh;
}

.admin-workspace .site-header {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 60;
  width: 248px;
  height: 100vh;
  padding: 26px 18px 20px;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, #181d25 0%, #11151c 100%);
  border: 0;
  box-shadow: none;
  color: #fff;
}

.admin-workspace .site-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 54px;
  padding: 0 8px;
  color: #fff;
  text-decoration: none;
}

.admin-workspace .site-brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  flex: 0 0 44px;
  background: linear-gradient(135deg, #ffd96a, #f6ba2e);
  color: #171a1f;
  font: 800 20px/1 "Instrument Sans", sans-serif;
  box-shadow: 0 8px 24px rgba(246, 186, 46, 0.22);
}

.admin-workspace .site-brand > span:last-child { display: grid; gap: 2px; }
.admin-workspace .site-brand strong { font-size: 16px; letter-spacing: .02em; }
.admin-workspace .site-brand small { font-size: 9px; letter-spacing: .15em; color: #858d9b; }

.admin-workspace .site-nav {
  position: static;
  inset: auto;
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin: 42px 0 24px;
  flex: 1;
  background: transparent;
  border: 0;
  box-shadow: none;
}

.admin-workspace .nav-section-label {
  margin: 0 13px 8px;
  color: #68717f;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .16em;
}

.admin-workspace .site-nav a {
  position: relative;
  display: flex;
  align-items: center;
  gap: 13px;
  min-height: 46px;
  padding: 7px 12px;
  border-radius: 12px;
  color: #aeb5c0;
  text-decoration: none;
  font-size: 14px;
  font-weight: 650;
  border: 1px solid transparent;
}

.admin-workspace .site-nav a:hover {
  background: rgba(255,255,255,.05);
  color: #fff;
}

.admin-workspace .site-nav a.active {
  color: #ffcf54;
  background: rgba(255, 207, 84, .11);
  border-color: rgba(255, 207, 84, .08);
}

.admin-workspace .site-nav a.active::before {
  content: "";
  position: absolute;
  left: -19px;
  width: 4px;
  height: 25px;
  border-radius: 0 8px 8px 0;
  background: #ffca3d;
}

.admin-workspace .nav-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  flex: 0 0 28px;
  color: inherit;
  background: rgba(255,255,255,.055);
  font-size: 12px;
  font-weight: 800;
}

.admin-workspace .site-nav a.active .nav-icon { background: rgba(255, 207, 84, .13); }

.sidebar-account {
  display: grid;
  grid-template-columns: 38px 1fr 28px;
  align-items: center;
  gap: 10px;
  padding: 14px 10px 4px;
  border-top: 1px solid rgba(255,255,255,.08);
}

.sidebar-avatar {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #2a323e;
  color: #ffce51;
  font-size: 12px;
  font-weight: 800;
}

.sidebar-account > span:nth-child(2) { display: grid; gap: 2px; min-width: 0; }
.sidebar-account small { color: #7f8794; font-size: 10px; }
.sidebar-account strong { color: #e8ebef; font-size: 12px; }
.sidebar-account .logout { color: #7f8794; text-decoration: none; text-align: center; }
.sidebar-account .logout:hover { color: #ffce51; }

.admin-content {
  min-height: 100vh;
  margin-left: 248px;
}

.admin-topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  min-height: 76px;
  padding: 14px clamp(24px, 4vw, 58px);
  display: flex;
  align-items: center;
  gap: 16px;
  background: rgba(244,245,247,.92);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(21, 27, 35, .06);
}

.admin-topbar-copy { display: grid; gap: 2px; }
.admin-topbar-copy strong { font-size: 14px; }
.admin-topbar-copy small { color: #8c929b; font-size: 11px; }
.admin-topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.environment-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 11px;
  border: 1px solid #d9e7dc;
  border-radius: 999px;
  background: #f2faf4;
  color: #267441;
  font-size: 11px;
  font-weight: 750;
}
.environment-pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: #36a05c; }

.admin-workspace .nav-toggle { display: none; }

.admin-page {
  width: min(100%, 1400px);
  margin: 0 auto;
  padding: 34px clamp(24px, 4vw, 58px) 70px;
}

.admin-workspace .card,
.admin-workspace .empty-state,
.admin-workspace .table {
  border-color: #e7e8eb;
  box-shadow: 0 9px 30px rgba(27, 31, 37, .045);
}

.workspace-page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 22px;
  margin-bottom: 25px;
}

.workspace-page-head h1 { margin: 4px 0 6px; }
.eyebrow {
  color: #a57a0c;
  font-size: 10px;
  font-weight: 850;
  letter-spacing: .16em;
}

.admin-workspace .btn-primary {
  border-color: #f4bd31;
  background: linear-gradient(135deg, #ffd45b, #f8c33c);
  color: #1c2025;
  box-shadow: 0 7px 18px rgba(232, 173, 25, .18);
}
.admin-workspace .btn-primary:hover { background: linear-gradient(135deg, #ffdc76, #facb50); transform: translateY(-1px); }
.admin-workspace .btn-lg { min-height: 54px; padding-inline: 22px; font-size: 15px; }

.workspace-form-card { margin-bottom: 24px; padding: clamp(20px, 3vw, 32px); background: #fffdf7; border-color: #f0e6c8 !important; }
.workspace-form-card[hidden] { display: none; }
.card-section-head { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.card-section-head h2 { margin: 4px 0 0; font-size: 20px; }
.step-chip { display: inline-flex; padding: 4px 7px; border-radius: 6px; background: #fff0bd; color: #956b00; font-size: 9px; font-weight: 850; letter-spacing: .1em; }
.icon-button { width: 34px; height: 34px; border: 1px solid #e5e6e8; border-radius: 10px; background: #fff; color: #656b73; font-size: 20px; cursor: pointer; }
.form-row-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.merchant-card-grid,
.product-card-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.merchant-card,
.product-admin-card {
  min-width: 0;
  border: 1px solid #e5e7ea;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 9px 30px rgba(27, 31, 37, .045);
}

.merchant-card { padding: 22px; display: flex; flex-direction: column; gap: 17px; }
.merchant-card.is-inactive, .product-admin-card.is-inactive { opacity: .64; }
.merchant-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.workspace-avatar { width: 96px; height: 54px; padding: 7px; object-fit: contain; background: #fff; border-radius: 15px; border: 1px solid #e7e8ea; }
.workspace-avatar-fallback { display: grid; place-items: center; border: 0; background: #19251f; color: #fff; font-size: 18px; font-weight: 800; }
.merchant-card h2, .product-admin-card h2 { margin: 0 0 5px; font-size: 18px; }
.merchant-card p { margin: 0; color: #7e848d; font-size: 13px; }
.merchant-description { min-height: 39px; line-height: 1.5; }
.merchant-meta { margin: 0; padding: 14px 0; display: grid; gap: 9px; border-block: 1px solid #f0f1f2; }
.merchant-meta div { display: flex; justify-content: space-between; gap: 14px; font-size: 12px; }
.merchant-meta dt { color: #969ba3; }
.merchant-meta dd { margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.merchant-rating { margin: 0; color: #8a6808; font-size: 12px; }
.merchant-rating strong { color: #725400; }
.merchant-card-actions, .product-admin-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; }
.merchant-card-actions form, .product-admin-actions form { margin: 0; }

.catalog-toolbar { margin-bottom: 20px; padding: 14px 18px; display: flex; justify-content: space-between; align-items: center; gap: 20px; }
.catalog-toolbar > div { display: flex; align-items: baseline; gap: 7px; }
.catalog-toolbar > div strong { font-size: 24px; }
.catalog-toolbar > div span { color: #8a9098; font-size: 12px; }
.catalog-toolbar form { display: flex; align-items: center; gap: 10px; margin: 0; }
.catalog-toolbar label { margin: 0; color: #737981; font-size: 12px; }
.catalog-toolbar select { min-width: 180px; }

.product-admin-card { overflow: hidden; display: flex; flex-direction: column; }
.product-admin-image { position: relative; aspect-ratio: 16 / 9; display: grid; place-items: center; background: linear-gradient(135deg, #f4f5f6, #e9ecef); color: #a1a7ae; font-size: 30px; }
.product-admin-image img { width: 100%; height: 100%; object-fit: cover; }
.product-admin-image.image-load-failed img { display: none; }
.image-placeholder { font-size: 0.8rem; color: #7b858d; letter-spacing: .04em; }
.product-admin-image .badge { position: absolute; top: 12px; right: 12px; }
.product-admin-image .product-popular-badge { right: auto; left: 12px; color: #7b5400; background: #fff0bd; border-color: #f1d67d; }
.product-admin-copy { padding: 18px 20px 14px; display: grid; gap: 8px; }
.product-admin-copy small { color: #a37b17; font-weight: 700; }
.product-admin-copy p { min-height: 40px; margin: 0; color: #828891; font-size: 12px; line-height: 1.55; }
.product-admin-copy > strong { color: #188147; font-size: 21px; }
.product-admin-actions { padding: 0 20px 20px; }

.check-row { display: flex; align-items: flex-start; gap: 11px; padding: 14px; border: 1px solid #e7e8eb; border-radius: 12px; background: #fff; }
.check-row input { margin-top: 3px; }
.check-row span { display: grid; gap: 3px; }
.check-row small { color: #858b94; font-weight: 400; }

.link-builder-layout { display: grid; grid-template-columns: minmax(0, 1fr) 310px; gap: 22px; align-items: start; }
.link-builder-main { display: grid; gap: 18px; }
.builder-step { padding: clamp(22px, 3vw, 32px); }
.builder-step-head { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 24px; }
.builder-step-head > span { width: 32px; height: 32px; flex: 0 0 32px; display: grid; place-items: center; border-radius: 10px; background: #1b2028; color: #ffcd4a; font-weight: 800; }
.builder-step-head h2 { margin: 0 0 4px; font-size: 20px; }
.builder-step-head p { margin: 0; color: #868c94; font-size: 12px; }
.builder-product-preview { min-height: 92px; padding: 13px; display: flex; align-items: center; gap: 15px; border: 1px solid #e7e8eb; border-radius: 14px; background: #f8f9fa; }
.builder-preview-image { width: 66px; height: 66px; display: grid; place-items: center; overflow: hidden; flex: 0 0 66px; border-radius: 11px; background: #e9ecef; color: #8e949c; font-weight: 800; }
.builder-preview-image img { width: 100%; height: 100%; object-fit: cover; }
.builder-preview-image.image-load-failed img { display: none; }
.builder-preview-image.image-load-failed::after { content: '暂无图片'; font-size: 0.7rem; font-weight: 600; }
.builder-product-preview > div:last-child { display: grid; gap: 3px; }
.builder-product-preview small { color: #999ea5; }
.builder-product-preview strong { font-size: 16px; }
.builder-product-preview span { color: #178147; font-weight: 800; }
.provider-picker { margin: 0 0 20px; padding: 0; border: 0; }
.provider-picker legend { margin-bottom: 3px; font-size: 13px; font-weight: 750; }
.provider-picker > p { margin: 0 0 12px; color: #8a9098; font-size: 11px; }
.provider-picker-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.provider-pick { position: relative; min-height: 74px; padding: 12px; display: grid; grid-template-columns: 18px 38px 1fr; align-items: center; gap: 10px; border: 1px solid #e0e2e5; border-radius: 13px; background: #fff; cursor: pointer; }
.provider-pick:has(input:checked) { border-color: #e7bd4d; background: #fffaf0; box-shadow: 0 0 0 3px rgba(238, 190, 66, .09); }
.provider-pick.is-disabled { opacity: .48; cursor: not-allowed; background: #f1f2f3; }
.provider-pick input { margin: 0; }
.provider-pick-icon { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 11px; background: #fff1c9; color: #835e00; font-size: 11px; font-weight: 850; }
.provider-pick > span:last-child { display: grid; gap: 3px; }
.provider-pick strong { font-size: 13px; }
.provider-pick small { color: #8c929a; font-size: 10px; font-weight: 400; line-height: 1.35; }
.builder-submit { width: 100%; justify-content: space-between; }
.link-builder-help { position: sticky; top: 98px; }
.link-builder-help .card { padding: 27px; background: linear-gradient(150deg, #1b2420, #101612); color: #fff; border: 0; }
.secure-orb { width: 48px; height: 48px; display: grid; place-items: center; border-radius: 50%; background: #e7f7eb; color: #238849; font-size: 20px; font-weight: 800; }
.link-builder-help h2 { margin: 20px 0 8px; }
.link-builder-help p { color: #adb7b0; font-size: 12px; line-height: 1.6; }
.link-builder-help ul { margin: 20px 0 0; padding: 18px 0 0; display: grid; gap: 12px; border-top: 1px solid rgba(255,255,255,.1); list-style: none; }
.link-builder-help li { position: relative; padding-left: 18px; color: #d8ded9; font-size: 11px; }
.link-builder-help li::before { content: "✓"; position: absolute; left: 0; color: #6fcb8a; }

.workspace-stat-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 15px; margin-bottom: 18px; }
.workspace-stat { position: relative; overflow: hidden; min-height: 126px; padding: 20px; display: grid; align-content: space-between; }
.workspace-stat::after { content: ""; position: absolute; right: -24px; bottom: -30px; width: 90px; height: 90px; border-radius: 50%; background: rgba(255, 203, 66, .12); }
.workspace-stat .stat-value { font-size: clamp(24px, 3vw, 35px); color: #1b2026; }
.workspace-stat small { color: #a0a5ac; font-size: 10px; }
.workspace-overview-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(280px, .7fr); gap: 18px; margin-bottom: 28px; }
.workspace-quick-card { padding: 22px; }
.quick-action-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; }
.quick-action-grid a { padding: 15px 12px; display: grid; gap: 6px; border: 1px solid #eceef0; border-radius: 13px; color: #24282e; text-decoration: none; background: #fafbfb; }
.quick-action-grid a:hover { border-color: #efd177; background: #fffaf0; transform: translateY(-1px); }
.quick-action-grid a > span { width: 31px; height: 31px; display: grid; place-items: center; border-radius: 9px; background: #fff0bd; color: #906900; font-size: 11px; font-weight: 800; }
.quick-action-grid strong { margin-top: 3px; font-size: 12px; }
.quick-action-grid small { color: #989da5; font-size: 9px; }
.workspace-health { padding: 24px; display: flex; align-items: center; gap: 17px; background: #f1f9f3; border-color: #dfeee3 !important; }
.workspace-health h2 { margin: 4px 0 6px; font-size: 16px; }
.workspace-health p { margin: 0; color: #6e7e73; font-size: 11px; line-height: 1.5; }
.workspace-section-head { align-items: flex-end; margin-top: 0; }
.workspace-section-head h2 { margin: 3px 0 0; }

@media (max-width: 1180px) {
  .merchant-card-grid, .product-card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .workspace-overview-grid { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .admin-workspace .site-header {
    width: 248px;
    transform: translateX(-102%);
    transition: transform 200ms ease;
    box-shadow: 24px 0 60px rgba(0,0,0,.22);
  }
  .admin-workspace .site-header.open { transform: translateX(0); }
  .admin-content { margin-left: 0; }
  .admin-workspace .nav-toggle { display: grid; place-content: center; width: 40px; height: 40px; padding: 9px; border: 1px solid #e0e2e5; border-radius: 10px; background: #fff; }
  .admin-workspace .nav-toggle span { display: block; width: 18px; height: 2px; margin: 2px 0; background: #252a31; border-radius: 2px; }
  .admin-page { padding-top: 26px; }
  .form-row-3 { grid-template-columns: 1fr 1fr; }
  .link-builder-layout { grid-template-columns: 1fr; }
  .link-builder-help { position: static; }
}

@media (max-width: 680px) {
  .admin-topbar { min-height: 64px; padding: 10px 16px; }
  .admin-topbar-copy { display: none; }
  .admin-topbar-actions .environment-pill { display: none; }
  .admin-topbar-actions .btn { font-size: 11px; }
  .admin-page { padding: 22px 16px 50px; }
  .workspace-page-head { align-items: flex-start; flex-direction: column; margin-bottom: 20px; }
  .workspace-page-head > .btn, .workspace-page-head > button { width: 100%; }
  .workspace-page-head .actions { width: 100%; display: grid; grid-template-columns: 1fr 1fr; }
  .workspace-page-head .actions .btn { justify-content: center; }
  .form-row-3, .merchant-card-grid, .product-card-grid, .workspace-stat-grid, .provider-picker-grid { grid-template-columns: 1fr; }
  .workspace-stat-grid { grid-template-columns: 1fr 1fr; }
  .workspace-stat { min-height: 106px; padding: 16px; }
  .quick-action-grid { grid-template-columns: 1fr 1fr; }
  .catalog-toolbar { align-items: stretch; flex-direction: column; }
  .catalog-toolbar form { display: grid; }
  .catalog-toolbar select { width: 100%; }
  .builder-step { padding: 19px 16px; }
  .builder-step .form-row { grid-template-columns: 1fr; }
}
/* Theming: every var declares its light and dark value via light-dark(),
   switched by color-scheme. The admin shell sets data-theme on <html> from
   the `theme` cookie (see layout.tsx) — auto follows the system, light/dark
   force it. Pages without the attribute (pay page, login, print) always
   render light: customer-facing surfaces stay on-brand stationery. */
:root {
  color-scheme: light;
  --paper: light-dark(#f6f4ee, #1b1813);
  --paper-deep: light-dark(#faf8f2, #2a2620);
  --surface: light-dark(#fffefb, #23201a);
  --ink: light-dark(#1d1a15, #ece7db);
  --ink-soft: light-dark(#6b6459, #a89f90);
  --ink-faint: light-dark(#756e61, #97907f);
  --line: light-dark(#e6e1d6, #37332a);
  --line-strong: light-dark(#cfc7b8, #4c4638);
  --green: light-dark(#1e5b43, #82ba9c);
  --green-deep: light-dark(#144532, #a3cfb6);
  --green-tint: light-dark(#e9f0eb, #233830);
  --green-line: light-dark(#cfdfd4, #35523f);
  --amber: light-dark(#8a6510, #d9b05e);
  --amber-tint: light-dark(#f6eeda, #39301a);
  --amber-line: light-dark(#e8d9b4, #5a4a26);
  --rust: light-dark(#a8402a, #e08d77);
  --rust-deep: light-dark(#7c2f1e, #f2b6a4);
  --rust-tint: light-dark(#f7e9e4, #3d251e);
  --rust-line: light-dark(#e6c6ba, #5c3527);
  --stone: light-dark(#6b655a, #a89f90); /* 4.8:1 on stone-tint — badge text passes WCAG AA */
  --stone-tint: light-dark(#edeae2, #2d2a23);
  --stone-line: light-dark(#ddd8cc, #464135);
  /* Text on solid accent fills (green buttons, overdue badge) — accents are
     dark pigments in light mode, lifted pastels in dark mode */
  --on-accent: light-dark(#fdfdf9, #17140f);
  --focus-ring: light-dark(rgba(30, 91, 67, 0.18), rgba(130, 186, 156, 0.35));
  --focus-ring-danger: light-dark(rgba(168, 64, 42, 0.14), rgba(224, 141, 119, 0.3));
  --radius: 8px;
  --radius-sm: 5px;
  --shadow: 0 1px 2px light-dark(rgba(29, 26, 21, 0.05), rgba(0, 0, 0, 0.3)),
    0 4px 16px light-dark(rgba(29, 26, 21, 0.05), rgba(0, 0, 0, 0.3));
  --font-display: 'Fraunces', 'Iowan Old Style', Georgia, serif;
  --font-ui: 'Instrument Sans', 'Avenir Next', 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', system-ui, sans-serif;
}

:root[data-theme='auto'] {
  color-scheme: light dark;
}

:root[data-theme='dark'] {
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

/* The hidden attribute must always win — author display rules (.btn etc.)
   otherwise override the UA's low-priority [hidden] { display: none } */
[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

/* Barely-there paper grain */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)'/%3E%3C/svg%3E");
}

main {
  position: relative;
  z-index: 1;
}

/* Kill the UA form margin — forms wrap single action buttons all over the app */
form {
  margin: 0;
}

a {
  color: var(--green);
  text-decoration: none;
  transition: color 140ms ease;
}

a:hover {
  color: var(--green-deep);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}

h1,
h2,
h3 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink);
}

h2 {
  font-size: 19px;
  margin: 0 0 14px;
}

.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 24px;
}

.site-footer {
  text-align: center;
  font-size: 12.5px;
  color: var(--ink-faint);
  padding: 0 24px 28px;
}

.site-footer a {
  color: inherit;
  text-decoration: underline;
}

.site-footer a:hover {
  color: var(--ink-soft);
}

/* --------------------------------------------------------------------------
   Header
   -------------------------------------------------------------------------- */

.site-header {
  position: relative;
  z-index: 30; /* above main (z-1) so the mobile nav panel paints over content */
  border-bottom: 1px solid var(--line-strong);
  background: var(--paper);
  margin-bottom: 40px;
}

.site-header .container {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding-top: 20px;
  padding-bottom: 18px;
}

.site-brand {
  font-family: var(--font-display);
  font-weight: 650;
  font-size: 21px;
  color: var(--ink);
  letter-spacing: 0.01em;
}

.site-brand:hover {
  color: var(--green);
  text-decoration: none;
}

.site-nav {
  display: flex;
  gap: 26px;
}

.site-nav a {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--ink-soft);
  padding-bottom: 19px;
  margin-bottom: -19px;
  border-bottom: 2px solid transparent;
}

.site-nav a:hover {
  color: var(--ink);
  text-decoration: none;
}

.site-nav a.active {
  color: var(--green);
  border-bottom-color: var(--green);
}

.site-nav a.logout {
  color: var(--ink-faint);
  position: relative;
  padding-left: 22px;
}

/* Text-height divider — a border would stretch down the underline padding */
.site-nav a.logout::before {
  content: '';
  position: absolute;
  left: 0;
  top: 3px;
  height: 13px;
  width: 1px;
  background: var(--line-strong);
}

.site-nav a.logout:hover {
  color: var(--rust);
}

/* Hamburger — hidden on desktop */
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 40px;
  height: 36px;
  padding: 8px;
  background: none;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.nav-toggle span {
  display: block;
  height: 2px;
  background: var(--ink);
  border-radius: 2px;
  transition: transform 180ms ease, opacity 180ms ease;
}

.nav-toggle.open span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.nav-toggle.open span:nth-child(2) {
  opacity: 0;
}

.nav-toggle.open span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* --------------------------------------------------------------------------
   Page head
   -------------------------------------------------------------------------- */

.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin: 0 0 26px;
}

.page-title {
  font-size: 30px;
  margin: 0;
}

.actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

/* --------------------------------------------------------------------------
   Filter tabs
   -------------------------------------------------------------------------- */

.filter-bar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.filter-bar .filter-tabs {
  margin-bottom: 0;
}

.client-filter select {
  width: auto;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
  padding: 5px 10px;
}

.filter-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.filter-tabs a {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
  padding: 5px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: transparent;
  transition: color 140ms ease, border-color 140ms ease, background 140ms ease;
}

.filter-tabs a:hover {
  color: var(--ink);
  border-color: var(--ink-soft);
  text-decoration: none;
}

.filter-tabs a.active {
  color: var(--on-accent);
  background: var(--green);
  border-color: var(--green);
}

.filter-count {
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--ink-faint);
  background: var(--stone-tint);
  border-radius: 999px;
  padding: 1px 7px;
}

.filter-tabs a.active .filter-count {
  color: var(--green-tint);
  background: var(--green-deep);
}

/* --------------------------------------------------------------------------
   Cards — staggered rise on load
   -------------------------------------------------------------------------- */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 26px 28px;
  box-shadow: var(--shadow);
  margin-bottom: 22px;
}

/* The card's padding is the spacing — children don't add their own tail margin
   (default <p> margins, table margins, etc.) */
.card > :last-child {
  margin-bottom: 0;
}

/* Entrance animation on the public pay shell only — admin views render instantly. */
.pay-wrap > * {
  /* backwards (not both): elements end in their natural state, so finished
     animations are released — `both` pins them alive forever, which costs the
     compositor and wedges anything waiting for page quiescence */
  animation: rise 480ms cubic-bezier(0.22, 1, 0.36, 1) backwards;
}

.pay-wrap > *:nth-child(2) { animation-delay: 40ms; }
.pay-wrap > *:nth-child(3) { animation-delay: 90ms; }
.pay-wrap > *:nth-child(4) { animation-delay: 140ms; }
.pay-wrap > *:nth-child(5) { animation-delay: 190ms; }
.pay-wrap > *:nth-child(6) { animation-delay: 240ms; }

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}

/* --------------------------------------------------------------------------
   Tables — the ledger itself
   -------------------------------------------------------------------------- */

table.table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 22px;
}

table.table th {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  text-align: left;
  color: var(--ink-faint);
  padding: 13px 16px 11px;
  border-bottom: 1px solid var(--line-strong);
  background: var(--surface);
}

table.table td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
  font-variant-numeric: tabular-nums;
  vertical-align: middle; /* text cells center against taller controls (note editor, buttons) */
}

/* Inside a card, the card's own padding provides the bottom spacing */
.card table.table:last-child {
  margin-bottom: 0;
}

/* Timestamps stay on one line (payments table) */
table.table td[data-label='Date'] {
  white-space: nowrap;
}

/* Qty/unit are supporting math — the amount column carries the row */
td.item-dim {
  color: var(--ink-soft);
}

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

table.table tbody tr {
  transition: background 120ms ease;
}

table.table tbody tr:hover {
  background: var(--paper-deep);
}

table.table tbody tr[data-href] {
  cursor: pointer;
}

.text-right,
table.table th.text-right,
table.table td.text-right {
  text-align: right;
}

.pre-line {
  white-space: pre-line;
}

.product-image-preview,
.product-image-admin img {
  display: block;
  width: min(100%, 420px);
  max-height: 420px;
  margin-top: 14px;
  border: 1px solid var(--stone-line);
  border-radius: 8px;
  object-fit: contain;
  background: var(--paper);
}

.product-image-actions {
  margin: 14px 0 22px;
}

.product-image-actions form:first-child {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* Product payment-link page */
.payment-order-shell {
  width: min(100%, 560px);
  margin: 0 auto;
}

.payment-language {
  display: flex;
  justify-content: flex-end;
  gap: 7px;
  margin: 0 4px 10px;
  color: var(--ink-soft);
  font-size: 0.85rem;
}

.payment-language a {
  color: var(--ink-soft);
  text-decoration: none;
}

.payment-language a.active {
  color: var(--green);
  font-weight: 700;
}

.payment-order-card {
  overflow: hidden;
}

.payment-order-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}

.payment-order-brand img {
  width: 52px;
  height: 52px;
  object-fit: contain;
  border-radius: 8px;
}

.payment-order-brand h1 {
  margin: 0;
  font-size: 1.45rem;
}

.payment-eyebrow {
  margin: 0 0 3px;
  color: var(--ink-soft);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.payment-product-image {
  display: block;
  width: 100%;
  max-height: 420px;
  margin: 22px 0 18px;
  border: 1px solid var(--line);
  border-radius: 10px;
  object-fit: contain;
  background: var(--paper-deep);
}

.payment-product-copy h2 {
  margin: 0 0 7px;
  font-size: 1.55rem;
}

.payment-product-copy p {
  margin: 0;
  color: var(--ink-soft);
  white-space: pre-line;
}

.payment-product-copy .payment-order-number {
  margin-top: 10px;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
}

.payment-amount {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin: 24px 0 18px;
  padding: 18px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  color: var(--ink-soft);
}

.payment-amount strong {
  color: var(--ink);
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 7vw, 2.45rem);
  font-variant-numeric: tabular-nums;
}

.payment-guidance {
  text-align: center;
  color: var(--ink-soft);
}

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

.payment-methods form,
.payment-methods .btn {
  width: 100%;
  box-sizing: border-box;
  text-align: center;
}

.payment-state {
  margin: 20px 0 4px;
  padding: 18px;
  border: 1px solid;
  border-radius: 8px;
  text-align: center;
}

.payment-state h2,
.payment-state p {
  margin: 0;
}

.payment-state p {
  margin-top: 5px;
}

.payment-state-success {
  color: var(--green-deep);
  background: var(--green-tint);
  border-color: var(--green-line);
}

.payment-state-warning {
  color: var(--amber);
  background: var(--amber-tint);
  border-color: var(--amber-line);
}

.payment-state-error {
  color: var(--rust-deep);
  background: var(--rust-tint);
  border-color: var(--rust-line);
}

.payment-trust {
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 0.83rem;
  text-align: center;
}

.payment-trust p {
  margin: 4px 0;
}

.gift-card-shell {
  width: min(100%, 720px);
}

.gift-card-entry {
  margin: 18px 0;
  padding: 18px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
}

.gift-card-entry-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.gift-card-page-logo { background: linear-gradient(135deg, #fff0d6, #ffe2a9); color: #9c5c00; }
.gift-card-steps { display: flex; align-items: center; justify-content: center; gap: 0.45rem; margin: 1rem 0 1.15rem; color: #8a958f; font-size: 0.68rem; }
.gift-card-steps span { display: inline-flex; align-items: center; gap: 0.28rem; white-space: nowrap; }
.gift-card-steps b { display: grid; width: 1.3rem; height: 1.3rem; place-items: center; border-radius: 50%; background: #e8eeea; color: #6d7a72; font-size: 0.65rem; }
.gift-card-steps span.is-active { color: #168b70; font-weight: 750; }
.gift-card-steps span.is-active b { color: #fff; background: #168b70; }
.gift-card-steps i { color: #b0bbb4; font-style: normal; font-size: 1rem; }
.gift-picker-label { display: block; margin-bottom: 0.45rem; color: var(--ink-soft); font-size: 0.73rem; }
.gift-brand-options { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.45rem; margin-bottom: 0.55rem; }
.gift-brand-option { display: flex; min-height: 2.8rem; align-items: center; justify-content: flex-start; gap: 0.4rem; padding: 0.42rem 0.48rem; border: 1px solid var(--line); border-radius: 0.7rem; color: var(--ink); background: #fff; cursor: pointer; font: inherit; font-size: 0.68rem; text-align: left; }
.gift-brand-option:hover, .gift-brand-option.is-selected { border-color: #59b58c; background: #effaf4; }
.gift-brand-logo { display: grid; width: 1.65rem; height: 1.65rem; flex: 0 0 1.65rem; place-items: center; border-radius: 0.48rem; color: #fff; font-size: 0.85rem; font-weight: 850; }
.gift-brand-logo-amazon { background: #ff9900; color: #111; }
.gift-brand-logo-apple { background: #111; }
.gift-brand-logo-steam { background: #1b2838; }
.gift-brand-logo-visa { background: #1a1f71; }
.gift-brand-logo-google { background: #4285f4; }
.gift-brand-logo-target { background: #cc0000; }
.gift-brand-logo-walmart { background: #0071ce; }
.gift-brand-logo-other { background: #168b70; }
.gift-brand-input { margin-top: 0.15rem; }
.gift-card-type-options { display: grid; gap: 0.45rem; }
.gift-card-type-option { display: flex; width: 100%; align-items: center; gap: 0.45rem; padding: 0.52rem 0.6rem; border: 1px solid var(--line); border-radius: 0.7rem; color: var(--ink); background: #fff; cursor: pointer; font: inherit; font-size: 0.72rem; text-align: left; }
.gift-card-type-option input { margin: 0; accent-color: #168b70; }
.gift-card-type-option.is-selected { border-color: #59b58c; background: #effaf4; }
.gift-type-icon { display: grid; width: 1.35rem; height: 1.35rem; place-items: center; border-radius: 0.35rem; color: #168b70; background: #dff5e9; font-size: 0.75rem; font-weight: 800; }
.gift-card-total { display: flex; align-items: center; justify-content: space-between; margin: 0.75rem 0; padding: 0.75rem 0.85rem; border-radius: 0.75rem; color: #3f5d4e; background: #effaf4; font-size: 0.75rem; }
.gift-card-total strong { color: #08783a; font-size: 0.95rem; }
.gift-card-file-preview { display: flex; min-height: 2.2rem; align-items: center; gap: 0.55rem; margin-top: 0.5rem; padding: 0.35rem; border: 1px dashed var(--line-strong); border-radius: 0.55rem; color: #7a857e; font-size: 0.68rem; }
.gift-card-file-preview img { width: 2.4rem; height: 2.4rem; object-fit: cover; border-radius: 0.35rem; }

.gift-card-remove {
  border: none;
  background: transparent;
  color: var(--rust);
  cursor: pointer;
  font-size: 24px;
  line-height: 1;
}

.gift-card-form-actions {
  align-items: center;
}

.secret-fingerprint,
.secret-reveal code {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
}

.secret-reveal > div {
  display: grid;
  gap: 6px;
  margin-top: 18px;
}

.secret-reveal code {
  padding: 12px;
  overflow-wrap: anywhere;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--paper-deep);
  font-size: 1rem;
  user-select: all;
}

.crypto-pay-shell {
  width: min(100%, 680px);
}

.crypto-amount-block {
  display: grid;
  gap: 6px;
  margin: 20px 0;
  padding: 20px;
  border: 1px solid var(--green-line);
  border-radius: var(--radius-sm);
  background: var(--green-tint);
  text-align: center;
}
.crypto-source-note { margin: -0.35rem 0 1rem; font-size: 0.72rem; text-align: right; }
.crypto-source-note a { color: #168b70; }

.crypto-amount-block span {
  color: var(--green-deep);
}

.crypto-amount-block strong {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 7vw, 2.35rem);
  overflow-wrap: anywhere;
}

.crypto-instructions {
  display: grid;
  gap: 14px;
  margin: 20px 0;
}

.crypto-instructions > div {
  display: grid;
  gap: 5px;
}

.crypto-instructions dt {
  color: var(--ink-soft);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.crypto-instructions dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.crypto-instructions code {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
}

.copy-inline {
  margin-left: 8px;
  padding: 3px 8px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: var(--surface);
  cursor: pointer;
}

.crypto-submit {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.crypto-submit h2 {
  margin-bottom: 6px;
}

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

.compact-filters {
  align-items: center;
  margin-bottom: 0;
}

.compact-filters select {
  width: auto;
  min-width: 180px;
}

.payment-reference {
  max-width: 260px;
  overflow-wrap: anywhere;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 0.82rem;
}

.audit-detail {
  max-width: 420px;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

@media (max-width: 900px) {
  .payment-stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .payment-stat-grid {
    grid-template-columns: 1fr;
  }
  .compact-filters select {
    width: 100%;
  }
}

@media (max-width: 560px) {
  .payment-order-card {
    padding: 22px 18px;
  }

  .payment-amount {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }
}

/* --------------------------------------------------------------------------
   Badges — inked stamps
   -------------------------------------------------------------------------- */

.badge {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 3px 9px 2px;
  border-radius: 999px;
  border: 1px solid transparent;
  vertical-align: middle;
}

.badge-draft {
  color: var(--stone);
  background: var(--stone-tint);
  border-color: var(--stone-line);
}

.badge-sent {
  color: var(--amber);
  background: var(--amber-tint);
  border-color: var(--amber-line);
}

.badge-paid {
  color: var(--green);
  background: var(--green-tint);
  border-color: var(--green-line);
}

.badge-void {
  color: var(--stone);
  background: transparent;
  border-color: var(--line-strong);
  text-decoration: line-through;
}

.badge-overdue {
  color: var(--on-accent);
  background: var(--rust);
  border-color: var(--rust);
}

/* --------------------------------------------------------------------------
   Forms
   -------------------------------------------------------------------------- */

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 18px;
  flex: 1;
}

.form-group label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.form-group .muted {
  font-size: 12.5px;
}

.form-row {
  display: flex;
  gap: 18px;
}

input,
select,
textarea {
  font: inherit;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  width: 100%;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

textarea {
  min-height: 84px;
  resize: vertical;
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible,
button:focus-visible,
a:focus-visible {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

a:focus-visible,
button:focus-visible {
  border-radius: var(--radius-sm);
}

input.field-invalid,
select.field-invalid,
textarea.field-invalid {
  border-color: var(--rust);
  box-shadow: 0 0 0 3px var(--focus-ring-danger);
}

input[readonly] {
  background: var(--stone-tint);
  color: var(--ink-soft);
}

input::placeholder,
textarea::placeholder {
  color: var(--ink-faint);
}

/* --------------------------------------------------------------------------
   Line-items editor
   -------------------------------------------------------------------------- */

.items-editor {
  width: 100%;
  border-collapse: collapse;
  margin-top: 8px;
}

.items-editor th {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  text-align: left;
  color: var(--ink-faint);
  padding: 0 8px 8px 0;
  border-bottom: 1px solid var(--line-strong);
}

.items-editor td {
  padding: 8px 8px 8px 0;
  vertical-align: middle;
  border-bottom: 1px solid var(--line);
}

.items-editor input {
  padding: 7px 10px;
}

.items-editor textarea.item-desc {
  /* single-line look that grows with content (JS autosize) */
  padding: 7px 10px;
  min-height: 0;
  resize: none;
  overflow: hidden;
  line-height: 1.45;
  display: block;
}

.items-editor .item-qty {
  max-width: 90px;
}

.items-editor .item-price {
  max-width: 130px;
}

.items-editor .item-amount {
  font-variant-numeric: tabular-nums;
  color: var(--ink-soft);
  white-space: nowrap;
  min-width: 90px;
}

/* Higher specificity than the .btn-* variants defined below, so the remove
   action keeps its quiet icon-button look. */
.items-editor tfoot td {
  padding-top: 10px;
  border-bottom: none;
  font-weight: 600;
}

.items-editor .subtotal-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.items-editor .item-remove {
  color: var(--rust);
  border-color: transparent;
  background: transparent;
  font-size: 18px;
  line-height: 1;
  padding: 6px 11px;
  border-radius: 999px;
}

.items-editor .item-remove:hover {
  background: var(--rust-tint);
  border-color: var(--rust-tint);
  color: var(--rust);
}

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */

/* Single-class selector on purpose: variant classes (.btn-primary etc.) share
   its specificity, so source order decides — button.btn would out-rank them. */
.btn {
  display: inline-block;
  appearance: none;
  -webkit-appearance: none;
  font-family: var(--font-ui);
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 9px 18px;
  line-height: 1.4; /* uniform height: <button> defaults to `normal`, <a> inherits 1.55 */
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: none;
  color: var(--ink);
  cursor: pointer;
  text-decoration: none;
  transition: background 140ms ease, color 140ms ease, border-color 140ms ease,
    transform 140ms ease, box-shadow 140ms ease;
  width: auto;
}

.btn:hover {
  text-decoration: none;
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.btn-primary {
  background: var(--green);
  color: var(--on-accent);
  box-shadow: 0 1px 2px rgba(20, 69, 50, 0.35);
}

.btn-primary:hover {
  background: var(--green-deep);
  color: var(--on-accent);
  box-shadow: 0 3px 10px rgba(20, 69, 50, 0.28);
}

.btn-secondary {
  background: transparent;
  color: var(--ink);
  border-color: var(--line-strong);
}

.btn-secondary:hover {
  border-color: var(--ink-soft);
  color: var(--ink);
  background: var(--surface);
}

.btn-danger {
  background: transparent;
  color: var(--rust);
  border-color: var(--rust-line);
}

.btn-danger:hover {
  background: var(--rust);
  border-color: var(--rust);
  color: var(--on-accent);
}

.btn-sm {
  font-size: 12.5px;
  padding: 6px 12px;
}

/* --------------------------------------------------------------------------
   Banners
   -------------------------------------------------------------------------- */

.banner {
  padding: 13px 18px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  margin-bottom: 22px;
  font-size: 14px;
}

.banner-success {
  background: var(--green-tint);
  border-color: var(--green-line);
  color: var(--green-deep);
}

.banner-error {
  background: var(--rust-tint);
  border-color: var(--rust-line);
  color: var(--rust-deep);
}

.banner-warning {
  background: var(--amber-tint);
  border-color: var(--amber-line);
  color: var(--amber);
}

.warning-list {
  margin: 6px 0 0;
  padding-left: 20px;
}

.warning-list li {
  padding: 1px 0;
}

/* --------------------------------------------------------------------------
   Public pay page — the document
   -------------------------------------------------------------------------- */

.pay-wrap {
  max-width: 720px;
  margin: 0 auto;
  padding: 48px 24px 80px;
  position: relative;
  z-index: 1;
}

.pay-card {
  border-top: 3px solid var(--green);
  padding: 38px 42px 34px;
}

.pay-card .page-title {
  font-size: 26px;
}

.invoice-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 28px;
  margin: 22px 0 26px;
  padding: 18px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.invoice-meta > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.invoice-meta dt {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin: 0;
}

.invoice-meta dd {
  margin: 0;
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}

.pay-card table.table {
  border: none;
  box-shadow: none;
  border-radius: 0;
}

.pay-card table.table th,
.pay-card table.table td {
  padding-left: 0;
}

.totals {
  margin-left: auto;
  max-width: 300px;
  padding-top: 14px;
  font-variant-numeric: tabular-nums;
}

.totals > div {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding: 4px 0;
  font-size: 14.5px;
}

.totals .totals-final {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 21px;
  color: var(--ink);
  border-top: 1px solid var(--ink);
  margin-top: 8px;
  padding-top: 10px;
}

.pay-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 26px;
}

.pay-buttons form {
  width: 100%;
}

.pay-buttons .btn {
  width: 100%;
  text-align: center;
  padding: 13px 18px;
  font-size: 15px;
}

.provider-note {
  font-size: 12.5px;
  color: var(--ink-faint);
  text-align: center;
  margin: 4px 0 0;
}

.pay-notes {
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.pay-notes-label {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.pay-notes p {
  margin: 4px 0 0;
  color: var(--ink-soft);
  font-size: 14px;
  white-space: pre-line; /* notes are multiline text */
}

/* --------------------------------------------------------------------------
   Reports
   -------------------------------------------------------------------------- */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin-bottom: 22px;
}

.stat {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-bottom: 0;
}

.stat-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.stat-value {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 27px;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

.stat-alert {
  color: var(--rust);
}

.report-total td {
  font-weight: 700;
  border-top: 1px solid var(--line-strong);
  background: var(--paper-deep);
}

/* Inline action rows (record payment, sent date, pay link): button sits on
   the input's baseline instead of stretching to the row height */
.record-payment .form-row,
.sent-date-form .form-row,
.pay-link-row {
  align-items: flex-end;
}

.sent-date-form {
  margin-bottom: 14px;
}

.record-payment-date {
  flex: 0 0 170px;
}

.pay-link-actions {
  display: flex;
  gap: 10px;
  margin-bottom: 18px; /* align with the input above the form-group margin */
}

.pay-link-actions .btn {
  white-space: nowrap;
}

#pay-link-input {
  text-overflow: ellipsis;
}

.record-payment-btn {
  margin-bottom: 18px; /* match .form-group's bottom margin */
  white-space: nowrap;
}

/* Its bottom margin would collapse through the form past the card padding */
.record-payment p:last-child {
  margin-bottom: 0;
}

/* --------------------------------------------------------------------------
   Timeline
   -------------------------------------------------------------------------- */

.timeline {
  list-style: none;
  margin: 0;
  padding: 0 0 0 18px;
  border-left: 2px solid var(--line-strong);
}

.timeline-entry {
  position: relative;
  padding: 5px 0 5px 8px;
  font-size: 14px;
}

/* View entries are noise-prone (own clicks, mail scanners) — quietly removable */
.timeline-remove {
  display: inline;
  margin-left: 4px;
}

.timeline-remove-btn {
  background: none;
  border: none;
  padding: 0 5px;
  font-size: 15px;
  line-height: 1;
  color: var(--ink-faint);
  cursor: pointer;
  border-radius: 4px;
}

.timeline-remove-btn:hover {
  color: var(--rust);
}

.timeline-entry::before {
  content: '';
  position: absolute;
  left: -23px;
  top: 13px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--stone);
  border: 2px solid var(--paper);
}

.timeline-payment::before {
  background: var(--green);
}

.timeline-voided::before,
.timeline-payment_undone::before,
.timeline-unsent::before {
  background: var(--rust);
}

.timeline-sent::before,
.timeline-emailed::before {
  background: var(--amber);
}

/* Views are ambient signal, not actions — hollow dot, quieter text */
.timeline-viewed::before {
  background: var(--paper);
  border-color: var(--stone);
}

.timeline-viewed .timeline-label {
  color: var(--ink-soft);
  font-weight: 400;
}

.ref {
  font-size: 13px;
  color: var(--ink-soft);
  cursor: default;
  white-space: nowrap;
}

a .ref {
  color: var(--green);
  cursor: pointer;
}

.note-edit-form {
  display: flex;
  gap: 6px;
  align-items: center;
  min-width: 200px;
}

.note-edit-form input {
  padding: 5px 9px;
  font-size: 13px;
}

.timeline-when {
  display: inline-block;
  min-width: 128px;
  color: var(--ink-faint);
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
}

.timeline-label {
  font-weight: 600;
}

/* --------------------------------------------------------------------------
   Utilities
   -------------------------------------------------------------------------- */

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

.mt-1 {
  margin-top: 8px;
}

.mt-2 {
  margin-top: 16px;
}

.empty-state {
  text-align: center;
  color: var(--ink-soft);
  padding: 56px 24px;
  background: var(--surface);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  margin-bottom: 22px;
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 720px) {
  .form-row {
    flex-direction: column;
    gap: 0;
  }

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

  .record-payment .form-row {
    align-items: stretch;
  }

  .record-payment-btn {
    margin-bottom: 0;
  }

  /* Pay link on mobile: compact URL, equal-width action buttons.
     In column direction align-items is horizontal — flex-end would shrink
     children to content width, so stretch instead. */
  .pay-link-row {
    align-items: stretch;
  }

  .pay-link-row .form-group {
    margin-bottom: 10px;
  }

  #pay-link-input {
    font-size: 13px;
    padding: 8px 10px;
  }

  .pay-link-actions {
    width: 100%;
    margin-bottom: 0;
  }

  .pay-link-actions .btn {
    flex: 1;
    min-width: 0; /* allow equal split despite nowrap content */
    padding-left: 8px;
    padding-right: 8px;
    text-align: center;
  }

  /* --- Mobile nav: brand + hamburger row, links in a slide-down panel --- */
  .site-header .container {
    position: relative;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding-top: 14px;
    padding-bottom: 14px;
  }

  .nav-toggle {
    display: flex;
  }

  .site-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 20;
    flex-direction: column;
    gap: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--line-strong);
    box-shadow: 0 12px 24px rgba(29, 26, 21, 0.08);
  }

  .site-nav.open {
    display: flex;
    animation: rise 200ms ease-out both;
  }

  .site-nav a {
    padding: 14px 24px;
    margin-bottom: 0;
    border-bottom: 1px solid var(--line);
    font-size: 14px;
  }

  .site-nav a.active {
    color: var(--green);
    border-bottom-color: var(--line);
    border-left: 3px solid var(--green);
    padding-left: 21px;
  }

  .site-nav a.logout {
    padding-left: 24px;
  }

  .site-nav a.logout::before {
    content: none;
  }

  .page-title {
    font-size: 24px;
  }

  /* --- Stacked tables: rows become labeled cards --- */
  table.table--stack thead {
    display: none;
  }

  table.table--stack tbody tr {
    display: block;
    padding: 12px 16px;
    border-bottom: 1px solid var(--line);
  }

  table.table--stack tbody tr:last-child {
    border-bottom: none;
  }

  table.table--stack td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    padding: 4px 0;
    border-bottom: none;
    text-align: right;
  }

  table.table--stack td[data-label]::before {
    content: attr(data-label);
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--ink-faint);
    text-align: left;
    flex-shrink: 0;
  }

  table.table--stack td:not([data-label]) {
    justify-content: flex-end;
  }

  table.table--stack tr.report-total {
    background: var(--paper-deep);
  }

  /* Note editor takes its own full-width line inside a stacked cell */
  table.table--stack .note-edit-form {
    flex: 1 1 100%;
    min-width: 0;
  }

  /* Timeline: timestamp above the label instead of a wrap-forcing column */
  .timeline-when {
    display: block;
    min-width: 0;
    margin-bottom: 1px;
  }

  .timeline-entry {
    padding: 8px 0 8px 8px;
  }

  .pay-card {
    padding: 26px 22px;
  }

  .invoice-meta {
    grid-template-columns: 1fr;
  }

  /* Pay page: receipt-style single-line meta rows (label left, value right) */
  .pay-card .invoice-meta {
    gap: 8px;
    padding: 14px 0;
  }

  .pay-card .invoice-meta > div {
    flex-direction: row;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
  }

  .items-editor .item-qty {
    max-width: 64px;
  }

  .items-editor .item-price {
    max-width: 96px;
  }
}

/* ---------- Invoice subject + multi-line descriptions ---------- */

.preline {
  white-space: pre-line;
}

.invoice-subject {
  margin: -14px 0 18px;
  font-size: 15px;
}

.row-subject {
  display: block;
  font-size: 12px;
  margin-top: 1px;
}

/* ==========================================================================
   Merchant console + friend-pay experience
   Modern mobile-first surfaces inspired by marketplace merchant consoles.
   Payment rules remain server-authoritative; these selectors are visual only.
   ========================================================================== */

/* Admin brand bar */
.site-header {
  border-bottom: 0;
  background: #131b27;
  box-shadow: 0 8px 30px rgba(13, 23, 35, 0.14);
}

.site-header .container {
  align-items: center;
  padding-top: 14px;
  padding-bottom: 14px;
}

.site-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  font-family: var(--font-ui);
}

.site-brand:hover {
  color: #d9f8e6;
}

.site-brand-mark {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 11px;
  background: linear-gradient(145deg, #27ad62, #087a3b);
  color: #fff;
  font-weight: 800;
}

.site-brand > span:last-child {
  display: grid;
  line-height: 1.05;
}

.site-brand strong {
  font-size: 15px;
  letter-spacing: 0.02em;
}

.site-brand small {
  margin-top: 4px;
  color: #93a3b8;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.site-nav a,
.site-nav a.logout {
  color: #aeb9c8;
}

.site-nav a:hover,
.site-nav a.active {
  color: #fff;
}

.site-nav a.active {
  border-bottom-color: #36c474;
}

/* Merchant login */
.merchant-access {
  min-height: 100vh;
  background:
    radial-gradient(circle at 12% 10%, rgba(31, 175, 96, 0.18), transparent 28%),
    linear-gradient(135deg, #101721 0%, #172130 54%, #0d141d 100%);
}

.merchant-access::before {
  opacity: 0.045;
}

.merchant-access-main {
  display: grid;
  max-width: none;
  min-height: 100vh;
  padding: 32px;
  place-items: center;
}

.merchant-login-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(360px, 0.85fr);
  width: min(100%, 1120px);
  min-height: 620px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 24px;
  background: rgba(16, 23, 33, 0.92);
  box-shadow: 0 32px 90px rgba(0, 0, 0, 0.36);
}

.merchant-login-intro {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
  padding: 64px;
  color: #fff;
}

.merchant-login-intro::after {
  content: '';
  position: absolute;
  right: -130px;
  bottom: -180px;
  width: 430px;
  height: 430px;
  border: 1px solid rgba(58, 204, 120, 0.2);
  border-radius: 50%;
  box-shadow: 0 0 0 70px rgba(58, 204, 120, 0.035), 0 0 0 140px rgba(58, 204, 120, 0.025);
}

.merchant-login-brand {
  position: absolute;
  top: 46px;
  left: 64px;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: #fff;
  font-size: 17px;
  font-weight: 750;
  letter-spacing: 0.02em;
}

.merchant-login-brand:hover {
  color: #fff;
  text-decoration: none;
}

.merchant-login-logo,
.merchant-login-mobile-logo {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 0;
  background: transparent;
  color: #319969;
  font-size: 18px;
  font-weight: 800;
}
.merchant-login-logo .cg-brand-mark,
.merchant-login-mobile-logo .cg-brand-mark { width: 34px; height: 40px; }

.merchant-login-kicker {
  margin: 0 0 14px;
  color: #51d98c;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.2em;
}

.merchant-login-intro h1 {
  max-width: 560px;
  margin: 0;
  color: #fff;
  font-family: var(--font-ui);
  font-size: clamp(2.2rem, 4.5vw, 3.7rem);
  font-weight: 750;
  line-height: 1.12;
  letter-spacing: -0.045em;
}

.merchant-login-lead {
  max-width: 520px;
  margin: 24px 0 30px;
  color: #aeb9c8;
  font-size: 16px;
  line-height: 1.75;
}

.merchant-login-features {
  display: grid;
  gap: 13px;
  margin: 0;
  padding: 0;
  list-style: none;
  color: #dbe3ec;
}

.merchant-login-features li {
  display: flex;
  align-items: center;
  gap: 12px;
}

.merchant-login-features span {
  color: #51d98c;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.merchant-login-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 58px 54px;
  background: #fff;
}

.merchant-login-panel-head p {
  margin: 0 0 8px;
  color: #148447;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.merchant-login-panel-head h2 {
  margin: 0 0 8px;
  color: #111827;
  font-family: var(--font-ui);
  font-size: 30px;
  font-weight: 750;
  letter-spacing: -0.035em;
}

.merchant-login-panel-head > span:not(.merchant-login-mobile-logo) {
  color: #6b7280;
}

.merchant-login-mobile-logo {
  display: none;
  margin-bottom: 20px;
}

.merchant-login-form {
  margin-top: 32px;
}

.merchant-login-form label {
  color: #202938;
  font-size: 13px;
  font-weight: 700;
}

.merchant-password-field {
  display: flex;
  align-items: center;
  margin-top: 8px;
  overflow: hidden;
  border: 1px solid #d8dee7;
  border-radius: 11px;
  background: #f8fafb;
}

.merchant-password-field > span {
  padding-left: 15px;
  color: #718096;
  font-size: 22px;
}

.merchant-password-field input {
  border: 0;
  background: transparent;
  box-shadow: none;
}

.merchant-password-field:focus-within {
  border-color: #15924d;
  box-shadow: 0 0 0 4px rgba(21, 146, 77, 0.12);
}

.merchant-password-field input:focus {
  box-shadow: none;
}

.merchant-login-submit {
  display: flex;
  width: 100%;
  justify-content: space-between;
  padding: 14px 18px;
  border-radius: 11px;
  background: linear-gradient(135deg, #15924d, #08783a);
  font-size: 15px;
}

.merchant-login-security {
  margin: 24px 0 0;
  color: #7b8493;
  font-size: 12px;
  text-align: center;
}

.merchant-login-security span {
  margin-right: 6px;
  color: #15924d;
}

/* Friend-pay page */
.friend-pay {
  min-height: 100vh;
  background: #f2f5f3;
  color: #121a16;
}

.friend-pay::before {
  display: none;
}

.friend-pay-main {
  max-width: none;
  padding: 34px 18px 70px;
}

.friend-pay-shell {
  width: min(100%, 500px);
  margin: 0 auto;
  padding: 30px 26px 24px;
  border: 1px solid #e2e8e4;
  border-radius: 26px;
  background: #fff;
  box-shadow: 0 18px 60px rgba(27, 45, 34, 0.1);
}

.friend-pay h1,
.friend-pay h2,
.friend-pay h3 {
  color: #121a16;
  font-family: var(--font-ui);
}

.friend-pay-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.friend-pay-wordmark {
  max-width: 70%;
  overflow: hidden;
  color: #0d873f;
  font-size: 19px;
  font-weight: 800;
  letter-spacing: 0.035em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.friend-pay-wordmark:hover {
  color: #087638;
  text-decoration: none;
}

.friend-pay .payment-language {
  margin: 0;
  color: #68736d;
  font-size: 12px;
  font-weight: 700;
}

.friend-pay-hero {
  padding: 8px 8px 26px;
  text-align: center;
}

.friend-pay-secure {
  margin: 0 0 32px;
  color: #637069;
  font-size: 13px;
  text-align: left;
}

.friend-pay-secure span {
  margin-right: 4px;
  color: #0c853e;
}

.friend-pay-people {
  position: relative;
  width: 76px;
  height: 76px;
  margin: 0 auto 18px;
  border-radius: 50%;
  background: #dcf7e5;
}

.friend-pay-people span:first-child {
  position: absolute;
  top: 20px;
  left: 27px;
  width: 18px;
  height: 18px;
  border: 3px solid #118647;
  border-radius: 50%;
}

.friend-pay-people span:first-child::after {
  content: '';
  position: absolute;
  top: 20px;
  left: -10px;
  width: 32px;
  height: 19px;
  border: 3px solid #118647;
  border-bottom: 0;
  border-radius: 18px 18px 0 0;
}

.friend-pay-people span:last-child {
  position: absolute;
  top: 23px;
  right: 16px;
  width: 12px;
  height: 12px;
  border: 2px solid #118647;
  border-radius: 50%;
}

.friend-pay-hero h1 {
  margin: 0;
  font-size: clamp(1.75rem, 7vw, 2.35rem);
  font-weight: 780;
  letter-spacing: -0.045em;
}

.friend-pay-hero > p:last-child {
  max-width: 360px;
  margin: 12px auto 0;
  color: #56615b;
  font-size: 15px;
}

.friend-merchant {
  display: flex;
  align-items: center;
  gap: 15px;
  margin: 0 8px 22px;
}

.friend-merchant-avatar {
  display: grid;
  width: 68px;
  height: 68px;
  flex: 0 0 68px;
  overflow: hidden;
  place-items: center;
  border-radius: 50%;
  background: #17211b;
  color: #fff;
  font-size: 24px;
  font-weight: 800;
}

.friend-merchant-avatar img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #fff;
}

.friend-merchant-copy {
  min-width: 0;
}

.friend-merchant-copy h2 {
  margin: 0;
  overflow: hidden;
  font-size: 20px;
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.friend-merchant-copy p {
  margin: 2px 0 7px;
  color: #59645e;
  font-size: 13px;
}

.friend-validity {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 8px;
  border-radius: 7px;
  background: #e5f8ea;
  color: #08783a;
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.friend-summary-card,
.friend-total-card,
.friend-method-section,
.friend-state {
  margin-top: 12px;
  border: 1px solid #e1e7e3;
  border-radius: 15px;
  background: #fff;
  box-shadow: 0 4px 14px rgba(20, 42, 28, 0.055);
}

.friend-summary-card {
  padding: 18px;
}

.friend-section-head h2,
.friend-method-section > h2 {
  margin: 0 0 16px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.055em;
  text-transform: uppercase;
}

.friend-order-item {
  display: grid;
  grid-template-columns: 70px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 12px;
}

.friend-order-image {
  display: grid;
  width: 70px;
  height: 70px;
  overflow: hidden;
  place-items: center;
  border-radius: 11px;
  background: #edf2ef;
  color: #8a958e;
}

.friend-order-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.friend-order-copy {
  min-width: 0;
}

.friend-order-copy strong {
  display: block;
  overflow: hidden;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.friend-order-copy p {
  display: -webkit-box;
  margin: 3px 0 0;
  overflow: hidden;
  color: #737d77;
  font-size: 11px;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.friend-order-quantity {
  color: #39433e;
  font-size: 12px;
  white-space: nowrap;
}

.friend-order-price {
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.friend-total-card {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 20px 18px;
}

.friend-total-card > span {
  font-size: 19px;
  font-weight: 750;
}

.friend-total-card small {
  padding: 3px 6px;
  border-radius: 5px;
  background: #edf1ef;
  color: #66716b;
  font-size: 10px;
}

.friend-total-card strong {
  color: #0d873f;
  font-size: clamp(1.8rem, 8vw, 2.4rem);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.045em;
}

.friend-method-section {
  padding: 18px;
}

.friend-payment-methods {
  display: grid;
  gap: 9px;
}

.friend-method-card {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  width: 100%;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid #dce3de;
  border-radius: 11px;
  background: #fff;
  color: #18201c;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}

.friend-method-card:hover {
  border-color: #15924d;
  box-shadow: 0 0 0 3px rgba(21, 146, 77, 0.08);
  color: #18201c;
  text-decoration: none;
  transform: translateY(-1px);
}

.friend-method-card > span:nth-child(2) {
  display: grid;
}

.friend-method-card strong {
  font-size: 14px;
}

.friend-method-card small {
  color: #747e78;
  font-size: 11px;
}

.friend-method-card > b {
  color: #15924d;
  font-size: 24px;
  font-weight: 400;
}

.friend-method-icon {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 11px;
  font-size: 13px;
  font-weight: 850;
}

.friend-method-icon-gift {
  background: #fff1d8;
  color: #a15b00;
}

.friend-method-icon-paypal {
  background: #e5f0ff;
  color: #07549a;
}

.friend-method-icon-usdc {
  background: #e5f1ff;
  color: #2775ca;
}

.friend-method-icon-usdt {
  background: #dff7f0;
  color: #168b70;
  font-size: 20px;
}

.friend-trust-card,
.friend-info-note {
  display: flex;
  gap: 12px;
  margin-top: 14px;
  padding: 16px;
  border-radius: 12px;
  background: linear-gradient(110deg, #eaf9ef, #f5fbf7);
  color: #27322c;
}

.friend-trust-icon {
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  place-items: center;
  border: 2px solid #16914c;
  border-radius: 50%;
  color: #16914c;
  font-weight: 800;
}

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

.friend-trust-card p {
  margin: 3px 0 0;
  color: #526059;
  font-size: 11px;
  line-height: 1.5;
}

.friend-info-note {
  background: #eaf4ff;
  color: #24577f;
  font-size: 12px;
}

.friend-primary-action {
  display: block;
  margin-top: 14px;
  padding: 14px 18px;
  border-radius: 11px;
  background: linear-gradient(135deg, #15924d, #08783a);
  color: #fff;
  font-weight: 750;
  text-align: center;
}

.friend-primary-action:hover {
  color: #fff;
  text-decoration: none;
}

.friend-state {
  padding: 22px 18px;
  text-align: center;
}

.friend-state-icon {
  display: grid;
  width: 58px;
  height: 58px;
  margin: 0 auto 12px;
  place-items: center;
  border-radius: 50%;
  background: #e8f8ed;
  color: #0e8b42;
  font-size: 25px;
  font-weight: 800;
}

.friend-state-reviewing .friend-state-icon,
.friend-state-warning .friend-state-icon {
  background: #fff2df;
  color: #d87819;
}

.friend-state-error .friend-state-icon {
  background: #fdebea;
  color: #b83c34;
}

.friend-state h2 {
  margin: 0;
  font-size: 20px;
}

.friend-state > p {
  max-width: 330px;
  margin: 7px auto 0;
  color: #66716b;
  font-size: 13px;
}

.friend-state dl {
  display: grid;
  gap: 8px;
  margin: 18px 0 0;
  padding: 14px;
  border: 1px solid #e4e9e6;
  border-radius: 10px;
  background: #fbfcfb;
  text-align: left;
}

.friend-state dl > div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.friend-state dt {
  color: #657069;
  font-size: 12px;
}

.friend-state dd {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  text-align: right;
}

.friend-pay-footer {
  margin-top: 20px;
  color: #7a847e;
  font-size: 10px;
  text-align: center;
}

.friend-pay-footer a {
  color: inherit;
  text-decoration: underline;
}

.friend-subflow-shell {
  width: min(100%, 590px);
  margin: 0 auto;
}

.friend-subflow-topbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  margin-bottom: 12px;
  color: #2b3530;
}

.friend-subflow-topbar > a {
  width: 36px;
  color: #18201c;
  font-size: 24px;
}

.friend-subflow-topbar > a:hover {
  text-decoration: none;
}

.friend-subflow-topbar > strong {
  font-size: 11px;
  letter-spacing: 0.04em;
}

.friend-subflow-topbar .payment-language,
.friend-subflow-help {
  justify-self: end;
}

.friend-subflow-help {
  display: grid;
  width: 23px;
  height: 23px;
  place-items: center;
  border: 1.5px solid #3d4942;
  border-radius: 50%;
  font-size: 12px;
  font-weight: 800;
}

.friend-subflow-card {
  padding: 30px;
  border: 1px solid #e1e7e3;
  border-top: 1px solid #e1e7e3;
  border-radius: 18px;
  box-shadow: 0 12px 42px rgba(27, 45, 34, 0.09);
}

.friend-subflow-card > h1,
.friend-subflow-card > p {
  text-align: center;
}

.friend-subflow-card > h1 {
  margin: 0 0 8px;
  font-family: var(--font-ui);
  font-size: 27px;
  font-weight: 780;
  letter-spacing: -0.035em;
}

.friend-subflow-card > p {
  max-width: 440px;
  margin: 0 auto 20px;
  color: #65716a;
}

.friend-subflow-icon {
  display: grid;
  width: 62px;
  height: 62px;
  margin: 0 auto 14px;
  place-items: center;
  border-radius: 50%;
  background: #fff0d6;
  color: #9c5c00;
  font-size: 14px;
  font-weight: 850;
}

.friend-subflow-icon.usdc {
  background: #e4f0ff;
  color: #2775ca;
  font-size: 24px;
}

.friend-subflow-icon.usdt {
  background: #ddf7ef;
  color: #168b70;
  font-size: 25px;
}

.friend-subflow-card .invoice-meta,
.friend-subflow-card .crypto-instructions,
.friend-subflow-card .gift-card-entry,
.friend-subflow-card .crypto-amount-block {
  border-radius: 12px;
}

.friend-subflow-card .gift-card-entry {
  background: #fbfcfb;
}

.friend-subflow-card .crypto-amount-block {
  border: 0;
  background: #fff7dc;
}

.friend-subflow-card .crypto-amount-block strong {
  font-family: var(--font-ui);
}

.friend-subflow-card .btn-primary {
  border-radius: 10px;
  background: linear-gradient(135deg, #15924d, #08783a);
}

@media (max-width: 820px) {
  .merchant-access-main {
    padding: 18px;
  }

  .merchant-login-shell {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .merchant-login-intro {
    display: none;
  }

  .merchant-login-panel {
    min-height: 560px;
    padding: 48px 38px;
  }

  .merchant-login-mobile-logo {
    display: grid;
  }
}

@media (max-width: 520px) {
  .gift-brand-options { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .gift-card-steps { gap: 0.25rem; font-size: 0.61rem; }
  .gift-card-steps i { font-size: 0.85rem; }
}

@media (max-width: 720px) {
  .site-header {
    margin-bottom: 26px;
  }

  .site-header .container {
    padding-top: 12px;
    padding-bottom: 12px;
  }

  .site-nav {
    background: #172130;
    border-bottom-color: #263447;
    box-shadow: 0 14px 28px rgba(0, 0, 0, 0.22);
  }

  .site-nav a {
    border-bottom-color: #263447;
  }

  .site-nav a.active {
    border-bottom-color: #263447;
    border-left-color: #36c474;
  }

  .nav-toggle span {
    background: #fff;
  }

  .friend-pay-main {
    padding: 0;
  }

  .friend-pay-shell {
    width: 100%;
    min-height: 100vh;
    padding: 26px 20px 30px;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .friend-subflow-shell {
    min-height: 100vh;
    padding: 22px 16px;
    background: #f2f5f3;
  }

  .friend-subflow-card {
    padding: 24px 18px;
  }
}

@media (max-width: 430px) {
  .merchant-access-main {
    padding: 0;
  }

  .merchant-login-shell {
    min-height: 100vh;
    border: 0;
    border-radius: 0;
  }

  .merchant-login-panel {
    min-height: 100vh;
    padding: 38px 24px;
  }

  .friend-order-item {
    grid-template-columns: 62px minmax(0, 1fr) auto;
    gap: 10px;
  }

  .friend-order-image {
    width: 62px;
    height: 62px;
  }

  .friend-order-quantity {
    display: none;
  }

  .friend-order-price {
    font-size: 12px;
  }
}

.pay-subject {
  margin: 2px 0 0;
  font-size: 14.5px;
}

/* ---------- Pay page: business identity + trust signals ---------- */

.pay-biz-address {
  margin: 2px 0 0;
  font-size: 13px;
  white-space: pre-line;
  line-height: 1.45;
}

/* Subject sits between the meta block and the line items — a "Re:" line */
.pay-subject {
  margin: 0 0 16px;
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
}

.pay-trust {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  text-align: center;
}

.pay-trust-line {
  margin: 0;
  font-size: 13px;
  color: var(--ink-soft);
}

.pay-trust-line .icon {
  vertical-align: -2px;
  margin-right: 6px;
  color: var(--green);
}

.pay-trust-detail {
  margin: 6px 0 0;
  font-size: 12.5px;
  color: var(--ink-faint);
}

.card-chips {
  margin-left: 8px;
}

.card-chips span {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft);
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  padding: 1px 6px;
  margin-right: 4px;
}

.card-chips .card-chips-more {
  border: none;
  padding-left: 0;
  text-transform: none;
  letter-spacing: normal;
  font-weight: 400;
  font-size: 11px;
  color: var(--ink-faint);
}

/* Undone payments on the Payments page: kept for the record, visibly struck */
.payment-undone td {
  color: var(--ink-faint);
}

.payment-undone td[data-label='Amount'] {
  text-decoration: line-through;
}

/* ---------- Settings: section nav + provider toggle rows ---------- */

html {
  scroll-behavior: smooth;
}

.settings-nav {
  margin-bottom: 22px;
}

.card[id] {
  scroll-margin-top: 24px;
}

.provider-toggle {
  margin: 22px 0 14px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.provider-toggle:first-of-type {
  margin-top: 4px;
  padding-top: 0;
  border-top: none;
}

.provider-toggle label {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  cursor: pointer;
}

.provider-toggle-name {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
}

.provider-toggle input[type='checkbox'] {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--green);
  cursor: pointer;
}

/* ---------- Button icons ---------- */

.btn .icon {
  vertical-align: -2px;
  margin-right: 6px;
}

.btn-sm .icon {
  width: 12px;
  height: 12px;
  vertical-align: -1.5px;
  margin-right: 5px;
}

/* ---------- Error pages (404) ---------- */

/* Center the lone card in the viewport (:has — fine in all evergreen browsers) */
.pay-wrap:has(.error-card) {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-top: 24px;
  padding-bottom: 24px;
  box-sizing: border-box;
}

.error-card {
  text-align: center;
  padding-top: 46px;
  padding-bottom: 46px;
}

.error-code {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 96px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
  color: var(--green);
  margin: 0 0 6px;
}

.error-title {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 22px;
  font-weight: 500;
  margin: 0 0 14px;
}

.error-note {
  color: var(--ink-soft);
  font-size: 14.5px;
  line-height: 1.6;
  max-width: 40ch;
  margin: 0 auto;
}

/* Uploaded-logo preview (Settings): thumbnail + caption + remove toggle */
.logo-preview {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: fit-content;
  max-width: 100%;
  padding: 0.5rem 0.85rem;
  margin-bottom: 0.6rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
}
.logo-preview img {
  display: block;
  max-height: 40px;
  max-width: 160px;
}
.form-group label.logo-remove {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-left: 0.5rem;
  font-weight: normal;
  font-size: 0.85rem;
  color: var(--rust);
  white-space: nowrap;
  cursor: pointer;
}
.logo-remove input {
  accent-color: var(--rust);
}

/* Settings -> Alerts: configuration warnings list */
.settings-alerts {
  margin: 0;
  padding-left: 1.1rem;
}
.settings-alerts li {
  color: var(--amber);
  margin-bottom: 0.4rem;
  line-height: 1.45;
}
.settings-alerts li:last-child {
  margin-bottom: 0;
}

/* CityGo Payment V2 — focused mobile payment / top-up request */
.citygo-v2 {
  --v2-green-950: #062f24;
  --v2-green-800: #075f43;
  --v2-green-700: #087852;
  --v2-green-600: #0a9363;
  --v2-green-100: #dff5e9;
  --v2-green-50: #effaf4;
  --v2-ink: #13251f;
  --v2-muted: #65736e;
  --v2-line: #dce6e1;
  --v2-surface: #ffffff;
  background:
    radial-gradient(circle at 80% -5%, rgba(50, 202, 139, 0.22), transparent 32rem),
    linear-gradient(180deg, #eaf8f1 0, #f6f8f7 22rem, #f6f8f7 100%);
  color: var(--v2-ink);
  min-height: 100dvh;
  font-family: "Instrument Sans", system-ui, sans-serif;
}
.citygo-v2-main { padding: 0; }@media (min-width: 1024px) {
.pay-wrap.citygo-v2-main {
max-width: none;
padding-inline: clamp(1rem, 4vw, 4rem);
}
}@media (min-width: 1024px) {
.citygo-v2-main {
width: 100%;
max-width: none;
margin-inline: 0;
}
}
.v2-shell {
  width: min(100%, 500px);
  min-height: 100dvh;
  margin-inline: auto;
  padding: max(1rem, env(safe-area-inset-top)) 1rem max(2rem, env(safe-area-inset-bottom));
}@media (min-width: 900px) {
  .citygo-v2 .v2-shell { width: min(100% - 4rem, 72rem); display: grid; grid-template-columns: minmax(0, 1fr) minmax(22rem, 0.85fr); gap: 1.25rem 2rem; align-items: start; }
  .citygo-v2 .v2-topbar, .citygo-v2 .v2-intro, .citygo-v2 .v2-footer { grid-column: 1 / -1; }
  .citygo-v2 .v2-intro { padding-bottom: 0.25rem; }
}
.v2-topbar { display: flex; align-items: center; justify-content: space-between; min-height: 3rem; }
.v2-brand { display: inline-flex; align-items: center; gap: 0.6rem; color: var(--v2-green-950); font-size: 1.15rem; font-weight: 800; letter-spacing: -0.02em; }
.v2-brand-mark { display: grid; place-items: center; width: 2rem; height: 2rem; overflow: hidden; border-radius: 0.7rem; color: white; background: linear-gradient(145deg, var(--v2-green-600), var(--v2-green-800)); font-size: 0.72rem; box-shadow: 0 8px 20px rgba(7, 95, 67, 0.2); }
.v2-brand-mark img { width: 100%; height: 100%; object-fit: cover; }
.v2-language { position: relative; min-height: 2.4rem; border: 1px solid rgba(7, 95, 67, 0.14); border-radius: 999px; color: var(--v2-green-800); background: rgba(255, 255, 255, 0.82); font-size: 0.84rem; font-weight: 700; backdrop-filter: blur(14px); }
.v2-language summary { display: flex; align-items: center; min-height: 2.4rem; padding-inline: 0.85rem; cursor: pointer; list-style: none; }
.v2-language summary::-webkit-details-marker { display: none; }
.v2-language-menu { position: absolute; z-index: 20; inset-block-start: calc(100% + 0.45rem); inset-inline-end: 0; width: min(18rem, calc(100vw - 2rem)); max-height: min(24rem, 70vh); overflow: auto; display: grid; grid-template-columns: 1fr 1fr; gap: 0.2rem; padding: 0.55rem; border: 1px solid var(--v2-line); border-radius: 1rem; background: #fff; box-shadow: 0 18px 50px rgba(7, 60, 43, 0.18); }
.v2-language-menu a { min-width: 0; padding: 0.62rem 0.7rem; border-radius: 0.65rem; color: var(--v2-ink); font-size: 0.76rem; font-weight: 650; text-align: start; }
.v2-language-menu a:hover, .v2-language-menu a.active { color: var(--v2-green-900); background: var(--v2-green-50); }
.v2-back { display: inline-flex; align-items: center; min-height: 2.75rem; margin-top: 0.4rem; color: var(--v2-green-800); font-size: 0.85rem; font-weight: 700; }
.v2-intro { padding: 2rem 0 1.25rem; }
.v2-kicker { display: block; margin-bottom: 0.7rem; color: var(--v2-green-700); font-size: 0.7rem; font-weight: 800; letter-spacing: 0.14em; }
.v2-intro h1 { max-width: 22rem; margin: 0; color: var(--v2-green-950); font-family: "Instrument Sans", system-ui, sans-serif; font-size: clamp(1.9rem, 8vw, 2.6rem); line-height: 1.05; letter-spacing: -0.05em; }
.v2-intro p { max-width: 28rem; margin: 0.85rem 0 0; color: #496059; font-size: 0.96rem; line-height: 1.55; }
.v2-order-card { display: grid; grid-template-columns: 3.6rem minmax(0, 1fr) auto; align-items: center; gap: 0.8rem; padding: 0.85rem; border: 1px solid rgba(7, 95, 67, 0.11); border-radius: 1.15rem; background: rgba(255, 255, 255, 0.92); box-shadow: 0 14px 45px rgba(22, 54, 42, 0.08); }
.v2-order-image { display: grid; place-items: center; width: 3.6rem; height: 3.6rem; overflow: hidden; border-radius: 0.9rem; color: var(--v2-green-700); background: var(--v2-green-100); font-weight: 800; }
.v2-order-image img { width: 100%; height: 100%; object-fit: cover; }
.v2-order-image.image-load-failed::after { content: '餐品'; color: var(--v2-green-700); font-size: 0.75rem; font-weight: 800; }
.v2-restaurant-card { display: grid; grid-template-columns: 3rem minmax(0, 1fr) auto; align-items: center; gap: 0.7rem; margin-bottom: 0.7rem; padding: 0.75rem 0.85rem; border: 1px solid rgba(7, 95, 67, 0.1); border-radius: 1rem; background: rgba(255, 255, 255, 0.76); }
.v2-restaurant-logo { display: grid; place-items: center; width: 3rem; height: 3rem; overflow: hidden; border-radius: 0.9rem; color: var(--v2-green-800); background: var(--v2-green-100); font-size: 1rem; font-weight: 800; }
.v2-restaurant-logo img { width: 100%; height: 100%; object-fit: cover; }
.v2-restaurant-logo.image-load-failed::after { content: '店'; color: var(--v2-green-700); font-size: 0.85rem; font-weight: 800; }
.v2-restaurant-card strong, .v2-restaurant-card small { display: block; }
.v2-restaurant-card strong { font-size: 0.9rem; }
.v2-restaurant-card small { margin-top: 0.2rem; color: var(--v2-muted); font-size: 0.68rem; }
.v2-secure-chip { padding: 0.25rem 0.5rem; border-radius: 999px; color: var(--v2-green-800); background: var(--v2-green-50); font-size: 0.65rem; font-weight: 800; }
.v2-order-breakdown { display: grid; gap: 0.45rem; margin-top: 0.65rem; padding: 0.85rem 0.95rem; border: 1px solid var(--v2-line); border-radius: 1rem; background: rgba(255,255,255,.7); font-size: 0.75rem; }
.v2-order-breakdown > div { display: flex; justify-content: space-between; gap: 0.7rem; color: var(--v2-muted); }
.v2-order-breakdown strong { color: var(--v2-ink); }
.v2-order-breakdown .is-total { margin-top: 0.25rem; padding-top: 0.55rem; border-top: 1px solid var(--v2-line); color: var(--v2-ink); font-size: 0.86rem; font-weight: 800; }
.v2-included { color: var(--v2-green-700); font-size: 0.68rem; }
.v2-order-main { min-width: 0; display: grid; gap: 0.15rem; }
.v2-order-main small { overflow: hidden; color: var(--v2-green-700); font-size: 0.7rem; font-weight: 800; text-overflow: ellipsis; text-transform: uppercase; white-space: nowrap; }
.v2-order-main strong { overflow: hidden; font-size: 0.98rem; text-overflow: ellipsis; white-space: nowrap; }
.v2-order-main span { overflow: hidden; color: var(--v2-muted); font-size: 0.72rem; text-overflow: ellipsis; white-space: nowrap; }
.v2-order-amount { color: var(--v2-green-800); font-size: 0.9rem; white-space: nowrap; }
.v2-choice-section, .v2-method-section { margin-top: 1.25rem; }
.v2-choice-section > h2 { margin: 0 0 0.75rem; font-family: "Instrument Sans", system-ui, sans-serif; font-size: 1rem; }
.v2-choice { display: grid; grid-template-columns: 2.8rem minmax(0, 1fr) auto; align-items: center; gap: 0.8rem; min-height: 7.5rem; margin-top: 0.7rem; padding: 1rem; border: 1px solid var(--v2-line); border-radius: 1.2rem; color: var(--v2-ink); background: var(--v2-surface); box-shadow: 0 9px 30px rgba(30, 52, 44, 0.06); transition: border-color 150ms ease, transform 150ms ease, box-shadow 150ms ease; }
.v2-choice:hover { border-color: #8ed8b8; box-shadow: 0 14px 34px rgba(7, 95, 67, 0.11); transform: translateY(-1px); }
.v2-choice.is-disabled { cursor: not-allowed; opacity: 0.7; background: #f4f7f5; }
.v2-choice.is-disabled:hover { border-color: var(--v2-line); box-shadow: 0 9px 30px rgba(30, 52, 44, 0.06); transform: none; }
.v2-choice-icon { display: grid; place-items: center; width: 2.8rem; height: 2.8rem; border-radius: 0.9rem; color: white; background: var(--v2-green-700); font-size: 1.25rem; font-weight: 800; }
.v2-choice-icon.is-recharge { color: var(--v2-green-800); background: var(--v2-green-100); }
.v2-choice > span:nth-child(2) { min-width: 0; display: grid; gap: 0.25rem; }
.v2-choice strong { font-size: 0.98rem; }
.v2-choice small { color: var(--v2-muted); font-size: 0.77rem; line-height: 1.35; }
.v2-choice em { width: fit-content; margin-top: 0.15rem; padding: 0.2rem 0.48rem; border-radius: 999px; color: var(--v2-green-800); background: var(--v2-green-50); font-size: 0.65rem; font-style: normal; font-weight: 700; }
.v2-choice > b, .v2-method > b { color: #7a8b85; font-size: 1.5rem; font-weight: 400; }
.v2-truth-note { margin: 0.8rem 0 0; padding: 0.75rem 0.85rem; border: 1px solid #cce8d9; border-radius: 0.8rem; color: #426256; background: rgba(239, 250, 244, 0.8); font-size: 0.72rem; line-height: 1.45; }
.v2-section-heading { display: flex; align-items: flex-start; gap: 0.7rem; margin: 1.25rem 0 0.7rem; }
.v2-section-heading > span { display: grid; flex: 0 0 auto; place-items: center; width: 1.65rem; height: 1.65rem; border-radius: 999px; color: white; background: var(--v2-green-700); font-size: 0.72rem; font-weight: 800; }
.v2-section-heading h2 { margin: 0; font-family: "Instrument Sans", system-ui, sans-serif; font-size: 1rem; }
.v2-section-heading p { margin: 0.18rem 0 0; color: var(--v2-muted); font-size: 0.72rem; }
.v2-methods { display: grid; gap: 0.65rem; }
.v2-methods form { margin: 0; }
.v2-method { width: 100%; display: grid; grid-template-columns: 2.7rem minmax(0, 1fr) auto; align-items: center; gap: 0.75rem; min-height: 4.8rem; padding: 0.75rem 0.9rem; border: 1px solid var(--v2-line); border-radius: 1rem; color: var(--v2-ink); background: var(--v2-surface); text-align: start; box-shadow: 0 7px 22px rgba(27, 52, 42, 0.05); }
.v2-method:hover:not(:disabled) { border-color: #8ed8b8; }
.v2-method:disabled { opacity: 0.58; cursor: not-allowed; }
.v2-method > span:nth-child(2) { min-width: 0; display: grid; gap: 0.22rem; }
.v2-method strong { font-size: 0.9rem; }
.v2-method small { color: var(--v2-muted); font-size: 0.7rem; line-height: 1.35; }
.v2-amounts { display: flex; gap: 0.5rem; overflow-x: auto; padding: 0.1rem 0 0.35rem; scrollbar-width: none; }
.v2-amounts::-webkit-scrollbar { display: none; }
.v2-amounts a { flex: 0 0 auto; min-width: 4.5rem; padding: 0.7rem; border: 1px solid var(--v2-line); border-radius: 0.8rem; color: var(--v2-ink); background: white; font-size: 0.77rem; font-weight: 700; text-align: center; }
.v2-amounts a.active { border-color: var(--v2-green-700); color: white; background: var(--v2-green-700); box-shadow: 0 7px 18px rgba(8, 120, 82, 0.2); }
.v2-receive { display: flex; align-items: center; justify-content: space-between; margin-top: 0.55rem; padding: 0.85rem 1rem; border-radius: 0.9rem; color: var(--v2-green-950); background: var(--v2-green-100); }
.v2-receive span { font-size: 0.72rem; }
.v2-receive strong { font-size: 1.05rem; }
.v2-state { margin-bottom: 1rem; padding: 1.1rem; border-radius: 1.2rem; text-align: center; }
.v2-state.is-complete { color: white; background: linear-gradient(145deg, var(--v2-green-700), var(--v2-green-950)); box-shadow: 0 18px 40px rgba(6, 47, 36, 0.2); }
.v2-state.is-processing { border: 1px solid #b9ddcb; color: var(--v2-green-950); background: #e8f7ef; }
.v2-state-check { display: grid; place-items: center; width: 3.1rem; height: 3.1rem; margin: 0 auto 0.6rem; border-radius: 999px; color: var(--v2-green-800); background: white; font-size: 1.6rem; font-weight: 800; }
.v2-state strong { display: block; font-size: 1rem; }
.v2-state p { margin: 0.4rem auto 0; max-width: 24rem; color: inherit; opacity: 0.88; font-size: 0.78rem; line-height: 1.5; }
.v2-security { display: flex; gap: 0.7rem; margin-top: 1.2rem; padding: 0.9rem; border-top: 1px solid var(--v2-line); color: var(--v2-muted); }
.v2-security > span { color: var(--v2-green-700); font-size: 1.3rem; }
.v2-security strong { color: #3a4e47; font-size: 0.78rem; }
.v2-security p { margin: 0.18rem 0 0; font-size: 0.68rem; line-height: 1.45; }
.v2-footer { padding: 1rem 0; color: #80908a; font-size: 0.65rem; text-align: center; }
.v2-footer a { color: var(--v2-green-700); }
.v2-method:focus-visible, .v2-choice:focus-visible, .v2-amounts a:focus-visible, .v2-language:focus-visible { outline: 3px solid rgba(10, 147, 99, 0.3); outline-offset: 2px; }
html[dir="rtl"] .v2-choice > b, html[dir="rtl"] .v2-method > b { transform: scaleX(-1); }
html[dir="rtl"] .v2-back { flex-direction: row-reverse; }
html[dir="rtl"] .v2-order-card, html[dir="rtl"] .v2-choice, html[dir="rtl"] .v2-method, html[dir="rtl"] .v2-security { text-align: start; }
.catalog-quality-review { grid-column: 1 / -1; margin: 0 1rem 1rem; padding: 0.75rem; border: 1px solid var(--line); border-radius: 0.8rem; background: var(--surface-muted); }
.catalog-quality-review > summary { cursor: pointer; color: var(--ink); font-weight: 750; }
.catalog-quality-review form { margin-top: 0.85rem; }
@media (min-width: 700px) {
  .v2-shell { padding-inline: 0; }
}
@media (max-width: 360px) {
  .v2-order-card { grid-template-columns: 3.2rem minmax(0, 1fr); }
  .v2-order-image { width: 3.2rem; height: 3.2rem; }
  .v2-order-amount { grid-column: 2; }
}

/* V2 payment manual-review controls: keep the evidence note and final actions
   usable inside the stacked admin payment table without widening mobile pages. */
.payment-review-form {
  display: grid;
  gap: 0.5rem;
  min-width: 15rem;
}

.payment-review-form input {
  width: 100%;
  min-width: 0;
}

.payment-review-form .actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

/* Stability revision: readable operator workflow, same approved CityGo theme. */
.cg-topup-list{display:grid;gap:20px}.cg-topup-grid{display:grid;grid-template-columns:minmax(0,1fr) minmax(280px,1fr);gap:28px;padding:24px}.cg-topup-details{margin:18px 0}.cg-topup-details>div{display:flex;justify-content:space-between;gap:20px;padding:8px 0;border-bottom:1px solid #e8edf1}.cg-topup-details dt{color:#64748b}.cg-topup-details dd{margin:0;font-weight:600;overflow-wrap:anywhere}.cg-topup-task input:not([type=checkbox]),.cg-topup-task textarea{width:100%;box-sizing:border-box}.cg-topup-task p{overflow-wrap:anywhere}.cg-topup-task .stack-form{display:grid;gap:12px}.cg-topup-task small{overflow-wrap:anywhere}
@media(max-width:800px){.cg-topup-grid{grid-template-columns:1fr;padding:18px;gap:20px}.cg-topup-task .cg-card-head{align-items:flex-start;gap:12px}}
:root .cg-skip-link{position:fixed;inset:8px auto auto 8px;z-index:10000;transform:translateY(-180%);padding:12px 18px;background:#fff;color:#064d2e;border:2px solid #064d2e;border-radius:8px;font-size:16px}
:root .cg-skip-link:focus{transform:translateY(0)}
