/* OFC reports — neumorphic UI in onlinefitnessclub.com colours (accent #e4514a, ink #0c0d25). */
:root {
  --bg: #e8ebf2;
  --surface: #e8ebf2;
  --raised-hi: rgba(255, 255, 255, .95);
  --raised-lo: rgba(158, 168, 192, .55);
  --text: #0c0d25;
  --muted: #565b74;
  --faint: #5f647c;
  --accent-text: #b02f29;
  --line: rgba(12, 13, 37, .08);
  --accent: #e4514a;
  --accent-2: #c93b35;
  --accent-ink: #fff;
  --accent-soft: rgba(228, 81, 74, .12);
  --good: #0b6845;
  --bad: #a8261f;
  --good-soft: rgba(18, 130, 90, .12);
  --bad-soft: rgba(204, 58, 51, .12);
  --ink-series: #2a2f6b;
  --tooltip: #fff;
  --r-lg: 22px;
  --r-md: 16px;
  --r-sm: 12px;
  --sh-out: 7px 7px 16px var(--raised-lo), -7px -7px 16px var(--raised-hi);
  --sh-out-sm: 4px 4px 9px var(--raised-lo), -4px -4px 9px var(--raised-hi);
  --sh-in: inset 4px 4px 9px var(--raised-lo), inset -4px -4px 9px var(--raised-hi);
  --sh-in-sm: inset 2px 2px 5px var(--raised-lo), inset -2px -2px 5px var(--raised-hi);
  --font: 'Montserrat', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --display: 'Ruberoid', 'Montserrat', system-ui, sans-serif;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #171931;
  --surface: #171931;
  --raised-hi: rgba(255, 255, 255, .045);
  --raised-lo: rgba(0, 0, 0, .55);
  --text: #eef0fa;
  --muted: #a7abc6;
  --faint: #9a9eba;
  --accent-text: #ff8a84;
  --line: rgba(255, 255, 255, .08);
  --accent: #ef5f58;
  --accent-2: #ff7a73;
  --accent-soft: rgba(239, 95, 88, .16);
  --good: #3fcf96;
  --bad: #ff7a73;
  --good-soft: rgba(63, 207, 150, .14);
  --bad-soft: rgba(255, 122, 115, .14);
  --ink-series: #8f9aef;
  --tooltip: #22254a;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 500 14px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  overflow-x: hidden;
}
h1, h2, h3 { font-family: var(--display); font-weight: 700; margin: 0; letter-spacing: .01em; }
button, input, select { font: inherit; color: inherit; }
a { color: var(--accent-text); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 8px; }
.num, td.num, .kpi-value { font-variant-numeric: tabular-nums; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- primitives ---------- */
.neu { background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--sh-out); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 0 16px; border: 0; border-radius: var(--r-sm);
  background: var(--surface); box-shadow: var(--sh-out-sm); cursor: pointer;
  font-weight: 600; white-space: nowrap; transition: box-shadow .15s, transform .15s, color .15s;
}
.btn:hover { color: var(--accent); }
.btn:active, .btn[aria-pressed="true"] { box-shadow: var(--sh-in-sm); transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: progress; }
.btn.accent { background: linear-gradient(145deg, #ee6a63, var(--accent-2)); color: var(--accent-ink); box-shadow: var(--sh-out-sm); }
.btn.accent:hover { color: var(--accent-ink); filter: brightness(1.05); }
.btn.small { min-height: 32px; padding: 0 12px; font-size: 13px; }
.btn.ghost { box-shadow: none; background: transparent; }
.btn.ghost:hover { box-shadow: var(--sh-out-sm); }
.icon-btn { width: 40px; padding: 0; }
.icon { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.field { display: grid; gap: 6px; min-width: 0; }
.field > span { font-size: 12px; font-weight: 600; color: var(--muted); padding-left: 4px; }
.input, select.input {
  width: 100%; min-height: 40px; padding: 0 14px; border: 0; border-radius: var(--r-sm);
  background: var(--surface); box-shadow: var(--sh-in-sm); appearance: none; -webkit-appearance: none;
}
select.input {
  padding-right: 34px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23e4514a' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; background-size: 14px;
}
select.input.active { color: var(--accent); font-weight: 700; }
input[type="date"].input { padding-right: 8px; }

.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--accent-soft); border-top-color: var(--accent); animation: spin .8s linear infinite; display: inline-block; }
.spinner.sm { width: 16px; height: 16px; border-width: 2px; }
@keyframes spin { to { transform: rotate(360deg); } }
.boot { min-height: 100vh; display: grid; place-items: center; }

/* ---------- layout ---------- */
.app { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.side {
  position: sticky; top: 0; height: 100vh; padding: 24px 16px; display: flex; flex-direction: column; gap: 24px;
  background: var(--bg); z-index: 30;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 0 8px; text-decoration: none; color: var(--text); }
.logo {
  width: 44px; height: 44px; border-radius: 14px; display: flex; align-items: center; justify-content: center; flex: none;
  background: #0c0d25; color: #fff; box-shadow: var(--sh-out-sm);
  font: 700 13px/1 var(--display); letter-spacing: .04em;
}
.logo i { color: var(--accent); font-style: normal; }
.brand b { display: block; font: 700 15px/1.15 var(--display); }
.brand small { color: var(--muted); font-size: 12px; }
.nav { display: grid; gap: 8px; }
.nav a {
  display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 14px; border-radius: var(--r-md);
  color: var(--muted); text-decoration: none; font-weight: 600; transition: color .15s, box-shadow .15s;
}
.nav a:hover { color: var(--text); box-shadow: var(--sh-out-sm); }
.nav a[aria-current="page"] { color: var(--accent-text); box-shadow: var(--sh-in-sm); }
.nav .sep { height: 1px; background: var(--line); margin: 8px 6px; }
.side-foot { margin-top: auto; display: grid; gap: 12px; }
.me { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: var(--r-md); box-shadow: var(--sh-in-sm); min-width: 0; }
.avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--accent-soft); color: var(--accent-text); font-weight: 700; }
.me div { min-width: 0; }
.me b { display: block; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me small { color: var(--muted); font-size: 12px; }
.side-actions { display: flex; gap: 8px; }
.side-actions .btn { flex: 1; }

.main { min-width: 0; padding: 24px 28px 48px; display: grid; gap: 22px; align-content: start; }
.top { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.top h1 { font-size: 28px; line-height: 1.1; }
.top .sub { color: var(--muted); font-size: 13px; margin-top: 4px; }
.top-title { min-width: 0; flex: 1; }
.top-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.burger { display: none; }
.scrim { display: none; }

.sync { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; font-weight: 600; padding: 8px 12px; border-radius: 999px; box-shadow: var(--sh-in-sm); border: 0; background: var(--surface); }
button.sync { cursor: pointer; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--good); box-shadow: 0 0 0 3px var(--good-soft); flex: none; }
.dot.warn { background: #e09a1f; box-shadow: 0 0 0 3px rgba(224, 154, 31, .18); }
.dot.err { background: var(--bad); box-shadow: 0 0 0 3px var(--bad-soft); }
.banner { padding: 14px 18px; border-radius: var(--r-md); background: var(--bad-soft); color: var(--bad); font-weight: 600; display: flex; gap: 10px; align-items: center; }

/* ---------- filters ---------- */
.filters { padding: 18px; display: grid; gap: 14px; }
.frow { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; }
.frow .field { flex: 1 1 170px; }
.frow .field.date { flex: 0 1 160px; }
.frow .fbtn { flex: none; }
.fgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; padding-top: 4px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.period-label { color: var(--muted); font-size: 12px; font-weight: 600; margin-right: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; max-width: 100%; min-height: 30px; padding: 0 6px 0 12px;
  border: 0; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: 12px; font-weight: 700; cursor: pointer;
}
.chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip .x { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; background: rgba(255, 255, 255, .5); }
:root[data-theme="dark"] .chip .x { background: rgba(0, 0, 0, .25); }
.chip.plain { background: transparent; color: var(--muted); box-shadow: var(--sh-out-sm); padding: 0 12px; }

/* ---------- KPI ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 190px), 1fr)); gap: 18px; }
.kpi { padding: 18px 18px 16px; display: grid; gap: 8px; min-width: 0; align-content: start; }
.kpi-label { color: var(--muted); font-size: 12px; font-weight: 600; line-height: 1.3; min-height: 2.6em; }
.kpi-value { font: 700 26px/1.1 var(--display); letter-spacing: .01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi.lead .kpi-value { color: var(--accent); }
.kpi-foot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12px; color: var(--faint); }
.delta { display: inline-flex; align-items: center; gap: 3px; padding: 2px 8px; border-radius: 999px; font-weight: 700; font-size: 12px; }
.delta.up { color: var(--good); background: var(--good-soft); }
.delta.down { color: var(--bad); background: var(--bad-soft); }
.delta.flat { color: var(--muted); background: var(--line); }

/* ---------- blocks ---------- */
.blocks { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; }
.block { padding: 20px; min-width: 0; display: grid; gap: 14px; align-content: start; }
.block.wide { grid-column: 1 / -1; }
.block-head { display: flex; align-items: flex-start; gap: 10px; }
.block-head h2 { font-size: 17px; line-height: 1.25; flex: 1; min-width: 0; }
.block-head .hint { display: block; font: 500 12px/1.3 var(--font); color: var(--faint); margin-top: 4px; letter-spacing: 0; }
.chart { height: 320px; min-width: 0; border-radius: var(--r-md); box-shadow: var(--sh-in-sm); padding: 6px; }
.chart.tall { height: 420px; }
.empty { display: grid; place-items: center; min-height: 160px; color: var(--faint); font-weight: 600; text-align: center; padding: 20px; border-radius: var(--r-md); box-shadow: var(--sh-in-sm); }

/* ---------- tables ---------- */
.twrap { overflow: auto; max-height: 520px; border-radius: var(--r-md); box-shadow: var(--sh-in-sm); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
td.wrap { white-space: normal; min-width: 180px; max-width: 360px; }
th { position: sticky; top: 0; background: var(--surface); color: var(--muted); font-size: 12px; font-weight: 700; z-index: 1; cursor: pointer; user-select: none; }
th:hover { color: var(--text); }
th.num, td.num { text-align: right; }
th[aria-sort] { color: var(--accent); }
tbody tr:hover { background: var(--accent-soft); }
tbody tr.click { cursor: pointer; }
tfoot td { position: sticky; bottom: 0; background: var(--surface); font-weight: 700; border-top: 2px solid var(--accent); border-bottom: 0; }
td a { text-decoration: none; font-weight: 600; }
td a:hover { text-decoration: underline; }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 8px; vertical-align: -1px; }
.note { color: var(--faint); font-size: 12px; }

/* ---------- skeleton ---------- */
.sk { border-radius: 8px; background: linear-gradient(90deg, var(--line) 25%, rgba(127, 127, 160, .16) 50%, var(--line) 75%); background-size: 200% 100%; animation: sk 1.2s infinite; }
@keyframes sk { to { background-position: -200% 0; } }
.loading-veil { opacity: .55; pointer-events: none; transition: opacity .2s; }

/* ---------- login ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.login { width: min(400px, 100%); padding: 36px 30px; display: grid; gap: 18px; }
.login .brand { padding: 0; margin-bottom: 6px; }
.login h1 { font-size: 24px; }
.login p { margin: 0; color: var(--muted); }
.form-error { color: var(--bad); font-weight: 600; min-height: 1.4em; margin: 0; }

/* ---------- users ---------- */
.card { padding: 20px; display: grid; gap: 16px; min-width: 0; }
.card h2 { font-size: 17px; }
.uform { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr)); gap: 12px; align-items: end; }
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--line); color: var(--muted); }
.badge.admin { background: var(--accent-soft); color: var(--accent-text); }
.badge.off { background: var(--bad-soft); color: var(--bad); }
.row-actions { display: flex; gap: 8px; }

