/* ═══════════ Reset & Tokens ═══════════ */
* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #f4f6fb;
  --card: #ffffff;
  --text: #0f172a;
  --text-2: #64748b;
  --text-3: #94a3b8;
  --border: #e5e7eb;
  --border-strong: #d1d5db;
  --primary: #4f46e5;
  --primary-dark: #4338ca;
  --primary-light: #eef2ff;
  --success: #10b981;
  --success-dark: #059669;
  --success-bg: #ecfdf5;
  --warning: #f59e0b;
  --warning-bg: #fffbeb;
  --danger: #ef4444;
  --danger-bg: #fef2f2;
  --shadow: 0 4px 16px rgba(15,23,42,0.06);
  --shadow-lg: 0 20px 40px -12px rgba(15,23,42,0.15);
  --radius: 16px;
  --radius-sm: 10px;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', Roboto, sans-serif;
}

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

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  font-size: 15px;
  line-height: 1.5;
  min-height: 100vh;
}

body.font-large  { font-size: 17px; }
body.font-xlarge { font-size: 19px; }
body.font-xlarge .amount-display .value { font-size: 3rem; }
body.font-xlarge .card-title { font-size: 1.5rem; }
body.font-xlarge .success-amount { font-size: 3rem; }

img, svg { max-width: 100%; display: block; }
.hidden { display: none !important; }

/* ═══════════ Offline banner ═══════════ */
.offline-banner {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 200;
  padding: 10px 16px;
  background: #fef3c7;
  color: #92400e;
  font-size: 0.85rem;
  font-weight: 600;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-bottom: 1px solid #fde68a;
}
.offline-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #f59e0b;
  animation: pulse 1.4s infinite ease-in-out;
}
body.is-offline { padding-top: 40px; }

/* ═══════════ Confetti canvas ═══════════ */
.confetti-canvas {
  position: fixed;
  inset: 0;
  width: 100vw; height: 100vh;
  pointer-events: none;
  z-index: 300;
}

