/* Undefine Fitness — shared styles.
   Dark theme by default (public site, member app, coach app). Add class="theme-light" on <body> for admin. */

:root {
  --bg: #0A0A0A;
  --surface: #151515;
  --surface-2: #1E1E1E;
  --border: #262626;
  --border-strong: #3A3A3A;
  --text: #F4F1EC;
  --text-2: #CFCAC2;
  --muted: #A8A39C;
  --accent: #FF6B2C;
  --accent-hover: #FF8F5C;
  --accent-ink: #0A0A0A;
  --accent-text: #FF6B2C;      /* accent used as text on this theme (passes 4.5:1 on dark) */
  --ok-bg: #1F2A1A; --ok-fg: #B7E39A;
  --warn-bg: #2E1F12; --warn-fg: #F7C9A8;
  --bad-bg: #2E1515; --bad-fg: #F5B1B1;
  --info-bg: #17202E; --info-fg: #B3C7EE;
  --radius: 16px;
  --radius-sm: 10px;
  --font-display: 'Anton', 'Noto Sans HK', Impact, sans-serif;
  --font-body: 'Archivo', 'Noto Sans HK', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color-scheme: dark;
}

.theme-light {
  --bg: #F4F1EC;
  --surface: #FFFFFF;
  --surface-2: #FAF7F2;
  --border: #E4DED4;
  --border-strong: #CFC8BD;
  --text: #141414;
  --text-2: #3E3A35;
  --muted: #5E5952;
  --accent-text: #B4440F;
  --ok-bg: #E3F1DA; --ok-fg: #2F5A17;
  --warn-bg: #FFE8D6; --warn-fg: #8A320A;
  --bad-bg: #F1E3E3; --bad-fg: #7A2323;
  --info-bg: #E3E8F4; --info-fg: #22396B;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--font-body); font-size: 16px; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
[x-cloak] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ───── layout helpers ───── */
.container { max-width: 1280px; margin: 0 auto; padding-inline: 32px; }
.container--narrow { max-width: 1080px; }
.section { padding-block: 96px; }
.section--tight { padding-block: 56px; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.stack-sm { display: flex; flex-direction: column; gap: 8px; }
.row { display: flex; align-items: center; gap: 12px; }
.row-wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.between { justify-content: space-between; }
.grow { flex: 1 1 auto; min-width: 0; }
.grid { display: grid; gap: 16px; }
.grid-auto { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.grid-auto-sm { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.split { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; }
.split > .main { flex: 3 1 480px; min-width: 0; }
.split > .side { flex: 2 1 320px; min-width: 0; }
.mt-2 { margin-top: 8px; } .mt-4 { margin-top: 16px; } .mt-6 { margin-top: 24px; } .mt-8 { margin-top: 40px; }
.muted { color: var(--muted); }
.text-2 { color: var(--text-2); }
.small { font-size: 14px; }
.xsmall { font-size: 12px; }
.bold { font-weight: 700; }
.nowrap { white-space: nowrap; }
.tabular { font-variant-numeric: tabular-nums; }
.right { text-align: right; }
.accent { color: var(--accent-text); }

/* ───── type ───── */
.display { font-family: var(--font-display); font-weight: 400; text-transform: uppercase; line-height: 0.95; letter-spacing: -0.5px; margin: 0; }
.display--xl { font-size: clamp(56px, 10vw, 152px); line-height: 0.9; }
.display--lg { font-size: clamp(44px, 6vw, 72px); }
.display--md { font-size: clamp(36px, 5vw, 64px); }
.display--sm { font-size: 32px; line-height: 1.05; }
.display--xs { font-size: 24px; line-height: 1.1; }
.eyebrow { color: var(--accent-text); font-weight: 700; letter-spacing: 2px; text-transform: uppercase; font-size: 13px; }
.eyebrow-muted { color: var(--muted); font-weight: 700; letter-spacing: 1px; text-transform: uppercase; font-size: 12px; margin-bottom: 6px; }
.lead { font-size: 20px; line-height: 1.55; color: var(--text-2); max-width: 600px; }
h1, h2, h3 { margin: 0; }
.h-card { font-size: 16px; font-weight: 700; margin: 0 0 12px; }
.stat { font-family: var(--font-display); font-size: 40px; line-height: 1.05; }
.stat--sm { font-size: 30px; }

/* ───── buttons ───── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 22px; border-radius: 999px; border: 1px solid transparent;
  font-weight: 700; font-size: 15px; line-height: 1; text-decoration: none; white-space: nowrap;
  background: transparent; color: var(--text); transition: background .15s, border-color .15s, color .15s;
}
.btn:hover { text-decoration: none; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.btn-sm { min-height: 44px; padding: 0 16px; font-size: 14px; }
.btn-xs { min-height: 36px; padding: 0 12px; font-size: 13px; }
.btn-block { width: 100%; }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-dark { background: #0A0A0A; color: #F4F1EC; }
.btn-dark:hover { background: #262626; }
.btn-light { background: #F4F1EC; color: #0A0A0A; }
.btn-outline { border-color: var(--border-strong); color: var(--text); background: transparent; }
.btn-outline:hover { border-color: var(--text-2); }
.theme-light .btn-outline { background: #FFFFFF; }
.btn-danger { border-color: #C9A9A9; color: var(--bad-fg); background: transparent; }
.theme-light .btn-danger { background: #FFFFFF; }
.btn-dashed { border: 1px dashed var(--border-strong); }
.link-btn { background: none; border: none; padding: 0; color: var(--accent-text); font-weight: 600; }
.icon-btn { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--border-strong); background: transparent; display: inline-flex; align-items: center; justify-content: center; font-size: 18px; }

/* ───── chips / segmented ───── */
.chips { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.chip {
  min-height: 44px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--border-strong);
  background: transparent; color: var(--text); font-weight: 600; font-size: 14px;
}
.chip-sm { min-height: 38px; padding: 0 14px; font-size: 13px; }
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.theme-light .chip { background: #FFFFFF; }
.theme-light .chip[aria-pressed="true"] { background: #0A0A0A; border-color: #0A0A0A; color: #F4F1EC; }
.segmented { display: inline-flex; gap: 4px; padding: 4px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); }
.segmented button { min-height: 40px; padding: 0 14px; border: none; border-radius: 999px; background: transparent; font-weight: 700; font-size: 13px; }
.segmented button[aria-pressed="true"] { background: var(--text); color: var(--bg); }

.lang-toggle { display: inline-flex; gap: 2px; padding: 3px; border-radius: 999px; background: #1E1E1E; }
.lang-toggle button { min-height: 36px; min-width: 44px; padding: 0 10px; border: none; border-radius: 999px; background: transparent; color: #CFCAC2; font-weight: 700; font-size: 13px; }
.lang-toggle button[aria-pressed="true"] { background: #F4F1EC; color: #0A0A0A; }

/* ───── cards ───── */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.card--lg { padding: 28px; border-radius: 20px; }
.card--accent { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.card--flush { padding: 0; overflow: hidden; }
.card-inset { background: var(--surface-2); border-radius: 12px; padding: 14px; }
.kpi .label { font-size: 13px; color: var(--muted); font-weight: 600; }
.kpi .sub { font-size: 13px; margin-top: 4px; }

/* ───── pills / tags ───── */
.pill { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 999px; white-space: nowrap; background: var(--surface-2); color: var(--text-2); }
.pill--ok { background: var(--ok-bg); color: var(--ok-fg); }
.pill--warn { background: var(--warn-bg); color: var(--warn-fg); }
.pill--bad { background: var(--bad-bg); color: var(--bad-fg); }
.pill--info { background: var(--info-bg); color: var(--info-fg); }
.pill--accent { background: transparent; border: 1px solid var(--accent); color: var(--accent-text); }
.stars { color: var(--accent-text); letter-spacing: 2px; font-size: 14px; }
.dot { width: 10px; height: 10px; border-radius: 50%; flex: none; background: var(--muted); }
.dot--bad { background: #B32D2D; } .dot--warn { background: #E0661F; } .dot--info { background: #4466A8; } .dot--ok { background: #3E7D1F; }

/* ───── forms ───── */
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; }
.input, .select, .textarea {
  min-height: 44px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); padding: 0 12px; font-size: 15px; font-weight: 400; width: 100%;
}
.textarea { padding: 10px 12px; min-height: 88px; resize: vertical; }
.search { display: flex; align-items: center; gap: 8px; border: 1px solid var(--border-strong); border-radius: 999px; padding: 0 14px; min-height: 44px; background: var(--surface); }
.search input { border: none; outline: none; background: transparent; flex: 1; min-width: 0; font-size: 14px; }
.check { display: flex; align-items: center; gap: 10px; min-height: 44px; font-size: 14px; font-weight: 600; }
.check input { width: 20px; height: 20px; accent-color: var(--accent); }
.form-grid { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 560px) { .form-grid { grid-template-columns: 1fr; } }
.stepper { display: flex; align-items: center; gap: 6px; }
.stepper .val { min-width: 48px; text-align: center; font-family: var(--font-display); font-size: 26px; }

.switch { width: 52px; height: 30px; border-radius: 999px; border: none; background: var(--border-strong); position: relative; padding: 0; flex: none; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #FFFFFF; transition: left .15s; }
.switch[aria-checked="true"] { background: var(--accent); }
.switch[aria-checked="true"]::after { left: 25px; }

/* ───── tables ───── */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 1px; font-weight: 700; padding: 10px 8px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 12px 8px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr.is-clickable { cursor: pointer; }
.table tr.is-clickable:hover td { background: var(--surface-2); }

/* ───── tabs ───── */
.tabs { display: flex; flex-wrap: wrap; gap: 4px; border-bottom: 1px solid var(--border); }
.tabs button { min-height: 44px; padding: 0 16px; border: none; background: transparent; font-weight: 700; font-size: 14px; color: var(--muted); border-bottom: 3px solid transparent; margin-bottom: -1px; }
.tabs button[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); }

/* ───── avatar ───── */
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--surface-2); color: var(--text-2); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; flex: none; }
.avatar--lg { width: 72px; height: 72px; font-family: var(--font-display); font-size: 28px; background: #0A0A0A; color: #F4F1EC; }
.avatar--accent { background: var(--accent); color: var(--accent-ink); }

/* ───── progress / bars ───── */
.bar { height: 10px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.theme-light .bar { background: #EFEAE2; }
.bar > span { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.bar--dark > span { background: var(--text); }
.hbar { display: grid; grid-template-columns: minmax(90px, 170px) 1fr auto; gap: 12px; align-items: center; font-size: 14px; }
.hbar .track { height: 14px; background: var(--surface-2); border-radius: 4px; }
.theme-light .hbar .track { background: #F4F1EC; }
.hbar .track > span { display: block; height: 100%; background: var(--accent); border-radius: 0 4px 4px 0; }

/* ───── toast ───── */
.toast-region { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: 8px; width: min(92vw, 520px); pointer-events: none; }
.toast { padding: 14px 18px; border-radius: 14px; font-weight: 700; font-size: 14px; background: var(--accent); color: var(--accent-ink); box-shadow: 0 8px 30px rgba(0,0,0,.35); }
.toast--bad { background: #B32D2D; color: #FFFFFF; }
.toast--info { background: #F4F1EC; color: #0A0A0A; }

/* ───── dialog ───── */
.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 90; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal { background: var(--surface); color: var(--text); border-radius: 20px; padding: 24px; width: min(560px, 100%); max-height: 90vh; overflow-y: auto; border: 1px solid var(--border); }

/* ───── brand + public header ───── */
.brand { display: flex; align-items: center; gap: 12px; color: var(--text); text-decoration: none; }
.brand:hover { text-decoration: none; }
.brand img { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; }
.brand__word { font-family: var(--font-display); font-size: 20px; letter-spacing: 1px; line-height: 1; }
.brand__word .accent { color: var(--accent); }

.site-header { border-bottom: 1px solid #222; position: sticky; top: 0; z-index: 50; background: rgba(10,10,10,.92); backdrop-filter: blur(8px); }
.site-header__row { display: flex; flex-wrap: wrap; align-items: center; gap: 16px 24px; justify-content: space-between; padding-block: 14px; }
.site-nav { display: flex; flex-wrap: wrap; gap: 24px; font-weight: 600; font-size: 15px; }
.site-nav a { color: var(--text); }
.site-nav a[aria-current="page"] { color: var(--accent); }
.site-header__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.menu-btn { display: none; width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--border-strong); background: transparent; color: var(--text); align-items: center; justify-content: center; }
@media (max-width: 980px) {
  .menu-btn { display: inline-flex; }
  .site-nav, .site-header__actions { display: none; width: 100%; }
  .site-nav.is-open { display: flex; flex-direction: column; gap: 4px; }
  .site-nav.is-open a { padding: 10px 0; font-size: 17px; }
  .site-header__actions.is-open { display: flex; padding-bottom: 8px; }
}

.site-footer { border-top: 1px solid #222; }
.site-footer__grid { display: flex; flex-wrap: wrap; gap: 48px; justify-content: space-between; padding-block: 80px 40px; }
.site-footer__grid > :first-child { flex: 1 1 460px; }
.site-footer__cols { flex: 1 1 300px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; color: var(--text-2); font-size: 15px; }
.site-footer__cols p { margin: 0 0 6px; }
.site-footer__base { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; padding-block: 20px 40px; color: var(--muted); font-size: 13px; }

.marquee { background: var(--accent); color: var(--accent-ink); font-family: var(--font-display); font-size: 28px; text-transform: uppercase; letter-spacing: 1px; padding: 14px 0; white-space: nowrap; overflow: hidden; }
.marquee__inner { display: inline-block; animation: marquee 40s linear infinite; }
@keyframes marquee { from { transform: translateX(0); } to { transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce) { .marquee__inner { animation: none; } html { scroll-behavior: auto; } }

.photo-ph { background: var(--surface); border: 1px solid var(--border); border-radius: 20px; display: flex; flex-direction: column; justify-content: space-between; padding: 24px; position: relative; overflow: hidden; }
.photo-ph__label { font-size: 12px; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); }

/* ───── schedule list (public) ───── */
.day-block h2 { display: flex; gap: 14px; align-items: baseline; flex-wrap: wrap; }
.class-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 24px; padding: 18px 4px; border-bottom: 1px solid var(--border); }
.class-row:first-child { border-top: 1px solid var(--border); }
.class-row.is-closed { opacity: .6; }
.class-row .time { width: 120px; font-weight: 700; font-size: 17px; font-variant-numeric: tabular-nums; }
.class-row .info { flex: 1 1 260px; min-width: 0; }
.class-row .lvl { width: 90px; }
.class-row .spots { width: 120px; font-size: 14px; }
.class-row .cta { min-width: 140px; display: flex; justify-content: flex-end; }

/* ───── admin layout ───── */
.admin { display: flex; flex-wrap: wrap; min-height: 100vh; }
.sidebar { flex: 1 1 220px; max-width: 100%; background: #0A0A0A; color: #F4F1EC; padding: 24px 16px; display: flex; flex-direction: column; gap: 28px; }
.sidebar .brand { color: #F4F1EC; padding: 0 8px; }
.sidebar .brand img { width: 40px; height: 40px; }
.sidebar .brand__word { font-size: 18px; }
.sidebar__top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.sidebar__top .menu-btn { color: #F4F1EC; border-color: #3A3A3A; }
.sidebar__body { display: flex; flex-direction: column; gap: 28px; flex: 1; }
.sidebar__nav { display: flex; flex-direction: column; gap: 2px; font-size: 15px; font-weight: 600; }
.sidebar__nav a { padding: 12px; border-radius: 10px; color: #CFCAC2; text-decoration: none; }
.sidebar__nav a:hover { background: #1E1E1E; color: #F4F1EC; }
.sidebar__nav a[aria-current="page"] { background: var(--accent); color: #0A0A0A; }
.sidebar__foot { margin-top: auto; display: flex; flex-direction: column; gap: 12px; }
.sidebar__foot .lang-toggle { display: flex; }
.sidebar__foot .lang-toggle button { flex: 1; }
.sidebar__user { display: flex; align-items: center; gap: 10px; padding: 0 8px; color: #CFCAC2; flex-wrap: wrap; }
.sidebar__user .link-btn { color: #FF8F5C; }
.demo-tools { font-size: 13px; color: #CFCAC2; padding: 0 8px; }
.demo-tools summary { cursor: pointer; min-height: 32px; display: flex; align-items: center; }
.demo-tools button { display: block; width: 100%; text-align: left; background: none; border: none; color: #CFCAC2; padding: 8px 0; }
.demo-tools button:hover { color: #FFFFFF; }
.admin-main { flex: 999 1 640px; min-width: 0; padding: 28px 32px 48px; }
.page-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 24px; }
.page-head h1 { font-family: var(--font-display); font-weight: 400; font-size: 44px; text-transform: uppercase; line-height: 1; margin-top: 4px; }
@media (max-width: 860px) {
  .sidebar { padding: 14px 16px; gap: 0; }
  .sidebar__top .menu-btn { display: inline-flex; }
  .sidebar__body { display: none; padding-top: 16px; }
  .sidebar__body.is-open { display: flex; }
  .admin-main { padding: 20px 16px 40px; }
}

/* ───── phone apps (member / coach) ───── */
.app-shell { max-width: 480px; margin: 0 auto; min-height: 100vh; display: flex; flex-direction: column; }
.app-top { padding: 18px 20px 12px; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.app-body { flex: 1; padding: 4px 20px 100px; display: flex; flex-direction: column; gap: 14px; }
.app-tabs { position: sticky; bottom: 0; border-top: 1px solid #222; background: rgba(10,10,10,.96); display: grid; grid-template-columns: repeat(var(--tabs, 3), minmax(0, 1fr)); padding: 6px 8px calc(14px + env(safe-area-inset-bottom)); }
.app-tabs button { min-height: 52px; border: none; background: transparent; color: var(--muted); font-weight: 700; font-size: 13px; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.app-tabs button::before { content: ''; width: 22px; height: 3px; border-radius: 3px; background: transparent; }
.app-tabs button[aria-current="page"] { color: var(--accent); }
.app-tabs button[aria-current="page"]::before { background: var(--accent); }

/* ───── misc ───── */
.empty { padding: 32px; text-align: center; color: var(--muted); }
.divider { height: 1px; background: var(--border); border: 0; margin: 16px 0; }
.list-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; padding: 12px 0; border-top: 1px solid var(--border); }
.list-row:first-child { border-top: none; }
.notice { padding: 12px 14px; border-radius: 12px; font-size: 14px; }
.notice--warn { background: var(--warn-bg); color: var(--warn-fg); }
.notice--ok { background: var(--ok-bg); color: var(--ok-fg); }
.notice--info { background: var(--info-bg); color: var(--info-fg); }
.notice--bad { background: var(--bad-bg); color: var(--bad-fg); }
.qr { background: #FFFFFF; padding: 12px; border-radius: 12px; width: fit-content; margin: 0 auto; }
.qr img, .qr svg { width: 200px; height: 200px; image-rendering: pixelated; }

@media (max-width: 640px) {
  .container { padding-inline: 16px; }
  .section { padding-block: 64px; }
  .card--lg { padding: 20px; }
}