/* ---------- modal & toast ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(12, 13, 37, .45); display: grid; place-items: center; padding: 16px; z-index: 100; }
.modal { width: min(440px, 100%); padding: 26px; display: grid; gap: 16px; }
.modal h2 { font-size: 20px; }
.secret { font: 700 18px/1.3 ui-monospace, 'SF Mono', Menlo, monospace; padding: 14px; border-radius: var(--r-sm); box-shadow: var(--sh-in-sm); word-break: break-all; user-select: all; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  padding: 12px 18px; border-radius: var(--r-md); background: #0c0d25; color: #fff; font-weight: 600; z-index: 200;
  transition: opacity .2s, transform .2s; max-width: calc(100vw - 32px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { background: var(--bad); }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .blocks { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 1024px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .side {
    position: fixed; inset: 0 auto 0 0; width: 272px; transform: translateX(-105%); transition: transform .22s ease;
    box-shadow: var(--sh-out); overflow-y: auto;
  }
  .app.nav-open .side { transform: none; }
  .app.nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(12, 13, 37, .35); z-index: 25; }
  .burger { display: inline-flex; }
}
@media (max-width: 640px) {
  .main { padding: 16px 16px 40px; gap: 18px; }
  .top h1 { font-size: 22px; }
  .top-actions { width: 100%; }
  .top-actions .btn.accent { flex: 1; }
  .filters { padding: 14px; }
  .frow .field, .frow .field.date { flex: 1 1 100%; }
  .frow .fbtn { flex: 1 1 100%; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
  .kpi { padding: 14px; }
  .kpi-value { font-size: 20px; }
  .block { padding: 14px; }
  .chart { height: 280px; }
  .chart.tall { height: 360px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
