/* RH402 shared surface: tokens + components used by every host. Engine primitives live in cine.css. */
:root {
  --canvas: #07100c; --surface: #0f1a14; --surface-2: #14221b; --ink: #eef4f0; --ink-soft: #9fb8ab; --ink-dim: #6f8a7c;
  --accent: #57e6a1; --accent-ink: #06110b; --danger: #ff7b7b; --warn: #f4c95d;
  --shadow-tint: 7 16 12;
  --font-display: 'Outfit', system-ui, sans-serif; --font-text: 'Manrope', system-ui, sans-serif;
  --radius: 6px; --radius-lg: 14px;
  --line: color-mix(in oklab, var(--ink) 12%, transparent); --edge: color-mix(in oklab, var(--ink) 8%, transparent);
}
body { font-family: var(--font-text); background: var(--canvas); color: var(--ink); }
h1, h2, h3, .display { font-family: var(--font-display); font-weight: 700; letter-spacing: -0.02em; }
.amount, .hash, .num, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-variant-numeric: tabular-nums; }
.hash { font-size: .8125rem; color: var(--ink-soft); word-break: break-all; }
a { color: var(--accent); }

/* top bar */
.bar { position: sticky; top: 0; z-index: 50; display: flex; align-items: center; gap: 16px; padding: 12px var(--gutter, 16px); background: color-mix(in oklab, var(--canvas) 78%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.bar .brand { font-family: var(--font-display); font-weight: 800; letter-spacing: -0.02em; font-size: 1.1rem; color: var(--ink); text-decoration: none; display: inline-flex; align-items: center; gap: 8px; min-height: 40px; }
.bar .brand b { color: var(--accent); }
.bar nav { display: flex; gap: 4px; margin-left: auto; }
.bar nav a { color: var(--ink-soft); text-decoration: none; padding: 8px 12px; border-radius: 100px; font-size: .875rem; font-weight: 500; min-height: 40px; display: inline-flex; align-items: center; transition: color var(--dur-ui, 160ms), background var(--dur-ui, 160ms); }
.bar nav a[aria-current="page"], .bar nav a.is-cta { color: var(--accent-ink); background: var(--accent); font-weight: 700; }
@media (hover:hover) and (pointer:fine) { .bar nav a:hover { color: var(--ink); background: color-mix(in oklab, var(--ink) 8%, transparent); } .bar nav a.is-cta:hover { background: color-mix(in oklab, var(--accent) 85%, white); color: var(--accent-ink); } }
@media (max-width: 640px) { .bar nav a { padding: 8px 10px; font-size: .8125rem; } .bar nav .hide-sm { display: none; } }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 22px; border-radius: 100px; font-family: var(--font-display); font-weight: 700; font-size: 1rem; letter-spacing: 0; text-transform: none; text-decoration: none; color: var(--accent-ink); background: var(--accent); clip-path: none; border: 0; cursor: pointer; transition: transform 120ms var(--ease-out, ease-out), background 120ms, box-shadow 120ms; white-space: nowrap; }
.btn:active { transform: scale(.97); }
.btn--ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }
.btn--soft { background: color-mix(in oklab, var(--accent) 14%, transparent); color: var(--accent); }
.btn--danger { background: color-mix(in oklab, var(--danger) 16%, transparent); color: var(--danger); }
.btn--sm { min-height: 40px; padding: 0 14px; font-size: .875rem; }
.btn--block { width: 100%; }
.btn[disabled] { opacity: .45; pointer-events: none; }
@media (hover:hover) and (pointer:fine) { .btn:hover { background: color-mix(in oklab, var(--accent) 85%, white); } .btn--ghost:hover { background: color-mix(in oklab, var(--ink) 8%, transparent); box-shadow: inset 0 0 0 1px var(--ink-soft); } .btn--soft:hover { background: color-mix(in oklab, var(--accent) 24%, transparent); } .btn--danger:hover { background: color-mix(in oklab, var(--danger) 26%, transparent); } }

/* inputs */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: .8125rem; font-weight: 600; color: var(--ink-soft); }
.input { width: 100%; min-height: 48px; padding: 10px 14px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; font-size: 1rem; transition: border-color 120ms, box-shadow 120ms; }
.input:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in oklab, var(--accent) 22%, transparent); }
.input::placeholder { color: var(--ink-dim); }
textarea.input { min-height: 96px; resize: vertical; }
.input.amount { font-size: 1.5rem; }
.hint { font-size: .8125rem; color: var(--ink-soft); }
.hint.err { color: var(--danger); } .hint.ok { color: var(--accent); }

