/* =========================================================
   FlexFlow — view specific styles (Apple design language)
   ========================================================= */

/* ---------- KPI tiles ---------- */
.kpi {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  padding: 18px 20px; box-shadow: var(--shadow-sm); position: relative; overflow: hidden;
}
.kpi__top { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.kpi__ic { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; }
.kpi__ic .ic { width: 17px; height: 17px; }
.kpi__label { font-size: 12.5px; color: var(--muted); font-weight: 450; }
.kpi__value { font-size: 30px; font-weight: 600; letter-spacing: -.03em; line-height: 1.05; }
.kpi__foot { display: flex; align-items: center; gap: 7px; margin-top: 10px; font-size: 12px; letter-spacing: 0; }
.kpi__delta { display: inline-flex; align-items: center; gap: 2px; font-weight: 500; }
.kpi__delta .ic { width: 12px; height: 12px; }
.kpi__delta--up { color: var(--success); }
.kpi__delta--down { color: var(--danger); }
.kpi__spark { position: absolute; right: 0; bottom: 0; width: 88px; height: 38px; opacity: .55; }

.tone-primary { background: var(--primary-soft); color: var(--primary); }
.tone-success { background: var(--success-soft); color: var(--success); }
.tone-warn { background: var(--warn-soft); color: var(--warn); }
.tone-danger { background: var(--danger-soft); color: var(--danger); }
.tone-info { background: var(--info-soft); color: #0a9fd8; }
[data-theme="dark"] .tone-info { color: var(--info); }

/* ---------- charts ---------- */
.chart { position: relative; width: 100%; }
.chart canvas { width: 100%; display: block; }
.chart__legend { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 16px; }
.chart__legend span { display: inline-flex; align-items: center; gap: 6px; font-size: 12.2px; color: var(--muted); }
.chart__legend i { width: 8px; height: 8px; border-radius: 50%; }
.chart-tip {
  position: absolute; z-index: 5; pointer-events: none; transform: translate(-50%, -118%);
  background: var(--chrome-bg);
  -webkit-backdrop-filter: var(--vibrancy); backdrop-filter: var(--vibrancy);
  color: var(--text); padding: 7px 10px; border-radius: var(--r-sm);
  font-size: 11.8px; font-weight: 450; white-space: nowrap;
  box-shadow: var(--shadow-lg); border: 1px solid var(--border);
}
.chart-tip b { font-weight: 600; }

.donut-wrap { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.donut-wrap .chart { width: 168px; flex: none; }
.donut-legend { flex: 1; min-width: 150px; display: flex; flex-direction: column; gap: 10px; }
.donut-legend div { display: flex; align-items: center; gap: 9px; font-size: 12.8px; }
.donut-legend i { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.donut-legend b { margin-left: auto; font-variant-numeric: tabular-nums; font-weight: 500; }

/* ---------- activity feed ---------- */
.feed li { display: flex; gap: 12px; padding: 13px 0; border-bottom: 1px solid var(--border); }
.feed li:last-child { border-bottom: 0; padding-bottom: 0; }
.feed li:first-child { padding-top: 0; }
.feed__ic { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; flex: none; }
.feed__ic .ic { width: 15px; height: 15px; }
.feed__body { min-width: 0; flex: 1; }
.feed__body p { font-size: 13px; }
.feed__body strong { font-weight: 500; }
.feed__body small { color: var(--muted); font-size: 11.6px; letter-spacing: 0; }

/* ---------- progress list ---------- */
.plist { display: flex; flex-direction: column; gap: 17px; }
.plist__row > div { display: flex; justify-content: space-between; font-size: 12.8px; margin-bottom: 8px; }
.plist__row b { font-variant-numeric: tabular-nums; font-weight: 500; }
.track { height: 6px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.track > i { display: block; height: 100%; border-radius: 99px; transition: width .6s cubic-bezier(.4, 0, .2, 1); }

/* ---------- mini lists ---------- */
.mini-list li { display: flex; align-items: center; gap: 11px; padding: 11px 0; border-bottom: 1px solid var(--border); }
.mini-list li:last-child { border-bottom: 0; }
.mini-list li:first-child { padding-top: 0; }

/* ---------- plans ---------- */
.plan {
  position: relative; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 24px; display: flex; flex-direction: column;
  box-shadow: var(--shadow-sm); transition: box-shadow var(--fast), transform var(--fast);
}
.plan:hover { box-shadow: 0 8px 30px rgba(0, 0, 0, .08); transform: translateY(-2px); }
.plan.is-popular { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.plan__flag {
  position: absolute; top: 16px; right: 16px; font-size: 11px; font-weight: 500;
  letter-spacing: -.005em; background: var(--primary); color: #fff;
  padding: 3px 10px; border-radius: 99px;
}
.plan__ic { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; margin-bottom: 15px; color: #fff; }
.plan h3 { font-size: 17px; letter-spacing: -.022em; }
.plan__desc { font-size: 12.8px; color: var(--muted); margin-top: 4px; min-height: 36px; letter-spacing: -.005em; }
.plan__price { display: flex; align-items: baseline; gap: 5px; margin: 16px 0 3px; }
.plan__price b { font-size: 32px; font-weight: 600; letter-spacing: -.032em; }
.plan__price span { font-size: 12.8px; color: var(--muted); }
.plan__feats { margin: 17px 0 20px; display: flex; flex-direction: column; gap: 9px; }
.plan__feats li { display: flex; gap: 9px; align-items: flex-start; font-size: 12.8px; color: var(--text-2); }
.plan__feats .ic { width: 15px; height: 15px; color: var(--primary); margin-top: 2px; flex: none; }
.plan__stats { display: flex; gap: 8px; margin-top: auto; padding-top: 16px; border-top: 1px solid var(--border); }
.plan__stat { flex: 1; }
.plan__stat b { display: block; font-size: 16px; font-weight: 600; }
.plan__stat small { font-size: 11px; color: var(--muted); }
.plan__actions { display: flex; gap: 7px; margin-top: 16px; }
.plan__actions .btn { flex: 1; }

/* ---------- member profile ---------- */
.profile-head { display: flex; gap: 18px; align-items: flex-start; flex-wrap: wrap; }
.profile-head__meta { flex: 1; min-width: 190px; }
.profile-head__meta h2 { font-size: 21px; letter-spacing: -.024em; }
.profile-head__meta .row { margin-top: 9px; flex-wrap: wrap; gap: 8px 16px; }
.profile-head__meta .row span { display: inline-flex; align-items: center; gap: 6px; font-size: 12.6px; color: var(--muted); }
.profile-head__meta .row .ic { width: 14px; height: 14px; }

.dl { display: grid; grid-template-columns: repeat(auto-fit, minmax(148px, 1fr)); gap: 16px; }
.dl div small { display: block; font-size: 11.5px; color: var(--muted); letter-spacing: 0; font-weight: 450; margin-bottom: 2px; }
.dl div p { font-size: 13.4px; font-weight: 450; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); padding: 0 18px; overflow-x: auto; }
.tabs button {
  padding: 11px 4px; font-size: 13.2px; font-weight: 450; color: var(--muted);
  border-bottom: 2px solid transparent; margin: 0 9px -1px; white-space: nowrap; transition: var(--fast);
}
.tabs button:hover { color: var(--text); }
.tabs button.is-active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 500; }

.timeline { padding-left: 22px; position: relative; }
.timeline::before { content: ""; position: absolute; left: 4.5px; top: 6px; bottom: 6px; width: 1.5px; background: var(--border-strong); }
.timeline li { position: relative; padding: 0 0 18px; }
.timeline li:last-child { padding-bottom: 0; }
.timeline li::before {
  content: ""; position: absolute; left: -21.5px; top: 5px; width: 9px; height: 9px;
  border-radius: 50%; background: var(--primary); box-shadow: 0 0 0 3px var(--surface);
}
.timeline p { font-size: 13px; }
.timeline strong { font-weight: 500; }
.timeline small { color: var(--muted); font-size: 11.6px; letter-spacing: 0; }

/* ---------- check-in kiosk ---------- */
.kiosk {
  background: linear-gradient(135deg, #0a84ff 0%, #5856d6 55%, #af52de 100%);
  border-radius: var(--r-lg); padding: 26px; color: #fff; position: relative; overflow: hidden;
  box-shadow: 0 10px 34px rgba(0, 90, 200, .22);
}
.kiosk::after {
  content: ""; position: absolute; right: -60px; top: -70px; width: 230px; height: 230px;
  border-radius: 50%; background: rgba(255, 255, 255, .12);
}
.kiosk::before {
  content: ""; position: absolute; right: 40px; bottom: -90px; width: 160px; height: 160px;
  border-radius: 50%; background: rgba(255, 255, 255, .09);
}
.kiosk h2 { font-size: 21px; position: relative; letter-spacing: -.024em; }
.kiosk p { font-size: 13.4px; opacity: .88; margin-top: 4px; position: relative; }
.kiosk__form { display: flex; gap: 9px; margin-top: 18px; position: relative; flex-wrap: wrap; }
.kiosk__form .searchwrap { flex: 1; min-width: 210px; position: relative; }
.kiosk__form input {
  border: 1px solid rgba(255, 255, 255, .28); background: rgba(255, 255, 255, .18);
  color: #fff; -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  font-weight: 450; border-radius: var(--r-sm);
}
.kiosk__form input::placeholder { color: rgba(255, 255, 255, .72); }
.kiosk__form input:focus { background: rgba(255, 255, 255, .28); border-color: #fff; box-shadow: 0 0 0 4px rgba(255, 255, 255, .22); }
.kiosk__form .btn { background: #fff; color: #0071e3; border-color: #fff; }
.kiosk__form .btn:hover { background: rgba(255, 255, 255, .88); }
.kiosk__ac {
  position: absolute; top: calc(100% + 8px); left: 0; right: 0; z-index: 20;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r);
  box-shadow: var(--shadow-lg); padding: 5px; max-height: 260px; overflow-y: auto; color: var(--text);
}
.kiosk__stats { display: flex; gap: 28px; margin-top: 22px; position: relative; flex-wrap: wrap; }
.kiosk__stats div b { display: block; font-size: 24px; font-weight: 600; letter-spacing: -.026em; }
.kiosk__stats div small { font-size: 11.5px; opacity: .82; letter-spacing: 0; }

.heat { display: flex; flex-direction: column; gap: 5px; }
.heat__row { display: flex; gap: 5px; align-items: center; }
.heat__row > small { width: 34px; font-size: 11px; color: var(--muted); flex: none; }
.heat__cell { flex: 1; aspect-ratio: 1; border-radius: 5px; background: var(--surface-3); min-width: 9px; }
.heat__scale { display: flex; align-items: center; gap: 5px; justify-content: flex-end; font-size: 11px; color: var(--muted); margin-top: 12px; }
.heat__scale i { width: 12px; height: 12px; border-radius: 3px; }

/* ---------- trainers ---------- */
.trainer { text-align: center; padding: 24px 18px; }
.trainer .avatar { margin: 0 auto 14px; }
.trainer h3 { font-size: 15.5px; }
.trainer__role { font-size: 12.5px; color: var(--primary); font-weight: 450; margin-top: 3px; }
.trainer__rate { display: inline-flex; align-items: center; gap: 4px; margin-top: 9px; font-size: 12.5px; font-weight: 500; }
.trainer__rate .ic { width: 14px; height: 14px; color: var(--warn); }
.trainer__grid { display: flex; gap: 10px; margin: 17px 0 15px; padding: 14px 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.trainer__grid div { flex: 1; }
.trainer__grid b { display: block; font-size: 15.5px; font-weight: 600; }
.trainer__grid small { font-size: 10.5px; color: var(--muted); letter-spacing: 0; }
.tags { display: flex; flex-wrap: wrap; gap: 5px; justify-content: center; }

/* ---------- classes timetable ---------- */
.tt { display: grid; grid-template-columns: 66px repeat(7, minmax(112px, 1fr)); min-width: 900px; }
.tt__head {
  padding: 11px 8px; text-align: center; font-size: 11.5px; font-weight: 450; color: var(--muted);
  background: var(--surface-2); border-bottom: 1px solid var(--border); border-left: 1px solid var(--border);
  position: sticky; top: 0; z-index: 2;
}
.tt__head.is-today { color: var(--primary); background: var(--primary-soft); }
.tt__head b { display: block; font-size: 15px; color: var(--text); font-weight: 600; }
.tt__head.is-today b { color: var(--primary); }
.tt__time {
  font-size: 11px; color: var(--muted); text-align: right; padding: 6px 9px 0 0;
  border-bottom: 1px solid var(--border); height: 62px; font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.tt__cell { border-bottom: 1px solid var(--border); border-left: 1px solid var(--border); padding: 3px; position: relative; height: 62px; }
.tt__cell:hover { background: var(--surface-2); }
.tt__cell:hover .tt__add { opacity: 1; }
.tt__add {
  position: absolute; inset: 4px; border-radius: var(--r-sm); border: 1.5px dashed var(--border-strong);
  color: var(--muted); display: grid; place-items: center; opacity: 0; transition: var(--fast); width: auto;
}
.tt__ev {
  border-radius: var(--r-sm); padding: 5px 9px; height: 100%; overflow: hidden; cursor: pointer;
  border-left: 3px solid var(--ev, var(--primary));
  background: color-mix(in srgb, var(--ev, var(--primary)) 12%, var(--surface));
  transition: var(--fast); text-align: left; width: 100%; display: block;
}
.tt__ev:hover { filter: brightness(.98); transform: scale(1.02); }
.tt__ev strong { display: block; font-size: 11.8px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tt__ev small { font-size: 10.5px; color: var(--text-2); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: 0; }
.tt__ev .cap { font-size: 10px; color: var(--muted); }

/* ---------- equipment ---------- */
.equip { display: flex; gap: 14px; padding: 15px 20px; align-items: center; border-bottom: 1px solid var(--border); }
.equip:last-child { border-bottom: 0; }
.equip__ic { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; flex: none; }
.equip__meta { flex: 1; min-width: 0; }
.equip__meta strong { font-size: 13.6px; font-weight: 500; }
.equip__meta small { display: block; color: var(--muted); font-size: 11.8px; letter-spacing: 0; }
.equip__bar { width: 120px; flex: none; }

/* ---------- payments ---------- */
.rev-strip { display: flex; gap: 0; flex-wrap: wrap; }
.rev-strip > div { flex: 1; min-width: 150px; padding: 18px 20px; border-right: 1px solid var(--border); }
.rev-strip > div:last-child { border-right: 0; }
.rev-strip small { display: block; font-size: 11.8px; color: var(--muted); font-weight: 450; margin-bottom: 5px; letter-spacing: 0; }
.rev-strip b { font-size: 22px; font-weight: 600; letter-spacing: -.026em; }

.invoice { font-size: 13px; }
.invoice__head { display: flex; justify-content: space-between; gap: 16px; padding-bottom: 18px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.invoice__head h4 { font-size: 18px; }
.invoice__no { font-size: 12px; color: var(--muted); margin-top: 3px; }
.invoice__rows { margin: 18px 0; }
.invoice__rows div { display: flex; justify-content: space-between; padding: 9px 0; border-bottom: 1px solid var(--border); }
.invoice__rows b { font-weight: 500; }
.invoice__total { display: flex; justify-content: space-between; padding-top: 14px; font-size: 17px; font-weight: 600; letter-spacing: -.022em; }

/* ---------- settings ---------- */
.settings-grid { display: grid; grid-template-columns: 214px minmax(0, 1fr); gap: 22px; align-items: start; }
.settings-nav { display: flex; flex-direction: column; gap: 1px; position: sticky; top: calc(var(--topbar-h) + 22px); }
.settings-nav button {
  text-align: left; padding: 8px 12px; border-radius: var(--r-sm); font-size: 13.2px; font-weight: 450;
  color: var(--text); display: flex; align-items: center; gap: 10px; transition: var(--fast);
}
.settings-nav button .ic { color: var(--muted); }
.settings-nav button:hover { background: rgba(0, 0, 0, .045); }
[data-theme="dark"] .settings-nav button:hover { background: rgba(255, 255, 255, .06); }
.settings-nav button.is-active { background: var(--primary); color: #fff; font-weight: 500; }
.settings-nav button.is-active .ic { color: #fff; }

.danger-zone { border-color: color-mix(in srgb, var(--danger) 30%, var(--border)); }
.danger-row { display: flex; align-items: center; gap: 14px; padding: 16px 20px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.danger-row:last-child { border-bottom: 0; }
.danger-row div { flex: 1; min-width: 200px; }
.danger-row strong { font-size: 13.4px; font-weight: 500; }
.danger-row p { font-size: 12.5px; color: var(--muted); letter-spacing: 0; }

.swatches { display: flex; gap: 10px; flex-wrap: wrap; }
.swatch {
  width: 30px; height: 30px; border-radius: 50%; border: 0; position: relative; transition: var(--fast);
  box-shadow: inset 0 -1px 2px rgba(0, 0, 0, .12);
}
.swatch:hover { transform: scale(1.12); }
.swatch.is-active { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px currentColor; }
.swatch.is-active::after {
  content: ""; position: absolute; inset: 0; margin: auto; width: 11px; height: 6px;
  border-left: 2px solid #fff; border-bottom: 2px solid #fff; transform: rotate(-45deg) translate(1px, -2px);
}

@media (max-width: 900px) {
  .settings-grid { grid-template-columns: 1fr; }
  .settings-nav { position: static; flex-direction: row; overflow-x: auto; padding-bottom: 4px; gap: 4px; }
  .settings-nav button { white-space: nowrap; }
  .kpi__value { font-size: 26px; }
}
