:root {
  --bg: #0e0a08;
  --surface: #1a1411;
  --surface-2: #1f1814;
  --chip: #2e241e;
  --line: #3a2e25;
  --line-soft: #2a211b;
  --gold: #c9a96e;
  --gold-hi: #e0c48f;
  --text: #e8e2d4;
  --text-2: #d6cfc1;
  --muted: #a89d8c;
  --tab-off: #8a7f72;
  --ok: #9fc49a;
  --ok-bg: #1f2a1f;
  --danger: #e59a8a;
  --serif: Lora, Georgia, 'Times New Roman', serif;
  --sans: Montserrat, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-family: var(--sans); }
body { overscroll-behavior: none; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--gold); }
[hidden] { display: none !important; }

.app { height: 100%; display: flex; flex-direction: column; max-width: 560px; margin: 0 auto; position: relative; }
.screen { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.screen::-webkit-scrollbar { display: none; }
.page { display: flex; flex-direction: column; gap: 20px; padding: 24px 20px 32px; }

/* type */
h1 { margin: 0; font-family: var(--serif); font-size: 28px; font-weight: 600; line-height: 1.2; }
h2 { margin: 0; font-family: var(--serif); font-size: 22px; font-weight: 600; line-height: 1.25; }
.eyebrow { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 1.5px; }
.muted { color: var(--muted); }
.sub { font-size: 13px; color: var(--muted); line-height: 1.5; }
.serif { font-family: var(--serif); }
.gold { color: var(--gold); }
.row { display: flex; align-items: center; gap: 12px; }
.between { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.stack-4 { display: flex; flex-direction: column; gap: 4px; }
.grow { flex: 1; min-width: 0; }

/* cards */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.card.accent { border-color: var(--gold); background: var(--surface-2); }
.card.dashed { background: transparent; border-style: dashed; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 14px 12px; display: flex; flex-direction: column; gap: 4px; align-items: flex-start; text-align: left; color: var(--text); }
.tile b { font-family: var(--serif); font-size: 24px; font-weight: 600; }
.tile span { font-size: 12px; color: var(--muted); }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }

/* buttons */
.btn { min-height: 46px; border-radius: 12px; border: 1px solid var(--gold); background: var(--gold); color: var(--bg); font-size: 14px; font-weight: 600; padding: 0 16px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; }
.btn:active { transform: scale(0.98); }
.btn.ghost { background: transparent; color: var(--gold); }
.btn.quiet { background: transparent; border-color: var(--line); color: var(--text); }
.btn.small { min-height: 38px; padding: 0 12px; font-size: 13px; border-radius: 10px; }
.btn[disabled] { opacity: 0.45; pointer-events: none; }
.btn-row { display: flex; gap: 10px; }
.btn-row > * { flex: 1; }
.link-btn { background: none; border: none; color: var(--gold); font-size: 13px; font-weight: 600; min-height: 44px; padding: 0; }

/* header */
.avatar { width: 48px; height: 48px; border-radius: 50%; background: #2a211b; border: 1px solid var(--gold); display: flex; align-items: center; justify-content: center; font-family: var(--serif); font-size: 20px; color: var(--gold); overflow: hidden; flex-shrink: 0; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.brand { font-size: 11px; letter-spacing: 2px; text-transform: uppercase; color: var(--gold); }

/* balance */
.balance { font-family: var(--serif); font-size: 40px; font-weight: 600; color: var(--gold); line-height: 1.1; }
.pill { padding: 6px 12px; border-radius: 999px; border: 1px solid var(--gold); font-size: 12px; color: var(--gold); white-space: nowrap; }
.progress { height: 6px; border-radius: 3px; background: var(--chip); overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--gold); border-radius: 3px; }

/* list items */
.item { width: 100%; text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 16px; display: flex; align-items: center; gap: 12px; color: var(--text); }
.item .t { font-size: 15px; font-weight: 600; }
.item .s { font-size: 12px; color: var(--muted); margin-top: 4px; line-height: 1.4; }
.chip { padding: 6px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--chip); color: var(--gold); }
.chip.solid { background: var(--gold); color: var(--bg); }
.chip.ok { background: var(--ok-bg); color: var(--ok); }
.chip.wait { background: var(--chip); color: var(--muted); }
.line-item { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line-soft); }
.line-item:last-child { border-bottom: none; }
.amount { font-size: 15px; font-weight: 600; white-space: nowrap; }
.amount.plus { color: var(--gold); }
.amount.minus { color: var(--muted); }

/* trips */
.trip-name { font-family: var(--serif); font-size: 22px; font-weight: 600; }
.status { padding: 4px 10px; border-radius: 999px; font-size: 11px; font-weight: 600; background: var(--chip); color: var(--muted); }
.status.upcoming { background: var(--gold); color: var(--bg); }
.status.review { color: var(--gold); }

