:root {
  --bg: #F3F8FE;
  --surface: #FFFFFF;
  --surface-alt: #EAF3FC;
  --text: #0B2540;
  --muted: #5C7A99;
  --accent: #0EA5E9;
  --accent-dark: #0369A1;
  --accent-contrast: #FFFFFF;
  --border: #DCEAF7;
  --danger: #EF4444;
  --success: #16A34A;
}
:root[data-theme="dark"] {
  --bg: #071624;
  --surface: #0F2740;
  --surface-alt: #123152;
  --text: #EAF3FC;
  --muted: #8FB2D9;
  --accent: #38BDF8;
  --accent-dark: #7DD3FC;
  --accent-contrast: #04121F;
  --border: #1B3A5C;
  --danger: #F87171;
  --success: #4ADE80;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
#app { position: relative; overflow: hidden; height: 100vh; height: 100dvh; }
a { color: var(--accent); }

/* Screen transitions: each screen is its own absolutely-positioned frame so the outgoing
   and incoming screens can be visible - and animating - at the same time. */
.frame { position: absolute; inset: 0; display: flex; flex-direction: column; background: var(--bg); }
.frame.animating { transition: transform 260ms cubic-bezier(.32, .72, 0, 1), opacity 200ms ease; }
.frame.enter-right { transform: translateX(100%); }
.frame.enter-left { transform: translateX(-100%); }
.frame.enter-fade { opacity: 0; transform: translateY(10px); }
.frame.exit-left { transform: translateX(-30%); opacity: .65; }
.frame.exit-right { transform: translateX(100%); }
.frame.exit-fade { opacity: 0; transform: translateY(-6px); }
.frame.active { transform: translateX(0) translateY(0); opacity: 1; }
@media (prefers-reduced-motion: reduce) {
  .frame.animating { transition: none !important; }
}

.header { padding: 18px 16px 12px; display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.header-title { font-size: 24px; font-weight: 800; flex: 1; letter-spacing: -0.02em; }
.content { flex: 1; overflow-y: auto; padding: 4px 16px calc(16px + env(safe-area-inset-bottom)); }
.section-label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin: 18px 4px 8px; font-weight: 700; }

.card-group { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; overflow: hidden; margin-bottom: 4px; box-shadow: 0 1px 2px rgba(3, 105, 161, .04); }
.list-row { display: flex; align-items: center; justify-content: space-between; padding: 14px 15px; border-bottom: 1px solid var(--border); cursor: pointer; gap: 10px; transition: background-color 120ms ease; }
.list-row:last-child { border-bottom: none; }
.list-row.static { cursor: default; }
.list-row:active { background: var(--surface-alt); }
.row-main { flex: 1; min-width: 0; }
.row-title { font-size: 16px; font-weight: 600; }
.row-sub { font-size: 13px; color: var(--muted); margin-top: 2px; }
.chevron { color: var(--muted); flex-shrink: 0; opacity: .55; }

.badge { padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 700; flex-shrink: 0; }
.badge.pending { background: #FEF3C7; color: #A16207; }
.badge.approved { background: #DCFCE7; color: #15803D; }
.badge.admin { background: #EDE9FE; color: #6D28D9; }
.badge.points { background: var(--surface-alt); color: var(--accent-dark); }

.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 18px; margin-bottom: 12px; box-shadow: 0 1px 2px rgba(3, 105, 161, .04); }
.stat-num { font-size: 30px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.stat-label { font-size: 13px; color: var(--muted); margin-top: 2px; }

.points-hero {
  border-radius: 20px; padding: 22px; margin-bottom: 14px; color: var(--accent-contrast);
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  box-shadow: 0 8px 24px -8px rgba(14, 165, 233, .55);
}
.points-hero .num { font-size: 42px; font-weight: 800; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.points-hero .label { font-size: 14px; opacity: .92; margin-top: 2px; }

.profile-header { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 8px 0 18px; }
.profile-photo { width: 88px; height: 88px; border-radius: 50%; object-fit: cover; background: var(--surface-alt); border: 3px solid var(--surface); box-shadow: 0 0 0 1px var(--border); }
.profile-photo.placeholder { display: flex; align-items: center; justify-content: center; font-size: 32px; font-weight: 700; color: var(--accent-dark); }
.profile-name { font-size: 20px; font-weight: 800; margin-top: 12px; }
.profile-sub { font-size: 14px; color: var(--muted); margin-top: 2px; }

.field-label { font-size: 13px; color: var(--muted); margin: 14px 4px 6px; font-weight: 600; }
.input { width: 100%; padding: 13px 14px; border-radius: 12px; border: 1.5px solid var(--border); background: var(--surface); color: var(--text); font-size: 16px; font-family: inherit; }
.input:focus { outline: none; border-color: var(--accent); }

.checkbox { width: 25px; height: 25px; border-radius: 50%; border: 2px solid var(--border); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.checkbox.checked { background: var(--accent); border-color: var(--accent); }

.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--accent); color: var(--accent-contrast); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 15px; flex-shrink: 0; }

.center-msg { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; flex: 1; padding: 32px; gap: 12px; }
.center-msg .icon-wrap { width: 64px; height: 64px; border-radius: 50%; background: var(--surface-alt); color: var(--accent-dark); display: flex; align-items: center; justify-content: center; margin-bottom: 4px; }

.pill { display: inline-flex; padding: 6px 13px; border-radius: 20px; font-size: 12px; font-weight: 700; cursor: pointer; transition: background-color 150ms ease, color 150ms ease; }
.pill.active { background: var(--accent); color: var(--accent-contrast); }
.pill.inactive { background: var(--surface-alt); color: var(--text); }

.tabbar { display: flex; border-top: 1px solid var(--border); background: var(--surface); padding: 8px 0 calc(8px + env(safe-area-inset-bottom)); flex-shrink: 0; }
.tab-item { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; cursor: pointer; color: var(--muted); font-size: 10px; font-weight: 600; transition: color 150ms ease; }
.tab-item.active { color: var(--accent); }
.tab-item svg { transition: transform 150ms cubic-bezier(.34, 1.56, .64, 1); }
.tab-item:active svg { transform: scale(.85); }

.spinner-wrap { display: flex; align-items: center; justify-content: center; flex: 1; }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--surface-alt); border-top-color: var(--accent); animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.error-box { margin: 16px; padding: 14px; background: #FEF2F2; color: #B91C1C; border-radius: 12px; font-size: 14px; }

.action-btn { padding: 15px; text-align: center; font-weight: 700; font-size: 16px; border-radius: 14px; cursor: pointer; margin-top: 8px; background: var(--surface-alt); color: var(--accent-dark); transition: transform 120ms ease, opacity 120ms ease; }
.action-btn.destructive { color: var(--danger); }
.action-btn:active { transform: scale(.97); opacity: .85; }

.checkbox { transition: background-color 150ms ease, border-color 150ms ease, transform 150ms cubic-bezier(.34, 1.56, .64, 1); }
.list-row:active .checkbox { transform: scale(1.08); }

.empty-hint { padding: 24px; text-align: center; color: var(--muted); font-size: 14px; }
