:root {
  --bg: #0c1220;
  --surface: #151d30;
  --surface-2: #1d2842;
  --text: #e6ecf8;
  --muted: #8fa0bf;
  --accent: #38bdf8;
  --accent-2: #22d3ee;
  --danger: #f87171;
  --ok: #4ade80;
  --radius: 14px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  height: 100%;
}

.hidden { display: none !important; }

#app {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  max-width: 560px;
  margin: 0 auto;
}

.view {
  flex: 1;
  padding: 16px 16px 96px;
  padding-top: max(16px, env(safe-area-inset-top));
}

h1 { font-size: 1.4rem; margin: 4px 0 16px; }
h2 { font-size: 1.05rem; margin: 20px 0 8px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }

.nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 560px;
  display: flex;
  background: var(--surface);
  border-top: 1px solid var(--surface-2);
  padding-bottom: env(safe-area-inset-bottom);
}

.nav-btn {
  flex: 1;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 0.95rem;
  padding: 14px 0;
  cursor: pointer;
}

.nav-btn.active { color: var(--accent); font-weight: 600; }

.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
}

label { display: block; color: var(--muted); font-size: 0.85rem; margin: 12px 0 6px; }
label:first-child { margin-top: 0; }

input, select, textarea {
  width: 100%;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 12px;
  font-size: 1rem;
}

input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: none;
  border-radius: 999px;
  padding: 10px 16px;
  font-size: 1rem;
  color: #0c1220;
  font-weight: 600;
  cursor: pointer;
  opacity: 0.35;
}
.chip.selected { opacity: 1; outline: 3px solid var(--text); }

.row { display: flex; gap: 10px; }
.row > * { flex: 1; }

.toggle { display: flex; align-items: center; gap: 10px; margin-top: 12px; color: var(--text); }
.toggle input { width: 22px; height: 22px; accent-color: var(--accent); }

.btn {
  width: 100%;
  border: none;
  border-radius: 12px;
  padding: 14px;
  font-size: 1.05rem;
  font-weight: 700;
  background: var(--accent);
  color: #06202e;
  margin-top: 16px;
  cursor: pointer;
}
.btn.secondary { background: var(--surface-2); color: var(--text); }
.btn.danger { background: var(--danger); color: #2a0505; }
.btn:active { transform: scale(0.98); }

.stepper { display: flex; gap: 8px; align-items: center; }
.stepper input { text-align: center; }
.stepper button {
  width: 48px; height: 48px; flex: none;
  border: none; border-radius: 10px;
  background: var(--surface-2); color: var(--text);
  font-size: 1.4rem; cursor: pointer;
}

.session {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 8px;
  cursor: pointer;
}
.dot { width: 12px; height: 12px; border-radius: 50%; flex: none; }
.session .who { flex: 1; }
.session .who .name { font-weight: 600; }
.session .who .meta { color: var(--muted); font-size: 0.85rem; }
.session .mins { font-weight: 700; font-size: 1.1rem; }
.badge {
  font-size: 0.7rem;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
}
.badge.unpaid { background: #3a2b12; color: #fbbf24; }

.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat .value { font-size: 1.6rem; font-weight: 700; }
.stat .label { color: var(--muted); font-size: 0.8rem; }

table.list { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
table.list td, table.list th { padding: 8px 6px; text-align: left; border-bottom: 1px solid var(--surface-2); }
table.list th { color: var(--muted); font-weight: 500; }
table.list td.num { text-align: right; font-variant-numeric: tabular-nums; }

.user-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--surface-2); }
.user-row .who { flex: 1; }

.toast {
  position: fixed;
  bottom: 84px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface-2);
  color: var(--text);
  padding: 12px 18px;
  border-radius: 12px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.4);
  z-index: 50;
  max-width: 90vw;
  display: flex;
  gap: 14px;
  align-items: center;
}
.toast button { background: none; border: none; color: var(--accent); font-weight: 700; cursor: pointer; }

dialog {
  background: var(--surface);
  color: var(--text);
  border: none;
  border-radius: var(--radius);
  padding: 20px;
  width: min(92vw, 420px);
  max-height: 85dvh;
  overflow-y: auto;
}
dialog::backdrop { background: rgba(0, 0, 0, 0.6); }

pre.token {
  background: var(--surface-2);
  padding: 10px;
  border-radius: 8px;
  overflow-x: auto;
  user-select: all;
  word-break: break-all;
}

.muted { color: var(--muted); font-size: 0.85rem; }
.error { color: var(--danger); font-size: 0.9rem; margin-top: 8px; }