/* ═══════════ Topbar ═══════════ */
.topbar {
  background: #fff;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 10;
  backdrop-filter: saturate(180%) blur(8px);
}
.topbar-inner {
  max-width: 1040px; margin: 0 auto;
  padding: 12px 16px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px;
}
.brand {
  display: flex; align-items: center; gap: 8px;
  font-weight: 700; font-size: 0.95rem;
  letter-spacing: -0.01em;
  min-width: 0;
}
.brand-mark {
  width: 28px; height: 28px; border-radius: 8px;
  background: linear-gradient(135deg, var(--primary), #7c3aed);
  color: #fff; display: grid; place-items: center;
  font-weight: 700; font-size: 0.9rem;
  flex-shrink: 0;
}
.brand-link {
  display: flex; align-items: center; gap: 8px;
  color: inherit; text-decoration: none;
}
.topbar-right { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.user-chip {
  background: var(--primary-light); color: var(--primary);
  padding: 5px 10px; border-radius: 999px;
  font-size: 0.75rem; font-weight: 600;
  max-width: 120px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.icon-btn {
  padding: 6px 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* ═══════════ Settings panel ═══════════ */
.settings-panel {
  position: fixed;
  top: 58px;
  right: 16px;
  width: 280px;
  background: #fff;
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  z-index: 100;
  overflow: hidden;
  animation: slideDown 0.15s ease-out;
}
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.settings-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px;
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
  font-size: 0.88rem; font-weight: 700;
}
.settings-close {
  background: transparent; border: none;
  font-size: 1.4rem; line-height: 1;
  color: var(--text-2); cursor: pointer;
  padding: 0 4px;
}
.settings-body { padding: 14px 16px; }
.settings-label {
  font-size: 0.72rem; font-weight: 700;
  color: var(--text-3); text-transform: uppercase;
  letter-spacing: 0.04em; margin-bottom: 8px;
}
.settings-row { display: flex; gap: 6px; flex-wrap: wrap; }
.size-btn {
  flex: 1; min-width: 70px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1.5px solid var(--border);
  background: #fff;
  font-size: 0.8rem; font-weight: 600;
  color: var(--text-2);
  cursor: pointer;
  transition: all 0.15s;
}
.size-btn:hover { background: #f8fafc; }
.size-btn.active {
  background: var(--primary); color: #fff;
  border-color: var(--primary);
}

/* ═══════════ Buttons ═══════════ */
button { font-family: inherit; cursor: pointer; border: none; transition: all 0.15s; }

.btn-primary {
  width: 100%; padding: 14px 20px;
  background: var(--primary); color: #fff;
  font-size: 0.98rem; font-weight: 600;
  border-radius: var(--radius-sm);
  box-shadow: 0 1px 2px rgba(79,70,229,0.2);
  min-height: 48px;
}
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); }
.btn-primary:disabled { background: #c7d2fe; cursor: not-allowed; }
.btn-lg { padding: 15px 20px; font-size: 1rem; }

.btn-ghost {
  background: transparent; color: var(--text-2);
  padding: 8px 12px; font-size: 0.85rem;
  border-radius: 8px; font-weight: 500;
  text-decoration: none;
  display: inline-flex; align-items: center;
}
.btn-ghost:hover { background: #f1f5f9; color: var(--text); }

.btn-outline-danger {
  width: 100%; margin-top: 20px;
  padding: 13px 20px;
  background: transparent; color: var(--danger);
  border: 1.5px solid #fecaca;
  border-radius: var(--radius-sm);
  font-weight: 600; font-size: 0.95rem;
  min-height: 48px;
}
.btn-outline-danger:hover { background: var(--danger-bg); border-color: var(--danger); }

.btn-success-outline {
  width: 100%; margin-top: 12px;
  padding: 13px 20px;
  background: transparent;
  color: var(--success);
  border: 1.5px solid #a7f3d0;
  border-radius: var(--radius-sm);
  font-weight: 700; font-size: 0.95rem;
  min-height: 48px;
  transition: all 0.15s;
}
.btn-success-outline:hover:not(:disabled) {
  background: var(--success-bg);
  border-color: var(--success);
}
.btn-success-outline:disabled {
  opacity: 0.6;
  cursor: progress;
}

.btn-back {
  padding: 9px 16px;
  background: var(--primary-light); color: var(--primary);
  border-radius: 10px; text-decoration: none;
  font-size: 0.88rem; font-weight: 600;
  white-space: nowrap;
}
.btn-back:hover { background: #dbe4ff; }

/* ═══════════ Layout ═══════════ */
.main {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  padding: 20px 16px 48px;
}
.main-wide { max-width: 960px; }

.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 24px 20px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}
.card-title { font-size: 1.25rem; font-weight: 700; letter-spacing: -0.02em; }
.card-subtitle { color: var(--text-2); font-size: 0.88rem; margin-top: 4px; margin-bottom: 22px; }

/* ═══════════ Inputs ═══════════ */
.field { margin-bottom: 14px; }
.field label {
  display: block; font-size: 0.78rem; font-weight: 600;
  color: var(--text-2); margin-bottom: 8px;
  text-transform: uppercase; letter-spacing: 0.03em;
}

.amount-input-wrap {
  position: relative; display: flex; align-items: center;
  background: #f8fafc;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color 0.15s, background 0.15s;
}
.amount-input-wrap:focus-within {
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(79,70,229,0.08);
}
.currency-prefix {
  padding: 0 4px 0 16px;
  font-size: 1.3rem; font-weight: 600; color: var(--text-2);
}
#amount {
  flex: 1; min-width: 0;
  padding: 15px 16px 15px 4px;
  border: none; background: transparent;
  font-size: 1.4rem; font-weight: 700; color: var(--text);
  outline: none; font-family: inherit;
  letter-spacing: -0.02em;
  -webkit-appearance: none;
  appearance: none;
  border-radius: 0;
}
#amount::placeholder { color: #cbd5e1; font-weight: 600; }

/* ═══════════ Password toggle ═══════════ */
.password-wrap { position: relative; }
.password-wrap input { padding-right: 44px !important; }
.password-toggle {
  position: absolute;
  top: 50%; right: 8px;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  padding: 6px;
  color: var(--text-3);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: color 0.15s, background 0.15s;
}
.password-toggle:hover { color: var(--text-2); background: #f1f5f9; }
.password-toggle:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
.password-toggle svg { width: 18px; height: 18px; display: block; }

/* ═══════════ Quick-tap presets ═══════════ */
.presets {
  display: flex; gap: 6px; flex-wrap: wrap;
  margin-bottom: 16px;
}
.preset-btn {
  flex: 1; min-width: 60px;
  padding: 9px 10px;
  background: #fff;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 0.85rem; font-weight: 700;
  color: var(--text-2);
  cursor: pointer;
  transition: all 0.15s;
}
.preset-btn:hover {
  background: var(--primary-light);
  color: var(--primary);
  border-color: var(--primary);
}
.preset-btn:active { transform: scale(0.97); }

/* ═══════════ Breakdown ═══════════ */
.breakdown {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-bottom: 18px;
}
.breakdown-row {
  display: flex; justify-content: space-between;
  padding: 5px 0; font-size: 0.88rem; color: var(--text-2);
  gap: 8px;
}
.breakdown-row.total {
  border-top: 1px dashed var(--border-strong);
  margin-top: 6px; padding-top: 10px;
  font-weight: 700; color: var(--text); font-size: 0.98rem;
}
.breakdown-row.total span:last-child { color: var(--primary); }

/* ═══════════ QR Card ═══════════ */
.qr-card { position: relative; padding-top: 28px; overflow: hidden; }

.timer-bar {
  position: absolute; top: 0; left: 0; right: 0; height: 4px;
  background: #f1f5f9; overflow: hidden;
}
.timer-bar-fill {
  height: 100%; width: 100%;
  background: linear-gradient(90deg, var(--primary), #7c3aed);
  transition: width 1s linear;
}

.payee-block {
  display: flex; align-items: center; gap: 12px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}
.payee-avatar {
  width: 42px; height: 42px; border-radius: 12px;
  background: linear-gradient(135deg, var(--primary), #7c3aed);
  color: #fff; display: grid; place-items: center;
  font-weight: 700; font-size: 1rem;
  flex-shrink: 0;
}
.payee-info { display: flex; flex-direction: column; min-width: 0; }
.payee-label {
  font-size: 0.72rem; color: var(--text-3);
  text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600;
}
.payee-name {
  font-weight: 700; color: var(--text); font-size: 0.95rem;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.amount-display {
  text-align: center; margin-bottom: 2px;
  letter-spacing: -0.03em;
}
.amount-display .currency {
  font-size: 1.3rem; font-weight: 600; color: var(--text-2);
  vertical-align: top; margin-right: 2px;
}
.amount-display .value { font-size: 2.4rem; font-weight: 800; color: var(--text); }

.amount-breakdown {
  text-align: center; color: var(--text-3);
  font-size: 0.82rem; margin-bottom: 20px;
}

.qr-wrapper {
  position: relative;
  width: 100%;
  max-width: 300px;
  aspect-ratio: 1 / 1;
  margin: 0 auto;
  padding: 10px;
  background: #ffffff;
  border-radius: 14px;
  border: 1px solid var(--border);
}
#qr-container {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  background: #ffffff;
  overflow: hidden;
}
#qr-container svg {
  width: 100% !important;
  height: 100% !important;
  display: block;
  shape-rendering: crispEdges;
  image-rendering: pixelated;
}
#qr-container svg path { shape-rendering: crispEdges; }

.corner {
  position: absolute;
  width: 20px; height: 20px;
  border: 3px solid var(--primary);
  border-radius: 6px;
  pointer-events: none;
  z-index: 2;
}
.corner.tl { top: -3px; left: -3px; border-right: none; border-bottom: none; }
.corner.tr { top: -3px; right: -3px; border-left: none; border-bottom: none; }
.corner.bl { bottom: -3px; left: -3px; border-right: none; border-top: none; }
.corner.br { bottom: -3px; right: -3px; border-left: none; border-top: none; }

.scan-hint {
  text-align: center; margin-top: 14px;
  color: var(--text-2); font-size: 0.82rem; font-weight: 500;
}

.app-row {
  display: flex; justify-content: center; gap: 6px;
  margin-top: 10px; flex-wrap: wrap;
}
.app-pill {
  padding: 4px 10px;
  background: #f1f5f9;
  color: var(--text-2);
  border-radius: 999px;
  font-size: 0.72rem; font-weight: 600;
}

/* ═══════════ Status Line ═══════════ */
.status-line {
  display: flex; align-items: center; justify-content: center;
  gap: 10px; margin-top: 18px;
  padding: 11px 14px;
  background: var(--warning-bg);
  border-radius: 12px;
  font-size: 0.88rem; font-weight: 500;
}
.status-dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--warning);
  flex-shrink: 0;
}
.status-dot.pending { animation: pulse 1.6s infinite ease-in-out; }
.status-dot.success { background: var(--success); animation: none; }
.status-dot.expired,
.status-dot.cancelled { background: var(--danger); animation: none; }

.status-line:has(.status-dot.success) { background: var(--success-bg); }
.status-line:has(.status-dot.expired),
.status-line:has(.status-dot.cancelled) { background: var(--danger-bg); }

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(245,158,11,0.6); }
  50% { box-shadow: 0 0 0 8px rgba(245,158,11,0); }
}

.status-text { color: #92400e; font-weight: 600; font-size: 0.85rem; }
.status-text.success { color: #065f46; }
.status-text.expired,
.status-text.cancelled { color: #991b1b; }

.timer-text {
  margin-left: auto; font-variant-numeric: tabular-nums;
  font-weight: 700; color: var(--text-2); font-size: 0.85rem;
  flex-shrink: 0;
}

/* ═══════════ Success Screen — Razorpay-style ═══════════ */
.success-card {
  position: relative;
  background: var(--card);
  border-radius: var(--radius);
  padding: 48px 32px 32px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  text-align: center;
  overflow: hidden;
  animation: successCardIn 0.4s cubic-bezier(0.2, 0.9, 0.3, 1) both;
}
@keyframes successCardIn {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

.success-accent {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--success), var(--success-dark));
  border-radius: var(--radius) var(--radius) 0 0;
}
.success-card.cancelled .success-accent {
  background: linear-gradient(90deg, #64748b, #475569);
}
.success-card.expired .success-accent {
  background: linear-gradient(90deg, var(--danger), #dc2626);
}

.success-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 28px;
  display: grid;
  place-items: center;
  color: var(--success);
  animation: successPop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
@keyframes successPop {
  0%   { transform: scale(0.4); opacity: 0; }
  60%  { transform: scale(1.12); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}
.success-icon svg {
  width: 56px;
  height: 56px;
  stroke-width: 2.5;
}
.success-card.cancelled .success-icon { color: #64748b; }
.success-card.expired   .success-icon { color: var(--danger); }

.success-amount-wrap {
  margin-bottom: 4px;
}
.success-amount {
  font-size: 2.75rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text);
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.success-label {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 6px;
  letter-spacing: -0.01em;
}

.success-sublabel {
  font-size: 0.88rem;
  color: var(--text-3);
  line-height: 1.5;
  margin-bottom: 26px;
  max-width: 300px;
  margin-left: auto;
  margin-right: auto;
}

.success-details {
  text-align: left;
  padding: 14px 18px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 24px;
}

.success-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 7px 0;
  font-size: 0.9rem;
  color: var(--text-2);
}
.success-row:first-child { padding-top: 0; }
.success-row:last-child  { padding-bottom: 0; }

.success-row span:last-child {
  color: var(--text);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-align: right;
  word-break: break-word;
}

.success-row span.mono {
  font-family: 'SF Mono', ui-monospace, Menlo, monospace;
  font-size: 0.82rem;
  font-weight: 500;
  max-width: 55%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.success-cta {
  width: 100%;
  padding: 15px 20px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  min-height: 52px;
  font-family: inherit;
  transition: background 0.15s;
}
.success-cta:hover { background: var(--primary-dark); }

.success-card.cancelled .success-amount-wrap,
.success-card.expired   .success-amount-wrap {
  display: none;
}

.success-card.cancelled .success-label,
.success-card.expired   .success-label {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
  margin-top: 4px;
  letter-spacing: -0.02em;
}

.success-card.cancelled .success-sublabel,
.success-card.expired   .success-sublabel {
  margin-bottom: 32px;
}

.success-card.cancelled .success-details,
.success-card.expired   .success-details {
  display: none;
}

/* ═══════════ Auth Page ═══════════ */
.auth-page {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; padding: 20px 16px;
  background: linear-gradient(180deg, #eef2ff 0%, #f4f6fb 100%);
}
.auth-card {
  background: var(--card);
  border-radius: 20px;
  padding: 32px 24px;
  max-width: 400px; width: 100%;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  text-align: center;
}
.auth-logo { display: flex; justify-content: center; margin-bottom: 18px; }
.logo-mark {
  width: 52px; height: 52px; border-radius: 16px;
  background: linear-gradient(135deg, var(--primary), #7c3aed);
  color: #fff; display: grid; place-items: center;
  font-size: 1.5rem; font-weight: 800;
  box-shadow: 0 8px 20px -8px rgba(79,70,229,0.5);
}
.auth-title { font-size: 1.4rem; font-weight: 700; letter-spacing: -0.02em; margin-bottom: 4px; }
.auth-subtitle { color: var(--text-2); font-size: 0.88rem; margin-bottom: 26px; }
.auth-card .field { text-align: left; }
.auth-card input {
  width: 100%; padding: 13px 16px;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  font-size: 1rem; font-family: inherit; color: var(--text);
  background: #f8fafc; outline: none;
  transition: border-color 0.15s, background 0.15s;
}
.auth-card input:focus {
  border-color: var(--primary); background: #fff;
  box-shadow: 0 0 0 4px rgba(79,70,229,0.08);
}
.auth-footer { margin-top: 18px; color: var(--text-3); font-size: 0.8rem; }
.remember-bar {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: -6px; margin-bottom: 14px;
  font-size: 0.78rem; color: var(--text-3);
}
.remember-link {
  color: var(--primary); text-decoration: none; font-weight: 600;
  cursor: pointer; background: none; border: none; padding: 0;
  font-size: inherit; font-family: inherit;
}
.remember-link:hover { text-decoration: underline; }

/* ═══════════ Alerts ═══════════ */
.alert {
  padding: 11px 14px;
  background: var(--danger-bg);
  color: #991b1b;
  border-radius: var(--radius-sm);
  font-size: 0.85rem; font-weight: 500;
  margin-bottom: 14px;
  border: 1px solid #fecaca;
}

/* ═══════════ Turnstile ═══════════ */
.turnstile-wrap {
  margin-bottom: 16px;
  display: flex;
  justify-content: center;
}
.cf-turnstile { width: 100%; }

/* ═══════════ History: detail modal ═══════════ */
.detail-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1200;
  background: rgba(15,23,42,0.5);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  transition: opacity 0.18s ease;
}
.detail-backdrop.detail-in { opacity: 1; }
.detail-modal {
  background: #fff;
  border-radius: 16px;
  width: 100%;
  max-width: 440px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 25px 60px -20px rgba(15,23,42,0.4);
  transform: scale(0.96);
  transition: transform 0.18s ease;
}
.detail-backdrop.detail-in .detail-modal { transform: scale(1); }
.detail-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  position: relative;
}
.detail-head-success   { background: var(--success-bg); }
.detail-head-pending   { background: var(--warning-bg); }
.detail-head-expired   { background: var(--danger-bg); }
.detail-head-cancelled { background: #f1f5f9; }
.detail-head-icon {
  width: 40px; height: 40px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 1.25rem;
  font-weight: 700;
  flex-shrink: 0;
}
.detail-head-success   .detail-head-icon { background: var(--success); color: #fff; }
.detail-head-pending   .detail-head-icon { background: var(--warning); color: #fff; }
.detail-head-expired   .detail-head-icon { background: var(--danger); color: #fff; }
.detail-head-cancelled .detail-head-icon { background: #64748b; color: #fff; }
.detail-head-info { flex: 1; min-width: 0; }
.detail-head-title {
  font-size: 1rem; font-weight: 700; color: var(--text);
  letter-spacing: -0.01em;
  margin-bottom: 2px;
}
.detail-head-sub {
  font-size: 0.78rem; color: var(--text-2);
  font-family: 'SF Mono', ui-monospace, Menlo, monospace;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.detail-close {
  position: absolute;
  top: 12px; right: 12px;
  width: 28px; height: 28px;
  border-radius: 8px;
  background: rgba(255,255,255,0.6);
  border: none;
  color: var(--text-2);
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
  display: grid; place-items: center;
}
.detail-close:hover { background: rgba(255,255,255,0.95); color: var(--text); }
.detail-body { padding: 16px 20px; }
.detail-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 8px 0;
  font-size: 0.9rem;
  color: var(--text-2);
}
.detail-row b {
  color: var(--text);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-align: right;
  word-break: break-word;
}
.detail-row.detail-total {
  border-top: 1px dashed var(--border-strong);
  margin-top: 6px;
  padding-top: 12px;
  font-size: 1rem;
  font-weight: 700;
}
.detail-row.detail-total b { color: var(--primary); font-size: 1.05rem; }
.detail-row.detail-sm { font-size: 0.82rem; padding: 6px 0; }
.detail-row.detail-sm b { font-size: 0.82rem; }
.detail-row b.mono {
  font-family: 'SF Mono', ui-monospace, Menlo, monospace;
  font-size: 0.75rem;
  max-width: 60%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.detail-divider {
  height: 1px;
  background: var(--border);
  margin: 10px 0;
}
.detail-actions {
  padding: 14px 20px 18px;
  display: flex;
  justify-content: flex-end;
}
.detail-close-btn {
  padding: 10px 22px;
  border-radius: 10px;
  background: var(--primary);
  color: #fff;
  border: none;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}
.detail-close-btn:hover { background: var(--primary-dark); }

/* ═══════════ Skeletons ═══════════ */
.skeleton-line {
  display: block;
  height: 0.9em;
  border-radius: 6px;
  background: linear-gradient(90deg, #eef2f7 0%, #e2e8f0 50%, #eef2f7 100%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite linear;
}
.skeleton-row td { padding-top: 14px !important; padding-bottom: 14px !important; }
@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ═══════════ Toasts ═══════════ */
.toast-container {
  position: fixed;
  top: 16px; right: 16px;
  z-index: 1000;
  display: flex; flex-direction: column;
  gap: 10px;
  pointer-events: none;
  max-width: calc(100vw - 32px);
}
.toast {
  display: flex; align-items: flex-start; gap: 10px;
  min-width: 260px;
  max-width: 380px;
  padding: 12px 14px;
  background: #fff;
  color: var(--text);
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  border-radius: 12px;
  box-shadow: 0 10px 30px -10px rgba(15,23,42,0.25);
  font-size: 0.88rem;
  font-weight: 500;
  pointer-events: auto;
  opacity: 0;
  transform: translateX(20px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.toast.toast-in { opacity: 1; transform: translateX(0); }
.toast.toast-out { opacity: 0; transform: translateX(20px); }
.toast-icon {
  flex-shrink: 0;
  width: 20px; height: 20px;
  display: inline-flex; align-items: center; justify-content: center;
  margin-top: 1px;
}
.toast-message { flex: 1; line-height: 1.4; word-break: break-word; }
.toast-close {
  flex-shrink: 0;
  background: transparent; border: none;
  color: var(--text-3);
  cursor: pointer;
  padding: 2px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.toast-close:hover { color: var(--text-2); background: #f1f5f9; }
.toast-success { border-left-color: var(--success); }
.toast-success .toast-icon { color: var(--success); }
.toast-error   { border-left-color: var(--danger); }
.toast-error   .toast-icon { color: var(--danger); }
.toast-warning { border-left-color: var(--warning); }
.toast-warning .toast-icon { color: var(--warning); }
.toast-info    { border-left-color: var(--primary); }
.toast-info    .toast-icon { color: var(--primary); }

/* ═══════════ Confirm modal ═══════════ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1100;
  background: rgba(15,23,42,0.5);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  transition: opacity 0.16s ease;
}
.modal-backdrop.modal-in { opacity: 1; }
.modal {
  background: #fff;
  border-radius: 16px;
  padding: 24px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 25px 60px -20px rgba(15,23,42,0.35);
  transform: scale(0.95);
  transition: transform 0.16s ease;
}
.modal-backdrop.modal-in .modal { transform: scale(1); }
.modal-title {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
  color: var(--text);
}
.modal-message {
  font-size: 0.9rem;
  color: var(--text-2);
  line-height: 1.5;
  margin-bottom: 22px;
  white-space: pre-line;
}
.modal-actions {
  display: flex; gap: 8px;
  justify-content: flex-end;
  flex-wrap: wrap;
}
.modal-btn {
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  min-width: 84px;
  transition: all 0.15s;
}
.modal-btn-ghost {
  background: #fff;
  color: var(--text-2);
  border: 1px solid var(--border);
}
.modal-btn-ghost:hover { background: #f8fafc; color: var(--text); }
.modal-btn-primary {
  background: var(--primary);
  color: #fff;
  border: 1px solid var(--primary);
}
.modal-btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.modal-btn-danger {
  background: var(--danger);
  color: #fff;
  border: 1px solid var(--danger);
}
.modal-btn-danger:hover { background: #b91c1c; border-color: #b91c1c; }

/* ═══════════ Load-more pagination ═══════════ */
.load-more-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 18px;
  color: var(--text-3);
  font-size: 0.85rem;
  font-weight: 500;
  border-top: 1px solid var(--border);
}
.load-more-sentinel {
  height: 40px;
  width: 100%;
  pointer-events: none;
}
.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid #e2e8f0;
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ═══════════ Maintenance Page ═══════════ */
.maint-body {
  min-height: 100vh;
  background: radial-gradient(ellipse at top, #1e1b4b, #0b1020 60%);
  color: #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  overflow: hidden;
  position: relative;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', Roboto, sans-serif;
}
.maint-page { position: relative; width: 100%; max-width: 520px; }
.maint-orb {
  position: fixed; border-radius: 50%;
  filter: blur(80px); opacity: 0.55;
  pointer-events: none; z-index: 0;
}
.maint-orb-a { width: 420px; height: 420px; top: -120px; left: -120px; background: radial-gradient(circle, #6366f1, transparent 70%); animation: maint-drift-a 18s ease-in-out infinite; }
.maint-orb-b { width: 380px; height: 380px; bottom: -100px; right: -100px; background: radial-gradient(circle, #8b5cf6, transparent 70%); animation: maint-drift-b 22s ease-in-out infinite; }
.maint-orb-c { width: 300px; height: 300px; top: 50%; left: 50%; transform: translate(-50%,-50%); background: radial-gradient(circle, #22d3ee, transparent 70%); animation: maint-drift-c 26s ease-in-out infinite; opacity: 0.35; }
@keyframes maint-drift-a { 0%,100% { transform: translate(0,0); } 50% { transform: translate(60px,80px); } }
@keyframes maint-drift-b { 0%,100% { transform: translate(0,0); } 50% { transform: translate(-70px,-50px); } }
@keyframes maint-drift-c { 0%,100% { transform: translate(-50%,-50%) scale(1); } 50% { transform: translate(-50%,-50%) scale(1.15); } }

.maint-particles { position: fixed; inset: 0; pointer-events: none; z-index: 1; }
.maint-particle { position: absolute; width: 4px; height: 4px; background: #22d3ee; border-radius: 50%; opacity: 0; animation: maint-float-up linear infinite; }
@keyframes maint-float-up {
  0% { opacity: 0; transform: translateY(0) scale(0.5); }
  15% { opacity: 0.9; }
  85% { opacity: 0.9; }
  100% { opacity: 0; transform: translateY(-110vh) scale(1.2); }
}

.maint-card {
  position: relative; z-index: 2;
  padding: 44px 36px 36px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 24px;
  backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
  box-shadow: 0 30px 80px -20px rgba(0,0,0,0.6);
  text-align: center;
  animation: maint-card-in 0.7s cubic-bezier(0.2, 0.9, 0.3, 1) both;
}
@keyframes maint-card-in { from { opacity: 0; transform: translateY(20px) scale(0.97); } to { opacity: 1; transform: translateY(0) scale(1); } }

.maint-pill { display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px; background: rgba(245,158,11,0.1); border: 1px solid rgba(245,158,11,0.3); border-radius: 999px; font-size: 0.75rem; font-weight: 600; color: #fcd34d; margin-bottom: 20px; }
.maint-pill-dot { width: 7px; height: 7px; border-radius: 50%; background: #f59e0b; animation: maint-pulse 1.6s infinite; }
@keyframes maint-pulse { 0% { box-shadow: 0 0 0 0 rgba(245,158,11,0.7); } 70% { box-shadow: 0 0 0 10px rgba(245,158,11,0); } 100% { box-shadow: 0 0 0 0 rgba(245,158,11,0); } }

.maint-icon-wrap { position: relative; width: 96px; height: 96px; margin: 0 auto 28px; display: grid; place-items: center; }
.maint-ring { position: absolute; inset: 0; border-radius: 50%; border: 2px solid #8b5cf6; opacity: 0.5; animation: maint-ring 2.4s ease-out infinite; }
.maint-ring:nth-child(2) { animation-delay: 0.8s; }
.maint-ring:nth-child(3) { animation-delay: 1.6s; }
@keyframes maint-ring { 0% { transform: scale(0.6); opacity: 0.7; } 80% { transform: scale(1.6); opacity: 0; } 100% { transform: scale(1.6); opacity: 0; } }

.maint-badge { position: relative; width: 72px; height: 72px; border-radius: 50%; background: linear-gradient(135deg, #6366f1, #8b5cf6); display: grid; place-items: center; box-shadow: 0 12px 30px -8px rgba(139,92,246,0.6); z-index: 1; }
.maint-gear { width: 34px; height: 34px; animation: maint-spin 4s linear infinite; color: #fff; }
@keyframes maint-spin { to { transform: rotate(360deg); } }

.maint-title { font-size: 1.75rem; font-weight: 800; letter-spacing: -0.02em; margin-bottom: 10px; background: linear-gradient(135deg, #ffffff 30%, #c7d2fe 100%); -webkit-background-clip: text; background-clip: text; color: transparent; }
.maint-subtitle { font-size: 0.95rem; color: #94a3b8; line-height: 1.55; margin-bottom: 22px; }

.maint-reason-box { padding: 16px 18px; background: rgba(99,102,241,0.08); border: 1px solid rgba(99,102,241,0.25); border-radius: 14px; margin-bottom: 24px; text-align: left; }
.maint-reason-label { display: block; font-size: 0.68rem; letter-spacing: 0.12em; text-transform: uppercase; color: #a5b4fc; font-weight: 700; margin-bottom: 6px; }
.maint-reason-text { font-size: 0.95rem; color: #e0e7ff; font-weight: 500; line-height: 1.5; white-space: pre-line; }

.maint-progress-wrap { margin-bottom: 22px; }
.maint-progress-label { font-size: 0.82rem; color: #94a3b8; margin-bottom: 10px; display: flex; justify-content: space-between; }
.maint-progress-label b { color: #c7d2fe; font-weight: 700; }
.maint-progress-bar { height: 4px; background: rgba(255,255,255,0.06); border-radius: 999px; overflow: hidden; }
.maint-progress-fill { height: 100%; width: 0; background: linear-gradient(90deg, #6366f1, #22d3ee); border-radius: 999px; transition: width 1s linear; }

.maint-retry-btn { width: 100%; padding: 14px 20px; font-size: 0.98rem; font-weight: 700; color: #fff; background: linear-gradient(135deg, #6366f1, #8b5cf6); border: none; border-radius: 12px; cursor: pointer; box-shadow: 0 10px 24px -10px rgba(99,102,241,0.8); display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-family: inherit; transition: transform 0.15s, box-shadow 0.15s; }
.maint-retry-btn:hover { transform: translateY(-1px); box-shadow: 0 14px 30px -10px rgba(99,102,241,1); }
.maint-retry-btn svg { width: 18px; height: 18px; }

.maint-footer { margin-top: 22px; font-size: 0.75rem; color: rgba(148,163,184,0.6); }

/* ═══════════ Responsive ═══════════ */
@media (min-width: 480px) {
  .main { padding: 28px 20px 60px; }
  .card { padding: 28px 24px; }
  .success-card { padding: 56px 40px 36px; }
  .amount-display .value { font-size: 2.8rem; }
  .success-amount { font-size: 3rem; }
  .qr-wrapper { max-width: 320px; padding: 12px; }
  .topbar-inner { padding: 14px 20px; }
}

@media (max-width: 640px) {
  .main-wide { padding: 16px 12px 40px; }
}

@media (max-width: 480px) {
  .success-card {
    padding: 40px 24px 24px;
  }
  .success-amount { font-size: 2.25rem; }
  .success-card.cancelled .success-label,
  .success-card.expired   .success-label {
    font-size: 1.3rem;
  }
  .success-icon { width: 56px; height: 56px; margin-bottom: 22px; }
  .success-icon svg { width: 48px; height: 48px; }
  .success-sublabel { font-size: 0.85rem; margin-bottom: 22px; }
}

@media (max-width: 420px) {
  .user-chip { display: none; }
  .topbar-right { gap: 2px; }
  .btn-ghost { padding: 6px 8px; font-size: 0.8rem; }
  .toast-container { top: auto; bottom: 16px; left: 16px; right: 16px; max-width: none; }
  .toast { min-width: 0; max-width: none; }
}


@media (max-width: 360px) {
  body { font-size: 14px; }
  .main { padding: 16px 12px 40px; }
  .card { padding: 20px 16px; border-radius: 14px; }
  .amount-display .value { font-size: 2.1rem; }
  .amount-display .currency { font-size: 1.15rem; }
  .qr-wrapper { max-width: 260px; padding: 8px; }
  .preset-btn { font-size: 0.78rem; padding: 8px; }
  .settings-panel { width: calc(100vw - 24px); right: 12px; }
  .success-card { padding: 36px 20px 20px; }
  .success-amount { font-size: 2rem; }
}

@media (max-height: 500px) and (orientation: landscape) {
  .main { padding: 12px 16px 24px; }
  .qr-wrapper { max-width: 220px; }
}

@media (min-width: 1024px) {
  .main { padding: 40px 20px 80px; }
}

/* ═══════════ Accessibility ═══════════ */
@media (prefers-reduced-motion: reduce) {
  .toast,
  .modal-backdrop,
  .modal,
  .skeleton-line,
  .success-card,
  .success-icon,
  .status-dot,
  .spinner,
  .maint-orb,
  .maint-ring,
  .maint-gear,
  .maint-particle,
  .maint-pill-dot,
  .maint-card {
    animation: none !important;
    transition: none !important;
  }
  .toast { opacity: 1; transform: none; }
  .success-card { opacity: 1; transform: none; }
  .success-icon { opacity: 1; transform: none; }
}

/* ═══════════ History page (v3) — matches the payment screen: same cards, radius, gradient accent ═══════════ */
.hx-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.hx-title h1 { font-size: 1.25rem; font-weight: 700; letter-spacing: -0.02em; }
.hx-title p { color: var(--text-2); font-size: 0.85rem; margin-top: 2px; }
.hx-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.hx-monthnav {
  display: flex; align-items: center; gap: 2px; padding: 4px;
  background: var(--card); border: 1px solid var(--border); border-radius: 999px; box-shadow: var(--shadow);
}
.hx-nav-btn {
  width: 34px; height: 34px; border-radius: 50%; border: 0; background: transparent;
  color: var(--text-2); font-size: 1.15rem; line-height: 1; cursor: pointer; display: grid; place-items: center;
  transition: background 0.15s, color 0.15s;
}
.hx-nav-btn:hover:not(:disabled) { background: var(--primary-light); color: var(--primary); }
.hx-nav-btn:disabled { opacity: 0.3; cursor: default; }
.hx-month-label { min-width: 132px; text-align: center; font-weight: 700; font-size: 0.92rem; letter-spacing: -0.01em; }
.hx-icon-btn {
  height: 42px; padding: 0 14px; border-radius: 999px; background: var(--card); border: 1px solid var(--border);
  color: var(--text-2); font-size: 0.82rem; font-weight: 600; cursor: pointer; box-shadow: var(--shadow);
  display: inline-flex; align-items: center; gap: 6px; transition: all 0.15s;
}
.hx-icon-btn:hover:not(:disabled) { background: var(--primary-light); color: var(--primary); border-color: var(--primary); }
.hx-icon-btn:disabled { opacity: 0.5; cursor: progress; }
.hx-icon-btn.spinning .hx-spin { animation: spin 0.8s linear infinite; display: inline-block; }

.hx-hero {
  position: relative; overflow: hidden; color: #fff; margin-bottom: 12px;
  background: linear-gradient(135deg, var(--primary), #7c3aed);
  border-radius: var(--radius); padding: 20px 22px; box-shadow: var(--shadow-lg);
}
.hx-hero::after {
  content: ''; position: absolute; right: -50px; top: -60px; width: 190px; height: 190px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.1); pointer-events: none;
}
.hx-hero-label { font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.07em; font-weight: 600; opacity: 0.85; }
.hx-hero-value { font-size: 2.1rem; font-weight: 800; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; line-height: 1.15; margin-top: 2px; }
.hx-hero-sub { font-size: 0.82rem; opacity: 0.9; margin-top: 4px; }
.hx-spark { display: flex; align-items: flex-end; gap: 3px; height: 46px; margin-top: 16px; position: relative; z-index: 1; }
.hx-spark span { flex: 1; min-width: 3px; border-radius: 3px 3px 0 0; background: rgba(255, 255, 255, 0.28); }
.hx-spark span.has { background: rgba(255, 255, 255, 0.85); }

.hx-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.hx-stat {
  background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 12px 14px;
  box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 2px; border-top: 3px solid var(--border-strong);
}
.hx-stat.s-success { border-top-color: var(--success); }
.hx-stat.s-pending { border-top-color: var(--warning); }
.hx-stat.s-failed  { border-top-color: var(--danger); }
.hx-stat-label { font-size: 0.7rem; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600; }
.hx-stat-value { font-size: 1.3rem; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.hx-stat-sub { font-size: 0.72rem; color: var(--text-3); font-variant-numeric: tabular-nums; }

.hx-toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.hx-search { position: relative; flex: 1 1 200px; min-width: 0; }
.hx-search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--text-3); pointer-events: none; }
.hx-search input {
  width: 100%; padding: 10px 12px 10px 36px; background: var(--card); border: 1px solid var(--border);
  border-radius: 12px; font: inherit; font-size: 0.9rem; color: var(--text); outline: none; transition: border-color 0.15s, box-shadow 0.15s;
}
.hx-search input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }
.hx-pills { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.hx-pills::-webkit-scrollbar { display: none; }
.hx-pill {
  flex-shrink: 0; padding: 7px 12px; background: var(--card); border: 1px solid var(--border); border-radius: 999px;
  font-size: 0.8rem; font-weight: 600; color: var(--text-2); cursor: pointer; transition: all 0.15s; white-space: nowrap;
}
.hx-pill em { font-style: normal; font-weight: 700; opacity: 0.6; margin-left: 4px; font-variant-numeric: tabular-nums; }
.hx-pill:hover { background: #f8fafc; }
.hx-pill.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.hx-pill.active em { opacity: 0.85; }

.hx-day { background: var(--card); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow); overflow: hidden; overflow: clip; margin-bottom: 12px; }
.hx-day-head {
  display: flex; justify-content: space-between; align-items: center; gap: 10px; width: 100%;
  padding: 11px 16px; background: #f8fafc; border: 0; border-bottom: 1px solid var(--border);
  font: inherit; text-align: left; cursor: pointer; position: sticky; top: 57px; z-index: 2;
}
.hx-day.collapsed .hx-day-head { border-bottom-color: transparent; }
.hx-day-title { font-weight: 700; font-size: 0.9rem; letter-spacing: -0.01em; color: var(--text); }
.hx-day-meta { font-size: 0.74rem; color: var(--text-3); margin-top: 1px; }
.hx-day-right { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.hx-day-total { font-weight: 700; color: var(--primary); font-variant-numeric: tabular-nums; font-size: 0.95rem; }
.hx-chev { width: 16px; height: 16px; color: var(--text-3); transition: transform 0.18s; }
.hx-day.collapsed .hx-chev { transform: rotate(-90deg); }
.hx-day.collapsed .hx-rows { display: none; }

.hx-row {
  display: grid; grid-template-columns: 40px 1fr auto; gap: 12px; align-items: center; width: 100%;
  padding: 12px 16px; background: none; border: 0; border-bottom: 1px solid var(--border);
  font: inherit; text-align: left; cursor: pointer; transition: background 0.12s;
}
.hx-row:last-child { border-bottom: 0; }
.hx-row:hover { background: #f8fafc; }
.hx-row:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
.hx-ico { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 1rem; }
.hx-ico.s-success   { background: var(--success-bg); color: var(--success-dark); }
.hx-ico.s-pending   { background: var(--warning-bg); color: #b45309; }
.hx-ico.s-expired, .hx-ico.s-cancelled { background: var(--danger-bg); color: var(--danger); }
.hx-main { min-width: 0; }
.hx-main-top { font-weight: 700; font-size: 0.95rem; font-variant-numeric: tabular-nums; color: var(--text); }
.hx-main-top small { font-weight: 500; color: var(--text-3); font-size: 0.74rem; margin-left: 6px; }
.hx-main-sub { font-size: 0.78rem; color: var(--text-2); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hx-main-sub .mono { font-family: 'SF Mono', ui-monospace, Menlo, monospace; color: var(--text-3); }
.hx-side { text-align: right; }
.hx-badge { display: inline-block; font-size: 0.68rem; font-weight: 700; padding: 3px 9px; border-radius: 999px; text-transform: capitalize; letter-spacing: 0.01em; }
.hx-badge.s-success   { background: var(--success-bg); color: var(--success-dark); }
.hx-badge.s-pending   { background: var(--warning-bg); color: #b45309; }
.hx-badge.s-expired, .hx-badge.s-cancelled { background: var(--danger-bg); color: #b91c1c; }
.hx-mode { display: block; font-size: 0.68rem; color: var(--text-3); margin-top: 3px; }

.hx-skel { display: flex; flex-direction: column; gap: 12px; }
.hx-skel .skeleton-line { height: 14px; }
.hx-skel-card { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.hx-empty, .hx-error { text-align: center; padding: 44px 20px; background: var(--card); border: 1px dashed var(--border-strong); border-radius: 14px; color: var(--text-2); }
.hx-empty strong, .hx-error strong { display: block; color: var(--text); font-size: 1rem; margin-bottom: 4px; }
.hx-empty p, .hx-error p { font-size: 0.86rem; }
.hx-error .btn-outline-load, .hx-more .btn-outline-load { margin-top: 12px; }
.hx-more { display: flex; justify-content: center; margin: 16px 0 6px; }
.hx-foot { text-align: center; font-size: 0.74rem; color: var(--text-3); margin-top: 14px; }
.btn-outline-load {
  padding: 11px 22px; background: #fff; color: var(--primary); border: 1.5px solid var(--primary);
  border-radius: 10px; font-size: 0.88rem; font-weight: 600; cursor: pointer; transition: all 0.15s;
}
.btn-outline-load:hover { background: var(--primary-light); }
.btn-outline-load:disabled { opacity: 0.5; cursor: progress; }
.detail-actions { gap: 8px; }
.detail-copy-btn {
  padding: 10px 16px; border-radius: 10px; background: #fff; color: var(--primary); border: 1.5px solid var(--primary);
  font-size: 0.85rem; font-weight: 600; cursor: pointer;
}
.detail-copy-btn:hover { background: var(--primary-light); }

@media (max-width: 640px) {
  .hx-hero { padding: 16px 18px; }
  .hx-hero-value { font-size: 1.75rem; }
  .hx-stat { padding: 10px 12px; }
  .hx-stat-value { font-size: 1.1rem; }
  .hx-month-label { min-width: 112px; }
  .hx-row { padding: 11px 14px; gap: 10px; }
  .hx-day-head { padding: 10px 14px; }
}
@media (max-width: 380px) {
  .hx-stats { grid-template-columns: 1fr 1fr 1fr; gap: 6px; }
  .hx-mode { display: none; }
}
@media (prefers-reduced-motion: reduce) { .hx-chev, .hx-icon-btn.spinning .hx-spin { transition: none; animation: none; } }

.hx-block { display: block; }
.hx-error-inline { margin-bottom: 12px; padding: 16px; }
.skeleton-line.w35 { width: 35%; } .skeleton-line.w75 { width: 75%; } .skeleton-line.w85 { width: 85%; } .skeleton-line.w90 { width: 90%; }
