/* Wacast member area. Tokens follow design-system/wacast-member/MASTER.md (primary #2563EB, accent #059669, Plus Jakarta Sans).
   Plain CSS, mobile first, no build step. Contrast of every text/background pair here is >= 4.5:1. */
:root {
  --color-primary: #2563EB;
  --color-primary-strong: #1D4ED8;
  --color-on-primary: #FFFFFF;
  --color-accent: #047857;
  --color-accent-soft: #D1FAE5;
  --color-background: #F8FAFC;
  --color-surface: #FFFFFF;
  --color-foreground: #0F172A;
  --color-muted: #F1F5FD;
  --color-muted-foreground: #475569;
  --color-border: #D9E2F3;
  --color-destructive: #B91C1C;
  --color-destructive-soft: #FEE2E2;
  --color-warning: #92400E;
  --color-warning-soft: #FEF3C7;
  --color-info-soft: #DBEAFE;
  --color-ring: #2563EB;
  --font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --space-xs: 4px; --space-sm: 8px; --space-md: 16px; --space-lg: 24px; --space-xl: 32px; --space-2xl: 48px;
  --radius: 12px; --radius-sm: 8px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, .08);
  --sidebar: 248px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 16px; line-height: 1.5; color: var(--color-foreground); background: var(--color-background); }
h1, h2, h3 { line-height: 1.25; margin: 0 0 var(--space-sm); }
h1 { font-size: 1.5rem; } h2 { font-size: 1.125rem; } h3 { font-size: 1rem; }
p { margin: 0 0 var(--space-md); }
a { color: var(--color-primary-strong); }
:focus-visible { outline: 3px solid var(--color-ring); outline-offset: 2px; border-radius: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: -999px; top: 8px; background: var(--color-surface); padding: 8px 12px; z-index: 100; }
.skip-link:focus { left: 8px; }
.muted { color: var(--color-muted-foreground); }
.small { font-size: .875rem; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.stack > * + * { margin-top: var(--space-md); }
.row { display: flex; flex-wrap: wrap; gap: var(--space-md); align-items: center; }
.row.between { justify-content: space-between; }
.grow { flex: 1 1 auto; }

/* ---- shell ---- */
.shell { min-height: 100vh; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: var(--space-md); padding: 10px var(--space-md); background: var(--color-surface); border-bottom: 1px solid var(--color-border); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; color: var(--color-foreground); text-decoration: none; }
.brand-mark { width: 32px; height: 32px; border-radius: 9px; background: var(--color-primary); color: #fff; display: grid; place-items: center; }
.topbar .balance { margin-left: auto; }
.balance { display: inline-flex; align-items: center; gap: 8px; background: var(--color-accent-soft); color: #064E3B; padding: 6px 12px; border-radius: 999px; font-weight: 600; text-decoration: none; min-height: 44px; }
.userbox { position: relative; }
.userbox summary { list-style: none; cursor: pointer; min-height: 44px; min-width: 44px; display: grid; place-items: center; border-radius: 999px; background: var(--color-muted); font-weight: 700; }
.userbox summary::-webkit-details-marker { display: none; }
.userbox .menu { position: absolute; right: 0; top: 52px; min-width: 220px; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); box-shadow: var(--shadow-md); padding: var(--space-sm); }
.userbox .menu .who { padding: 8px 12px; border-bottom: 1px solid var(--color-border); margin-bottom: 6px; }
.menu button { width: 100%; text-align: left; }
.sidenav { display: none; }
.content { flex: 1; width: 100%; max-width: 1100px; margin: 0 auto; padding: var(--space-lg) var(--space-md) 96px; }
.bottomnav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: grid; grid-template-columns: repeat(5, 1fr); background: var(--color-surface); border-top: 1px solid var(--color-border); padding-bottom: env(safe-area-inset-bottom); }
.bottomnav a, .sidenav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 56px; color: var(--color-muted-foreground); text-decoration: none; font-size: .75rem; font-weight: 600; }
.bottomnav a[aria-current="page"], .sidenav a[aria-current="page"] { color: var(--color-primary-strong); }
.bottomnav a[aria-current="page"] svg { background: var(--color-info-soft); }
.bottomnav svg { width: 40px; height: 26px; padding: 2px 10px; border-radius: 999px; }
@media (min-width: 900px) {
  .shell { flex-direction: row; }
  .sidenav { display: flex; flex-direction: column; width: var(--sidebar); flex: 0 0 var(--sidebar); background: var(--color-surface); border-right: 1px solid var(--color-border); padding: var(--space-md); position: sticky; top: 0; height: 100vh; }
  .sidenav .brand { padding: 8px 8px var(--space-lg); }
  .sidenav a { flex-direction: row; justify-content: flex-start; gap: 12px; font-size: .95rem; padding: 0 12px; border-radius: var(--radius-sm); min-height: 44px; margin-bottom: 4px; }
  .sidenav a[aria-current="page"] { background: var(--color-info-soft); }
  .sidenav svg { width: 20px; height: 20px; }
  .main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
  .topbar .brand { display: none; }
  .bottomnav { display: none; }
  .content { padding-bottom: var(--space-2xl); }
}

