/* FlexClass — app styles */
:root {
  --fc-accent: #2563eb;
  --fc-bg: #f4f6fa;
  --fc-card: #ffffff;
  --fc-text: #0f172a;
  --fc-muted: #64748b;
  --fc-line: #e5e9f0;
  --fc-ok: #15803d;
  --fc-ok-bg: #dcfce7;
  --fc-wait: #a16207;
  --fc-wait-bg: #fef3c7;
  --fc-bad: #b91c1c;
  --fc-bad-bg: #fee2e2;
  --fc-radius: 14px;
  --fc-tabs-h: 64px;
}
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--fc-bg); color: var(--fc-text); }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px; line-height: 1.45; -webkit-font-smoothing: antialiased; overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}
body.fc-noscroll { overflow: hidden; }
button, input { font: inherit; color: inherit; }
a { color: var(--fc-accent); }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }

.fc-boot { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.fc-boot img { border-radius: 16px; opacity: .85; }

/* Top bar */
.fc-top { position: sticky; top: 0; z-index: 20; background: var(--fc-accent); color: #fff; padding-top: env(safe-area-inset-top); }
.fc-top-in { max-width: 640px; margin: 0 auto; display: flex; align-items: center; gap: 10px; padding: 10px 16px; min-height: 52px; }
.fc-logo { width: 32px; height: 32px; border-radius: 8px; background: rgba(255,255,255,.2); object-fit: cover; }
.fc-brand { font-weight: 700; font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }

/* Main */
.fc-main { max-width: 640px; margin: 0 auto; padding: 12px 16px calc(var(--fc-tabs-h) + 24px + env(safe-area-inset-bottom)); outline: none; }
.fc-h2 { font-size: 20px; margin: 18px 2px 10px; letter-spacing: -.01em; }
.fc-h3 { font-size: 14px; text-transform: uppercase; letter-spacing: .05em; color: var(--fc-muted); margin: 20px 2px 8px; }
.fc-muted { color: var(--fc-muted); }
.fc-small { font-size: 13px; color: var(--fc-muted); margin: 8px 0 0; }
.fc-center { text-align: center; margin: 18px 0; }
.fc-loading { display: flex; justify-content: center; padding: 60px 0; }
.fc-spin { width: 30px; height: 30px; border: 3px solid var(--fc-line); border-top-color: var(--fc-accent); border-radius: 50%; animation: fc-spin .8s linear infinite; }
@keyframes fc-spin { to { transform: rotate(360deg); } }

/* Day strip */
.fc-strip-wrap { margin: 0 -16px; }
.fc-strip { display: flex; gap: 8px; overflow-x: auto; padding: 4px 16px 8px; scroll-snap-type: x proximity; scrollbar-width: none; }
.fc-strip::-webkit-scrollbar { display: none; }
.fc-day {
  flex: 0 0 auto; width: 58px; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 8px 0 6px; border-radius: 12px; border: 1px solid var(--fc-line); background: var(--fc-card); cursor: pointer; scroll-snap-align: center;
}
.fc-day-wd { font-size: 12px; color: var(--fc-muted); font-weight: 600; }
.fc-day-n { font-size: 19px; font-weight: 700; }
.fc-day-dot { width: 5px; height: 5px; border-radius: 50%; background: transparent; }
.fc-day-dot.has { background: var(--fc-accent); }
.fc-day.is-active { background: var(--fc-accent); border-color: var(--fc-accent); color: #fff; }
.fc-day.is-active .fc-day-wd { color: rgba(255,255,255,.85); }
.fc-day.is-active .fc-day-dot.has { background: #fff; }

/* Class cards */
.fc-list { display: flex; flex-direction: column; gap: 10px; }
.fc-card, .fc-teach {
  position: relative; display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  background: var(--fc-card); border: 1px solid var(--fc-line); border-radius: var(--fc-radius);
  padding: 14px 14px 14px 18px; cursor: pointer; overflow: hidden;
}
.fc-card::before, .fc-teach::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: var(--c, var(--fc-accent)); }
.fc-card.is-cancelled { opacity: .7; }
.fc-card.is-cancelled h3 { text-decoration: line-through; }
.fc-card-time { flex: 0 0 64px; display: flex; flex-direction: column; }
.fc-card-time strong { font-size: 15px; white-space: nowrap; }
.fc-card-time span { font-size: 12px; color: var(--fc-muted); }
.fc-card-body { flex: 1 1 auto; min-width: 0; }
.fc-card-body h3 { margin: 0; font-size: 16px; line-height: 1.25; overflow-wrap: anywhere; }
.fc-card-day { font-size: 12px; font-weight: 700; color: var(--fc-accent); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 2px; }
.fc-meta { margin: 2px 0 0; font-size: 13px; color: var(--fc-muted); overflow-wrap: anywhere; }
.fc-spots { margin: 4px 0 0; font-size: 13px; color: var(--fc-muted); }
.fc-card-act { flex: 0 0 auto; }

/* Buttons & pills */
.fc-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 0; cursor: pointer;
  background: var(--fc-accent); color: #fff; font-weight: 600; font-size: 15px; text-decoration: none;
  padding: 11px 18px; border-radius: 10px; min-height: 44px; line-height: 1.2; text-align: center;
}
.fc-btn:disabled { opacity: .6; cursor: default; }
.fc-btn.is-busy { position: relative; color: transparent; }
.fc-btn.is-busy::after { content: ""; position: absolute; width: 18px; height: 18px; border: 2px solid rgba(255,255,255,.5); border-top-color: #fff; border-radius: 50%; animation: fc-spin .8s linear infinite; }
.fc-btn-ghost.is-busy::after { border-color: var(--fc-line); border-top-color: var(--fc-accent); }
.fc-btn-sm { padding: 8px 14px; min-height: 38px; font-size: 14px; }
.fc-btn-ghost { background: transparent; color: var(--fc-accent); box-shadow: inset 0 0 0 1.5px var(--fc-accent); }
.fc-btn-danger { background: var(--fc-bad); color: #fff; }
.fc-btn-block { width: 100%; }
.fc-pill { display: inline-flex; align-items: center; gap: 4px; padding: 5px 10px; border-radius: 999px; font-size: 13px; font-weight: 600; background: #eef1f6; color: var(--fc-muted); white-space: nowrap; }
.fc-pill svg { width: 15px; height: 15px; }
.fc-pill.is-ok { background: var(--fc-ok-bg); color: var(--fc-ok); }
.fc-pill.is-wait { background: var(--fc-wait-bg); color: var(--fc-wait); }
.fc-pill.is-bad { background: var(--fc-bad-bg); color: var(--fc-bad); }
.fc-link { background: none; border: 0; padding: 0; color: var(--fc-accent); font-weight: 600; font-size: 14px; cursor: pointer; text-decoration: none; }
.fc-link.is-danger { color: var(--fc-bad); }
.fc-icon-btn { width: 40px; height: 40px; border: 0; background: #eef1f6; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; flex-shrink: 0; }

/* Notes */
.fc-note { display: flex; gap: 8px; align-items: flex-start; background: #eef2ff; color: #1e3a8a; padding: 11px 13px; border-radius: 10px; font-size: 14px; margin: 10px 0; }
.fc-note.is-ok { background: var(--fc-ok-bg); color: var(--fc-ok); font-weight: 600; }
.fc-note.is-wait { background: var(--fc-wait-bg); color: #713f12; }
.fc-note.is-bad { background: var(--fc-bad-bg); color: var(--fc-bad); }
.fc-empty { text-align: center; padding: 34px 18px; background: var(--fc-card); border: 1px dashed var(--fc-line); border-radius: var(--fc-radius); }
.fc-empty strong { display: block; font-size: 16px; }
.fc-empty p { color: var(--fc-muted); margin: 6px 0 14px; font-size: 14px; }
.fc-empty.is-error strong { color: var(--fc-bad); }

/* Bottom sheet */
.fc-sheet-wrap { position: fixed; inset: 0; z-index: 50; }
.fc-sheet-wrap[hidden] { display: none; }
.fc-sheet-bg { position: absolute; inset: 0; background: rgba(15,23,42,.45); opacity: 0; transition: opacity .2s; }
.fc-sheet {
  position: absolute; left: 0; right: 0; bottom: 0; max-width: 640px; margin: 0 auto; max-height: 88vh; overflow-y: auto;
  background: var(--fc-card); border-radius: 20px 20px 0 0; padding: 18px 18px calc(22px + env(safe-area-inset-bottom));
  transform: translateY(100%); transition: transform .25s ease;
}
.fc-sheet-wrap.is-open .fc-sheet-bg { opacity: 1; }
.fc-sheet-wrap.is-open .fc-sheet { transform: none; }
.fc-sheet-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; border-left: 5px solid var(--c, var(--fc-accent)); padding-left: 12px; }
.fc-sheet-head h2 { margin: 6px 0 0; font-size: 21px; overflow-wrap: anywhere; min-width: 0; }
.fc-sheet-img { width: 100%; max-height: 180px; object-fit: cover; border-radius: 12px; margin-top: 14px; }
.fc-facts { list-style: none; margin: 14px 0 0; padding: 0; }
.fc-facts li { display: flex; align-items: center; gap: 10px; padding: 6px 0; font-size: 15px; color: var(--fc-text); }
.fc-facts li svg { color: var(--fc-muted); }
.fc-facts li span { min-width: 0; overflow-wrap: anywhere; }
.fc-desc { margin: 12px 0; font-size: 15px; color: #334155; overflow-wrap: anywhere; }
.fc-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.fc-actions-wrap { flex-direction: row; flex-wrap: wrap; }
.fc-actions-wrap .fc-btn { flex: 1 1 140px; }
.fc-confirm { margin-top: 16px; padding: 14px; border-radius: 12px; background: var(--fc-bad-bg); }
.fc-confirm p { margin: 0; font-weight: 600; color: var(--fc-bad); }
.fc-confirm .fc-actions { margin-top: 12px; }
.fc-confirm .fc-btn-ghost { background: #fff; }

/* My classes */
.fc-booking { display: flex; flex-direction: column; }
.fc-booking .fc-card { border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.fc-booking-links { display: flex; gap: 18px; flex-wrap: wrap; padding: 10px 18px; background: var(--fc-card); border: 1px solid var(--fc-line); border-top: 0; border-radius: 0 0 var(--fc-radius) var(--fc-radius); }
.fc-booking:not(:has(.fc-booking-links)) .fc-card { border-radius: var(--fc-radius); }
.fc-past, .fc-hist, .fc-roster { list-style: none; margin: 0; padding: 0; background: var(--fc-card); border: 1px solid var(--fc-line); border-radius: var(--fc-radius); overflow: hidden; }
.fc-past li, .fc-hist li, .fc-roster li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; border-top: 1px solid var(--fc-line); }
.fc-past li:first-child, .fc-hist li:first-child, .fc-roster li:first-child { border-top: 0; }
.fc-past li { border-left: 4px solid var(--c, var(--fc-accent)); }
.fc-past li div, .fc-hist li div, .fc-roster li div { display: flex; flex-direction: column; min-width: 0; }
.fc-past li span, .fc-hist li span, .fc-roster li span { font-size: 13px; color: var(--fc-muted); }
.fc-past strong, .fc-hist strong, .fc-roster strong { overflow-wrap: anywhere; }

/* Account */
.fc-profile { display: flex; align-items: center; gap: 12px; margin: 10px 0 14px; }
.fc-profile div:last-child { display: flex; flex-direction: column; min-width: 0; }
.fc-profile span { font-size: 14px; color: var(--fc-muted); overflow-wrap: anywhere; }
.fc-avatar { width: 52px; height: 52px; border-radius: 50%; background: var(--fc-accent); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 22px; font-weight: 700; flex-shrink: 0; }
.fc-panel { background: var(--fc-card); border: 1px solid var(--fc-line); border-radius: var(--fc-radius); padding: 16px; margin: 12px 0; }
.fc-panel h3 { margin: 0 0 6px; font-size: 16px; }
.fc-panel p { margin: 0; font-size: 14px; color: #334155; }
.fc-ok-text { display: flex; gap: 6px; align-items: center; color: var(--fc-ok) !important; font-weight: 600; }
.fc-balance { display: flex; align-items: baseline; gap: 8px; margin: 4px 0 12px; }
.fc-balance strong { font-size: 34px; line-height: 1; color: var(--fc-accent); }
.fc-balance span { color: var(--fc-muted); }
.fc-buy { display: flex; flex-direction: column; gap: 8px; }
.fc-details { margin-top: 12px; }
.fc-details summary { cursor: pointer; font-weight: 600; color: var(--fc-accent); font-size: 14px; padding: 4px 0; }
.fc-details .fc-hist { margin-top: 8px; }
.fc-hist b { font-size: 15px; white-space: nowrap; }
.fc-hist .is-plus { color: var(--fc-ok); }
.fc-hist .is-minus { color: var(--fc-text); }
.fc-switch { display: flex; align-items: center; gap: 12px; margin-top: 12px; font-size: 15px; cursor: pointer; }
.fc-switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.fc-switch span { position: relative; width: 48px; height: 28px; border-radius: 999px; background: #cbd5e1; flex-shrink: 0; transition: background .15s; }
.fc-switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .15s; }
.fc-switch input:checked + span { background: var(--fc-accent); }
.fc-switch input:checked + span::after { transform: translateX(20px); }
.fc-switch input:focus-visible + span { outline: 2px solid var(--fc-accent); outline-offset: 2px; }

/* Sign in */
.fc-auth { background: var(--fc-card); border: 1px solid var(--fc-line); border-radius: var(--fc-radius); padding: 24px 18px; margin-top: 12px; text-align: center; }
.fc-auth-logo { border-radius: 14px; }
.fc-auth h2 { margin: 12px 0 4px; font-size: 22px; }
.fc-auth .fc-muted { margin: 0 0 16px; font-size: 14px; }
.fc-form { text-align: left; display: flex; flex-direction: column; gap: 12px; }
.fc-form label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 600; }
.fc-form input { width: 100%; padding: 12px 13px; border: 1.5px solid var(--fc-line); border-radius: 10px; background: #fff; font-size: 16px; font-weight: 400; outline: none; }
.fc-form input:focus { border-color: var(--fc-accent); }
.fc-form .fc-small { margin: -6px 0 0; }
.fc-form-err { color: var(--fc-bad); font-size: 14px; font-weight: 600; }
.fc-form-err:empty { display: none; }
.fc-hp { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; }

/* Instructors */
.fc-teach { margin-bottom: 10px; font: inherit; }
.fc-teach-count { flex: 0 0 auto; text-align: center; display: flex; flex-direction: column; }
.fc-teach-count strong { font-size: 18px; color: var(--fc-accent); }
.fc-teach-count span { font-size: 11px; color: var(--fc-muted); }
.fc-back { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; text-decoration: none; margin: 4px 0 10px; }
.fc-roster-head { background: var(--fc-card); border: 1px solid var(--fc-line); border-left: 5px solid var(--c, var(--fc-accent)); border-radius: var(--fc-radius); padding: 14px 16px; margin-bottom: 14px; }
.fc-roster-head h2 { margin: 0; font-size: 20px; overflow-wrap: anywhere; }
.fc-roster-head p { margin: 4px 0 0; font-size: 14px; color: var(--fc-muted); }
.fc-roster-count strong { color: var(--fc-accent); font-size: 18px; }
.fc-roster li.is-in { background: #f0fdf4; }
.fc-roster li.is-miss span { color: var(--fc-bad); }
.fc-check { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 8px 14px; border-radius: 10px; border: 1.5px solid var(--fc-line); background: #fff; font-weight: 600; font-size: 14px; cursor: pointer; flex-shrink: 0; }
.fc-check svg { color: #cbd5e1; }
.fc-check.is-on { background: var(--fc-ok); border-color: var(--fc-ok); color: #fff; }
.fc-check.is-on svg { color: #fff; }

/* Tab bar */
.fc-tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: rgba(255,255,255,.97); border-top: 1px solid var(--fc-line); padding-bottom: env(safe-area-inset-bottom); backdrop-filter: blur(8px); }
.fc-tabs-in { max-width: 640px; margin: 0 auto; display: flex; height: var(--fc-tabs-h); }
.fc-tab { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--fc-muted); text-decoration: none; font-size: 11.5px; font-weight: 600; }
.fc-tab svg { width: 24px; height: 24px; }
.fc-tab span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.fc-tab.is-active { color: var(--fc-accent); }

/* Toast */
.fc-toast {
  position: fixed; left: 50%; bottom: calc(var(--fc-tabs-h) + 16px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px);
  background: #0f172a; color: #fff; padding: 12px 16px; border-radius: 12px; font-size: 14px; font-weight: 600; z-index: 60;
  max-width: calc(100vw - 32px); width: max-content; text-align: center; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
}
.fc-toast.is-on { opacity: 1; transform: translate(-50%, 0); }
.fc-toast.is-error { background: var(--fc-bad); }

@media (min-width: 700px) {
  .fc-main { padding-top: 20px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation-duration: .01ms !important; }
}
/* While a class sheet is open, show messages at the top so they don't cover its buttons. */
body.fc-noscroll .fc-toast { bottom: auto; top: calc(16px + env(safe-area-inset-top)); transform: translate(-50%, -20px); }
body.fc-noscroll .fc-toast.is-on { transform: translate(-50%, 0); }
.fc-roster li .fc-check span { color: inherit; font-size: 14px; }