/* segmented */
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; padding: 4px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); }
.seg button { min-height: 40px; border: none; border-radius: 10px; background: transparent; color: var(--muted); font-size: 13px; font-weight: 600; }
.seg button[aria-selected="true"] { background: var(--gold); color: var(--bg); }

/* badges */
.badge { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 14px 8px; display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; }
.badge .ring { width: 56px; height: 56px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: #15100d; border: 1px solid var(--line); color: #5a4d42; }
.badge.on .ring { background: var(--chip); border-color: var(--gold); color: var(--gold); }
.badge .bt { font-size: 12px; font-weight: 600; line-height: 1.3; color: var(--muted); }
.badge.on .bt { color: var(--text); }
.badge .bn { font-size: 11px; color: var(--muted); }

/* friends */
.ref-link { padding: 12px 14px; border-radius: 12px; background: var(--bg); border: 1px solid var(--line); font-size: 13px; color: var(--muted); word-break: break-all; }
.mini-avatar { width: 40px; height: 40px; border-radius: 50%; background: #2a211b; display: flex; align-items: center; justify-content: center; color: var(--gold); font-size: 15px; flex-shrink: 0; }

/* tab bar */
.tabbar { flex-shrink: 0; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; padding: 8px 8px calc(10px + var(--safe-bottom)); background: #140f0c; border-top: 1px solid var(--line-soft); }
.tabbar button { min-height: 52px; border: none; background: none; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; font-size: 11px; font-weight: 600; color: var(--tab-off); position: relative; }
.tabbar button[aria-current="page"] { color: var(--gold); }
.tabbar .dot { position: absolute; top: 6px; right: calc(50% - 18px); min-width: 16px; height: 16px; border-radius: 8px; background: var(--gold); color: var(--bg); font-size: 10px; display: flex; align-items: center; justify-content: center; padding: 0 4px; }

/* forms */
label.field { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--muted); }
.input { min-height: 46px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); color: var(--text); font-size: 15px; width: 100%; }
textarea.input { min-height: 110px; resize: vertical; line-height: 1.5; }
.input:focus { outline: none; border-color: var(--gold); }
.attach { min-height: 46px; border-radius: 12px; border: 1px dashed var(--line); background: transparent; color: var(--muted); font-size: 13px; display: flex; align-items: center; justify-content: center; gap: 8px; position: relative; overflow: hidden; }
.attach input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.thumb { width: 100%; max-height: 220px; object-fit: contain; border-radius: 12px; background: var(--bg); border: 1px solid var(--line); }
.trip-pick { display: flex; flex-wrap: wrap; gap: 8px; }
.trip-pick button { min-height: 40px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: transparent; color: var(--text); font-size: 13px; }
.trip-pick button[aria-pressed="true"] { border-color: var(--gold); background: var(--chip); color: var(--gold); }
.error { color: var(--danger); font-size: 13px; }

/* sheet */
.overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.62); display: flex; flex-direction: column; justify-content: flex-end; z-index: 20; animation: fade 0.15s ease-out; }
.sheet { max-width: 560px; width: 100%; margin: 0 auto; max-height: 92%; overflow-y: auto; border-radius: 24px 24px 0 0; background: var(--surface); border-top: 1px solid var(--gold); padding: 22px 20px calc(28px + var(--safe-bottom)); display: flex; flex-direction: column; gap: 16px; animation: up 0.2s ease-out; }
.sheet .desc { font-size: 14px; line-height: 1.55; color: var(--text-2); }
.done-ring { width: 64px; height: 64px; border-radius: 50%; border: 1px solid var(--gold); display: flex; align-items: center; justify-content: center; color: var(--gold); margin: 0 auto; }
@keyframes up { from { transform: translateY(40px); opacity: 0.4; } to { transform: none; opacity: 1; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* admin */
.stat b { font-size: 20px; }
.proof { font-size: 13px; line-height: 1.5; color: var(--text-2); word-break: break-word; white-space: pre-wrap; }
.admin-img { width: 100%; border-radius: 12px; border: 1px solid var(--line); cursor: zoom-in; }

/* misc */
.toast { position: fixed; left: 50%; bottom: calc(96px + var(--safe-bottom)); transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 12px 18px; border-radius: 12px; font-size: 14px; font-weight: 600; z-index: 30; max-width: calc(100% - 40px); text-align: center; }
.loading { height: 100%; min-height: 60vh; display: flex; align-items: center; justify-content: center; }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--line); border-top-color: var(--gold); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty { text-align: center; padding: 24px 12px; color: var(--muted); font-size: 14px; line-height: 1.5; }