/* ---- cards, tiles ---- */
.card { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); padding: var(--space-lg); box-shadow: var(--shadow-sm); }
.card > h2:first-child, .card > .card-head { margin-bottom: var(--space-md); }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: var(--space-md); flex-wrap: wrap; }
.grid { display: grid; gap: var(--space-md); }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.tile { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); padding: var(--space-md) var(--space-lg); }
.tile .label { color: var(--color-muted-foreground); font-size: .875rem; }
.tile .value { font-size: 1.5rem; font-weight: 700; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; flex-wrap: wrap; gap: var(--space-md); margin-bottom: var(--space-lg); }
.page-head p { margin: 0; }

/* ---- buttons ---- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: var(--radius-sm); border: 1px solid transparent; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; background: var(--color-primary); color: var(--color-on-primary); transition: background .15s ease, box-shadow .15s ease; }
.btn:hover { background: var(--color-primary-strong); }
.btn.secondary { background: var(--color-surface); color: var(--color-foreground); border-color: var(--color-border); }
.btn.secondary:hover { background: var(--color-muted); }
.btn.danger { background: var(--color-destructive); }
.btn.danger.secondary { background: var(--color-surface); color: var(--color-destructive); border-color: #FCA5A5; }
.btn.ghost { background: transparent; color: var(--color-foreground); }
.btn.ghost:hover { background: var(--color-muted); }
.btn.small { min-height: 36px; padding: 0 12px; font-size: .875rem; }
.btn.block { width: 100%; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }
.btn.loading::after { content: ""; width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- forms ---- */
.field { margin-bottom: var(--space-md); }
label, .label-text { display: block; font-weight: 600; margin-bottom: 6px; }
.help { color: var(--color-muted-foreground); font-size: .875rem; margin-top: 6px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=tel], input[type=datetime-local], select, textarea { width: 100%; min-height: 44px; padding: 10px 12px; font: inherit; color: inherit; background: var(--color-surface); border: 1px solid #9FB1CF; border-radius: var(--radius-sm); }
textarea { min-height: 140px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 3px solid var(--color-ring); outline-offset: 1px; border-color: var(--color-primary); }
.field.has-error input, .field.has-error textarea, .field.has-error select { border-color: var(--color-destructive); }
.error-text { color: var(--color-destructive); font-size: .875rem; margin-top: 6px; }
.choice { display: flex; gap: 12px; align-items: flex-start; padding: 12px; border: 1px solid var(--color-border); border-radius: var(--radius-sm); margin-bottom: 8px; cursor: pointer; }
.choice input { margin-top: 4px; width: 18px; height: 18px; }
.choice.disabled { cursor: not-allowed; background: var(--color-muted); color: var(--color-muted-foreground); }
.choice strong { display: block; }
.counter { display: flex; justify-content: space-between; color: var(--color-muted-foreground); font-size: .875rem; margin-top: 6px; }
.dropzone { border: 2px dashed #9FB1CF; border-radius: var(--radius-sm); padding: var(--space-md); display: flex; gap: var(--space-md); align-items: center; flex-wrap: wrap; }
.dropzone img { max-width: 120px; max-height: 120px; border-radius: var(--radius-sm); border: 1px solid var(--color-border); }

/* ---- alerts, badges ---- */
.alert { border-radius: var(--radius-sm); padding: 12px 16px; margin-bottom: var(--space-md); border: 1px solid; }
.alert.success { background: var(--color-accent-soft); border-color: #6EE7B7; color: #064E3B; }
.alert.error { background: var(--color-destructive-soft); border-color: #FCA5A5; color: #7F1D1D; }
.alert.warning { background: var(--color-warning-soft); border-color: #FCD34D; color: #78350F; }
.alert.info { background: var(--color-info-soft); border-color: #93C5FD; color: #1E3A8A; }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px; font-size: .8125rem; font-weight: 600; background: var(--color-muted); color: var(--color-foreground); }
.badge::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; opacity: .7; }
.badge.ok { background: var(--color-accent-soft); color: #064E3B; }
.badge.bad { background: var(--color-destructive-soft); color: #7F1D1D; }
.badge.warn { background: var(--color-warning-soft); color: #78350F; }
.badge.info { background: var(--color-info-soft); color: #1E3A8A; }

/* ---- tables: stacked cards on small screens ---- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; }
table.data th { text-align: left; font-size: .8125rem; text-transform: uppercase; letter-spacing: .03em; color: var(--color-muted-foreground); padding: 10px 12px; border-bottom: 1px solid var(--color-border); }
table.data td { padding: 12px; border-bottom: 1px solid var(--color-border); vertical-align: middle; }
table.data tr:last-child td { border-bottom: 0; }
table.data td.right, table.data th.right { text-align: right; }
@media (max-width: 640px) {
  table.data thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  table.data tr { display: block; padding: 10px 0; border-bottom: 1px solid var(--color-border); }
  table.data td { display: flex; justify-content: space-between; gap: 12px; padding: 6px 4px; border: 0; text-align: right; }
  table.data td::before { content: attr(data-label); font-weight: 600; color: var(--color-muted-foreground); text-align: left; }
}
.progress { height: 10px; background: var(--color-muted); border-radius: 999px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--color-primary); transition: width .3s ease; }
.empty { text-align: center; padding: var(--space-2xl) var(--space-md); color: var(--color-muted-foreground); }
.empty svg { width: 48px; height: 48px; color: #94A3B8; }
.pager { display: flex; justify-content: space-between; align-items: center; margin-top: var(--space-md); gap: 8px; flex-wrap: wrap; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: var(--space-md); }
.tabs a { padding: 8px 14px; border-radius: 999px; background: var(--color-muted); color: var(--color-foreground); text-decoration: none; font-weight: 600; font-size: .875rem; min-height: 36px; display: inline-flex; align-items: center; }
.tabs a[aria-current="true"] { background: var(--color-primary); color: #fff; }
.qr-box { display: grid; place-items: center; min-height: 240px; border: 1px dashed #9FB1CF; border-radius: var(--radius); padding: var(--space-md); }
.qr-box img { width: 220px; height: 220px; image-rendering: pixelated; }
.code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--color-muted); padding: 2px 6px; border-radius: 4px; }
pre.bank { white-space: pre-wrap; background: var(--color-muted); border-radius: var(--radius-sm); padding: var(--space-md); margin: 0 0 var(--space-md); font: inherit; }

/* ---- guest (login / register) ---- */
.guest { min-height: 100vh; display: grid; place-items: center; padding: var(--space-md); background: linear-gradient(160deg, #EFF6FF 0%, #F8FAFC 55%); }
.guest-card { width: 100%; max-width: 440px; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: 16px; padding: var(--space-xl) var(--space-lg); box-shadow: var(--shadow-md); }
.guest-card .brand { justify-content: center; margin-bottom: var(--space-lg); font-size: 1.25rem; }
.guest-card h1 { text-align: center; }
.guest-card .alt { text-align: center; margin: var(--space-md) 0 0; }
.hp { position: absolute; left: -9999px; height: 0; overflow: hidden; }

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