/* surfaces */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 20px; box-shadow: var(--e1, none); }
.card + .card { margin-top: 12px; }
.row { display: flex; align-items: center; gap: 12px; }
.row.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 100px; font-size: .75rem; font-weight: 700; letter-spacing: .02em; background: color-mix(in oklab, var(--ink) 8%, transparent); color: var(--ink-soft); }
.pill.ok { background: color-mix(in oklab, var(--accent) 16%, transparent); color: var(--accent); }
.pill.warn { background: color-mix(in oklab, var(--warn) 16%, transparent); color: var(--warn); }
.pill.bad { background: color-mix(in oklab, var(--danger) 16%, transparent); color: var(--danger); }
.avatar { width: 40px; height: 40px; border-radius: 50%; background-color: var(--accent); background-image: linear-gradient(135deg, var(--accent), #2e9a68); display: grid; place-items: center; font-family: var(--font-display); font-weight: 800; color: var(--accent-ink); flex: none; overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.lg { width: 72px; height: 72px; font-size: 1.6rem; }
.empty { padding: 32px 16px; text-align: center; color: var(--ink-soft); border: 1px dashed var(--line); border-radius: var(--radius-lg); }
.divider { height: 1px; background: var(--line); margin: 4px 0; }
.wrap { width: min(100% - 2 * var(--gutter, 16px), 1100px); margin-inline: auto; }
.wrap--narrow { max-width: 560px; }
.page { padding: 24px 0 96px; }
.page h1 { font-size: clamp(1.6rem, 3vw, 2.2rem); margin-bottom: 8px; }
.page h2 { font-size: 1.15rem; letter-spacing: 0; margin: 28px 0 10px; }
.back { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; color: var(--ink-soft); text-decoration: none; font-size: .875rem; }
.back::before { content: '←'; }
@media (hover:hover) and (pointer:fine) { .back:hover { color: var(--ink); } }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; font-size: .9rem; }
.kv dt { color: var(--ink-soft); } .kv dd { margin: 0; overflow-wrap: anywhere; }

/* payment list */
.pay-list { display: flex; flex-direction: column; }
.pay { display: grid; grid-template-columns: 40px 1fr auto; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); text-decoration: none; color: inherit; }
.pay:last-child { border-bottom: 0; }
.pay .who, .pay .memo, .pay .amt, .pay .when { display: block; }
.pay .who { font-weight: 600; } .pay .who span { color: var(--ink-soft); font-weight: 400; }
.pay .memo { font-size: .8125rem; color: var(--ink-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pay .amt { text-align: right; font-weight: 700; white-space: nowrap; } .pay .amt.in { color: var(--accent); }
.pay .when { font-size: .75rem; color: var(--ink-dim); text-align: right; }

/* toasts + modal */
.toasts { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; width: min(92vw, 460px); pointer-events: none; }
.toast { pointer-events: auto; display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius-lg); background: var(--surface-2); border: 1px solid var(--line); box-shadow: 0 16px 40px -12px rgb(var(--shadow-tint) / .9); transform: translateY(12px) scale(.97); opacity: 0; animation: toast-in .28s var(--ease-out, ease-out) forwards; font-size: .9rem; }
.toast.ok { border-color: color-mix(in oklab, var(--accent) 45%, transparent); } .toast.err { border-color: color-mix(in oklab, var(--danger) 45%, transparent); }
.toast .t-ico { flex: none; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: .8rem; background: var(--accent); color: var(--accent-ink); }
.toast.err .t-ico { background: var(--danger); } .toast.info .t-ico { background: var(--ink-soft); }
.toast b { display: block; } .toast small { color: var(--ink-soft); display: block; }
.toast a { color: var(--accent); }
.toast .t-x { margin-left: auto; color: var(--ink-dim); background: none; border: 0; font-size: 1.1rem; cursor: pointer; min-width: 32px; min-height: 32px; }
@keyframes toast-in { to { transform: none; opacity: 1; } }
.modal-back { position: fixed; inset: 0; z-index: 150; background: rgb(var(--shadow-tint) / .7); backdrop-filter: blur(4px); display: grid; place-items: end center; padding: 0; opacity: 0; animation: fade .2s forwards; }
@keyframes fade { to { opacity: 1; } }
.modal { width: min(100%, 560px); max-height: 92vh; overflow: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 18px 18px 0 0; padding: 20px; transform: translateY(20px); animation: modal-in .3s var(--ease-out, ease-out) forwards; }
@media (min-width: 640px) { .modal-back { place-items: center; padding: 20px; } .modal { border-radius: 18px; } }
@keyframes modal-in { to { transform: none; } }
.modal h3 { font-size: 1.15rem; margin-bottom: 12px; }
.modal .actions { display: flex; gap: 10px; margin-top: 18px; }
.modal .actions .btn { flex: 1; }
.summary { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.summary div { display: flex; justify-content: space-between; gap: 12px; padding: 10px 12px; font-size: .9rem; border-bottom: 1px solid var(--line); }
.summary div:last-child { border-bottom: 0; } .summary span:first-child { color: var(--ink-soft); } .summary span:last-child { text-align: right; overflow-wrap: anywhere; }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid color-mix(in oklab, var(--accent-ink) 30%, transparent); border-top-color: var(--accent-ink); animation: spin .8s linear infinite; }
.btn--ghost .spinner, .card .spinner { border-color: color-mix(in oklab, var(--accent) 30%, transparent); border-top-color: var(--accent); }
@keyframes spin { to { transform: rotate(360deg); } }
.skeleton { background: linear-gradient(90deg, var(--surface) 25%, var(--surface-2) 50%, var(--surface) 75%); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: var(--radius); min-height: 16px; }
@keyframes shimmer { to { background-position: -200% 0; } }
.qr { width: min(100%, 320px); border-radius: 18px; overflow: hidden; margin-inline: auto; box-shadow: var(--e2, none); }
.qr svg, .qr img { width: 100%; height: auto; display: block; }
.copy-btn { display: inline-flex; align-items: center; gap: 6px; font-size: .8125rem; color: var(--accent); background: none; border: 0; cursor: pointer; padding: 6px 0; min-height: 40px; }
.tabs { display: flex; gap: 4px; padding: 4px; background: var(--surface); border-radius: 100px; border: 1px solid var(--line); }
.tabs button { flex: 1; min-height: 40px; border-radius: 100px; font-weight: 600; color: var(--ink-soft); font-size: .875rem; }
.tabs button[aria-selected="true"] { background: var(--accent); color: var(--accent-ink); }
.footer { padding: 48px var(--gutter, 16px); color: var(--ink-dim); font-size: .8125rem; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 12px 24px; justify-content: space-between; }
.footer a { color: var(--ink-soft); text-decoration: none; display: inline-flex; align-items: center; min-height: 40px; padding: 0 4px; }
@media (prefers-reduced-motion: reduce) { .toast, .modal, .modal-back { animation-duration: .01ms; } .skeleton { animation: none; } }
