/* JPFitness â soft, bright design system v5.
   Teal sidebar, warm off-white canvas, pill buttons, animated rings & cards.
   Plain CSS, no build step needed. Inter throughout. */

/* âââ Animatable CSS custom property for ring fill âââââââââââââââââââââââ */
@property --pct {
  syntax: '<number>';
  inherits: false;
  initial-value: 0;
}

:root {
    /* Canvas */
    --bg: #F8FAFC;
    --bg-elevated: #FFFFFF;
    --card: #FFFFFF;
    --card-hover: #FFFFFF;
    --text: #0F172A;
    --text-soft: #334155;
    --muted: #64748B;
    --muted-light: #94A3B8;
    --border: #E2E8F0;
    --border-bright: #CBD5E1;

    /* Teal accent â primary brand color */
    --accent: #0D9488;
    --accent-bright: #14B8A6;
    --accent-soft: rgba(13, 148, 136, 0.10);
    --accent-text: #FFFFFF;

    /* Sidebar â deep teal */
    --sidebar-bg: #0F766E;
    --sidebar-bg2: #0D9488;
    --sidebar-text: rgba(255, 255, 255, 0.78);
    --sidebar-text-active: #FFFFFF;
    --sidebar-hover-bg: rgba(255, 255, 255, 0.12);
    --sidebar-active-bg: rgba(255, 255, 255, 0.20);
    --sidebar-border: rgba(255, 255, 255, 0.14);

    /* Semantic states */
    --good: #059669;
    --good-soft: rgba(5, 150, 105, 0.10);
    --warn: #D97706;
    --warn-soft: rgba(217, 119, 6, 0.10);
    --bad: #DC2626;
    --bad-soft: rgba(220, 38, 38, 0.10);

    /* Secondary palette â for colorful stat cards */
    --coral: #F97316;
    --coral-soft: rgba(249, 115, 22, 0.10);
    --violet: #7C3AED;
    --violet-soft: rgba(124, 58, 237, 0.10);
    --sky: #0284C7;
    --sky-soft: rgba(2, 132, 199, 0.10);
    --rose: #E11D48;
    --rose-soft: rgba(225, 29, 72, 0.10);

    --radius-sm: 12px;
    --radius: 18px;
    --radius-lg: 24px;
    --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow: 0 4px 16px rgba(15, 23, 42, 0.08), 0 2px 6px rgba(15, 23, 42, 0.04);
    --shadow-lg: 0 16px 40px rgba(15, 23, 42, 0.12);
    --ease: cubic-bezier(0.2, 0.7, 0.3, 1);
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    font-weight: 400;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; color: var(--accent-bright); }

/* =====================================================================
   App shell â teal sidebar (desktop) + topbar (mobile) + bottom nav
   ===================================================================== */

.app-shell { display: flex; min-height: 100vh; }

.sidebar {
    width: 252px;
    flex-shrink: 0;
    background: linear-gradient(160deg, var(--sidebar-bg) 0%, var(--sidebar-bg2) 100%);
    border-right: none;
    padding: 28px 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    position: sticky;
    top: 0;
    height: 100vh;
    box-shadow: 2px 0 20px rgba(13, 148, 136, 0.18);
}
.sidebar-brand {
    font-weight: 700;
    font-size: 1.15rem;
    letter-spacing: -0.01em;
    color: #FFFFFF;
    padding: 0 10px 24px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.sidebar-nav { display: flex; flex-direction: column; gap: 3px; flex: 1; }
.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 13px;
    border-radius: var(--radius-sm);
    color: var(--sidebar-text);
    font-weight: 500;
    font-size: 0.92rem;
    transition: background 0.15s var(--ease), color 0.15s var(--ease), transform 0.12s var(--ease);
}
.sidebar-link:hover {
    background: var(--sidebar-hover-bg);
    color: var(--sidebar-text-active);
    text-decoration: none;
    transform: translateX(2px);
}
.sidebar-link.active {
    background: var(--sidebar-active-bg);
    color: var(--sidebar-text-active);
    font-weight: 600;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.15);
}
.sidebar-link .icon { width: 18px; text-align: center; flex-shrink: 0; opacity: 0.9; }
.sidebar-link.active .icon { opacity: 1; }
.sidebar-foot {
    padding-top: 14px;
    border-top: 1px solid var(--sidebar-border);
    margin-top: 10px;
}
.sidebar-user { font-size: 0.82rem; color: var(--sidebar-text); padding: 6px 12px 10px; }

.topbar {
    display: none;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 10;
}
.topbar-inner {
    margin: 0 auto;
    padding: 14px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
}
.brand {
    font-weight: 700;
    font-size: 1.1rem;
    letter-spacing: -0.01em;
    color: var(--text);
}
.nav { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; font-size: 0.88rem; font-weight: 500; }
.nav a { color: var(--muted); }
.nav a:hover { color: var(--accent); text-decoration: none; }
.nav-user { color: var(--muted); font-weight: 500; }

.bottom-nav {
    display: none;
    position: fixed;
    left: 0; right: 0; bottom: 0;
    background: rgba(255, 255, 255, 0.97);
    backdrop-filter: blur(12px);
    border-top: 1px solid var(--border);
    z-index: 20;
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
}
.bottom-nav-inner { display: flex; justify-content: space-around; }
.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    color: var(--muted-light);
    font-size: 0.68rem;
    font-weight: 600;
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    flex: 1;
    max-width: 92px;
}
.bottom-nav-item .icon { font-size: 1.25rem; line-height: 1; }
.bottom-nav-item.active { color: var(--accent); }

.main-area { flex: 1; min-width: 0; }

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 40px 32px 90px;
}

.site-footer {
    text-align: center;
    color: var(--muted-light);
    font-size: 0.78rem;
    padding: 24px;
}

@media (max-width: 880px) {
    .sidebar { display: none; }
    .topbar { display: block; }
    .bottom-nav { display: block; }
    .container { padding: 24px 18px calc(90px + env(safe-area-inset-bottom)); }
}

/* =====================================================================
   Typography
   ===================================================================== */

h1 { font-size: 1.9rem; font-weight: 700; letter-spacing: -0.02em; margin: 0 0 6px; color: var(--text); }
h2 {
    font-size: 1.2rem;
    font-weight: 600;
    margin: 40px 0 16px;
    color: var(--text);
}
h3 { font-size: 1rem; font-weight: 600; margin: 0 0 10px; color: var(--text); }
.subtitle { color: var(--muted); margin: 0 0 28px; font-size: 1rem; font-weight: 400; }
.greeting { font-size: 1.7rem; font-weight: 700; letter-spacing: -0.02em; margin: 0; }
.greeting-sub { color: var(--muted); margin: 4px 0 0; font-size: 0.98rem; }
.eyebrow { color: var(--muted); font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.07em; font-weight: 600; margin: 0 0 4px; }
.section-link { font-size: 0.85rem; font-weight: 600; color: var(--accent); }

/* =====================================================================
   Cards â pop-in entry animation, softer shadow
   ===================================================================== */

@keyframes card-pop {
    from { opacity: 0; transform: translateY(12px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0)    scale(1);    }
}

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.2s var(--ease), transform 0.2s var(--ease);
    animation: card-pop 0.38s var(--ease) both;
}
.card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.card-flat { box-shadow: none; animation: none; }
.card-flat:hover { box-shadow: none; transform: none; }
.card-tight { padding: 16px 20px; }
.card-link { display: block; }
.card-link:hover { text-decoration: none; }

/* Stagger cards inside grids */
.grid > .card:nth-child(1) { animation-delay: 0.04s; }
.grid > .card:nth-child(2) { animation-delay: 0.08s; }
.grid > .card:nth-child(3) { animation-delay: 0.12s; }
.grid > .card:nth-child(4) { animation-delay: 0.16s; }
.grid > .card:nth-child(5) { animation-delay: 0.20s; }
. inside grids */
.grid > .stat-card:nth-child(1) { animation-delay: 0.04s; }
.grid > .stat-card:nth-child(2) { animation-delay: 0.08s; }
.grid > .stat-card:nth-child(3) { animation-delay: 0.12s; }
.grid > .stat-card:nth-child(4) { animation-delay: 0.16s; }
.grid > .stat-card:nth-child(5) { animation-delay: 0.20s; }
.grid > .stat-card:nth-child(6) { animation-delay: 0.24s; }
.grid > .stat-card:nth-child(7) { animation-delay: 0.28s; }

/* Colorful stat card states */
.stat-card.is-good  { background: linear-gradient(135deg, #ECFDF5, #D1FAE5); border-color: rgba(5,150,105,0.20);  }
.stat-card.is-warn  { background: linear-gradient(135deg, #FFFBEB, #FEF3C7); border-color: rgba(217,119,6,0.20);  }
.stat-card.is-bad   { background: linear-gradient(135deg, #FFF1F2, #FFE4E6); border-color: rgba(220,38,38,0.20);  }
.stat-card.is-teal  { background: linear-gradient(135deg, #F0FDFA, #CCFBF1); border-color: rgba(13,148,136,0.20); }
.stat-card.is-coral { background: linear-gradient(135deg, #FFF7ED, #FFEDD5); border-color: rgba(249,115,22,0.20); }
.stat-card.is-violet { background: linear-gradient(135deg, #F5F3FF, #EDE9FE); border-color: rgba(124,58,237,0.20); }
.stat-card.is-sky   { background: linear-gradient(135deg, #F0F9FF, #E0F2FE); border-color: rgba(2,132,199,0.20);  }

/* Hero block */
.hero-stat { padding: 28px 26px; text-align: center; }
.hero-stat .hero-label { color: var(--muted); font-size: 0.85rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }
.hero-stat .hero-value { font-size: 3.2rem; font-weight: 700; letter-spacing: -0.03em; margin: 6px 0; line-height: 1; }
.hero-stat .hero-sub { color: var(--muted); font-size: 0.95rem; }

.plan-hero {
    background: linear-gradient(135deg, #F0FDFA, #CCFBF1);
    border: 1px solid rgba(13, 148, 136, 0.20);
    border-radius: var(--radius);
    padding: 24px 26px;
    margin-bottom: 22px;
}
.plan-hero-title { margin: 0 0 6px; font-size: 1.25rem; color: var(--text); font-weight: 700; }
.plan-hero-summary { margin: 0; color: var(--muted); }

.plan-day-card { border-left: 3px solid var(--accent); }
.plan-day-title {
    color: var(--accent);
    text-transform: uppercase;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.05em;
}
.exercise-name { font-weight: 600; color: var(--text); }

/* =====================================================================
   Forms
   ===================================================================== */

form .field { margin-bottom: 16px; }
label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 0.8rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.03em; }
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="time"],
input[type="datetime-local"],
input[type="file"],
input[type="tel"],
select,
textarea {
    width: 100%;
    padding: 11px 14px;
    border: 1.5px solid var(--border-bright);
    border-radius: var(--radius-sm);
    font-size: 0.96rem;
    font-family: inherit;
    background: var(--bg-elevated);
    color: var(--text);
    transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
input::placeholder, textarea::placeholder { color: var(--muted-light); }
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}
textarea { resize: vertical; min-height: 100px; }
.hint { color: var(--muted); font-size: 0.85rem; margin-top: 4px; }

/* Range slider */
input[type="range"] {
    width: 100%;
    -webkit-appearance: none;
    height: 6px;
    border-radius: 999px;
    background: var(--border);
    outline: none;
}
input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    box-shadow: var(--shadow);
    transition: transform 0.12s var(--ease);
}
input[type="range"]::-webkit-slider-thumb:active { transform: scale(1.15); }
input[type="range"]::-moz-range-thumb {
    width: 24px; height: 24px; border-radius: 50%; background: var(--accent); border: none; cursor: pointer;
}

/* =====================================================================
   Buttons â pill-shaped, with spring press
   ===================================================================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: var(--accent);
    color: var(--accent-text);
    border: none;
    padding: 12px 24px;
    border-radius: 999px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    letter-spacing: 0.01em;
    transition: background 0.15s var(--ease), transform 0.1s var(--ease-spring), box-shadow 0.15s var(--ease);
    font-family: inherit;
    box-shadow: 0 2px 8px rgba(13, 148, 136, 0.28);
}
.btn:hover {
    background: var(--accent-bright);
    text-decoration: none;
    box-shadow: 0 4px 16px rgba(13, 148, 136, 0.38);
    transform: translateY(-1px);
}
.btn:active { transform: scale(0.96); box-shadow: none; }
.btn-secondary {
    background: var(--bg-elevated);
    color: var(--text);
    border: 1.5px solid var(--border-bright);
    box-shadow: var(--shadow-sm);
}
.btn-secondary:hover { background: var(--bg); box-shadow: var(--shadow); }
.btn-ghost { background: transparent; color: var(--text-soft); border: 1.5px solid transparent; box-shadow: none; }
.btn-ghost:hover { background: var(--bg); }
.btn-danger { background: var(--bad); color: #fff; box-shadow: 0 2px 8px rgba(220,38,38,0.28); }
.btn-danger:hover { background: #b91c1c; box-shadow: 0 4px 16px rgba(220,38,38,0.38); }
.btn-sm { padding: 8px 18px; font-size: 0.84rem; }
.btn-lg { padding: 16px 32px; font-size: 1.05rem; width: 100%; }
.btn-block { width: 100%; }
.btn-icon { width: 40px; height: 40px; padding: 0; border-radius: 50%; }

/* Steppers */
.stepper { display: flex; align-items: center; justify-content: center; gap: 18px; }
.stepper-btn {
    width: 52px; height: 52px;
    border-radius: 50%;
    border: 1.5px solid var(--border-bright);
    background: var(--bg-elevated);
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text);
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background 0.12s var(--ease), transform 0.1s var(--ease-spring), box-shadow 0.12s;
}
.stepper-btn:hover { background: var(--bg); box-shadow: var(--shadow); }
.stepper-btn:active { transform: scale(0.9); }
.stepper-value { font-size: 2.6rem; font-weight: 700; letter-spacing: -0.02em; min-width: 120px; text-align: center; }
.stepper-unit { font-size: 1rem; color: var(--muted); font-weight: 500; }

/* =====================================================================
   Alerts / pills / badges
   ===================================================================== */

.alert {
    padding: 13px 18px;
    border-radius: var(--radius-sm);
    margin-bottom: 18px;
    font-size: 0.94rem;
    border: 1px solid transparent;
}
.alert-success { background: var(--good-soft); color: #064E3B; border-color: rgba(5,150,105,0.25); }
.alert-error { background: var(--bad-soft); color: #7f1d1d; border-color: rgba(220,38,38,0.25); }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px; border-bottom: 1px solid var(--border); font-size: 0.9rem; }
th { color: var(--muted); font-weight: 600; text-transform: uppercase; font-size: 0.72rem; letter-spacing: 0.05em; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(13, 148, 136, 0.025); }

.badge, .pill {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.badge-active, .pill-good   { background: var(--good-soft);   color: var(--good);   }
.badge-paused, .pill-warn   { background: var(--warn-soft);   color: var(--warn);   }
.badge-injured, .pill-bad   { background: var(--bad-soft);    color: var(--bad);    }
.badge-open                 { background: var(--warn-soft);   color: var(--warn);   }
.badge-in_progress          { background: rgba(37,99,235,0.10); color: #2563EB;     }
.badge-resolved             { background: var(--good-soft);   color: var(--good);   }
.badge-inactive             { background: var(--bad-soft);    color: var(--bad);    }
.badge-pending              { background: var(--warn-soft);   color: var(--warn);   }
.badge-reviewed             { background: var(--good-soft);   color: var(--good);   }
.pill-neutral               { background: var(--bg);          color: var(--muted);  }

/* =====================================================================
   Progress ring â animates from 0 â --pct on load using @property
   ===================================================================== */

@keyframes ring-fill {
    from { --pct: 0; }
}

.ring {
    --pct: 0;
    --ring-color: var(--accent);
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: conic-gradient(var(--ring-color) calc(var(--pct) * 1%), var(--border) 0);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    animation: ring-fill 1.1s var(--ease) both;
    transition: background 0.4s var(--ease);
}
.ring::before {
    content: '';
    position: absolute;
    width: 84%; height: 84%;
    border-radius: 50%;
    background: var(--card);
}
.ring-inner { position: relative; text-align: center; z-index: 1; }
.ring-value { font-size: 1.5rem; font-weight: 700; letter-spacing: -0.02em; }
.ring-label { font-size: 0.68rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.ring-sm { width: 64px; height: 64px; }
.ring-sm .ring-value { font-size: 0.95rem; }

/* Linear progress bars */
.bar-track { width: 100%; height: 8px; border-radius: 999px; background: var(--border); overflow: hidden; }
.bar-fill { height: 100%; border-radius: 999px; background: var(--accent); transition: width 0.6s var(--ease); }
.bar-fill.is-warn { background: var(--warn); }
.bar-fill.is-bad  { background: var(--bad);  }
.macro-row { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.macro-row .macro-name { width: 64px; font-size: 0.82rem; font-weight: 600; color: var(--text-soft); flex-shrink: 0; }
.macro-row .macro-amt  { width: 90px; text-align: right; font-size: 0.82rem; color: var(--muted); flex-shrink: 0; }

/* =====================================================================
   Photo grids, client cards
   ===================================================================== */

.photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
}
.photo-grid img {
    width: 100%;
    aspect-ratio: 3 / 4;
    object-fit: cover;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}
.photo-caption { font-size: 0.78rem; color: var(--muted); margin-top: 4px; }

.photo-swipe {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    gap: 0;
    border-radius: var(--radius);
    -webkit-overflow-scrolling: touch;
}
.photo-swipe::-webkit-scrollbar { display: none; }
.photo-swipe-slide {
    flex: 0 0 100%;
    scroll-snap-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.photo-swipe-slide img {
    width: 100%;
    max-height: 70vh;
    object-fit: contain;
    border-radius: var(--radius);
    background: var(--bg);
}
.photo-swipe-caption { margin-top: 10px; color: var(--muted); font-size: 0.85rem; }

.client-list { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.client-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 20px;
    box-shadow: var(--shadow-sm);
    display: block;
    color: var(--text);
    transition: box-shadow 0.2s var(--ease), transform 0.2s var(--ease);
    animation: card-pop 0.38s var(--ease) both;
}
.client-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); text-decoration: none; }
.client-card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 10px; }
.client-card-name { font-weight: 700; font-size: 1.02rem; }
.client-card-meta { color: var(--muted); font-size: 0.82rem; margin-top: 2px; }
.client-card-stats { display: flex; gap: 18px; margin-top: 12px; }
.client-card-stats .stat .value { font-size: 1.15rem; }
.client-card-stats .stat .label { font-size: 0.66rem; }

.client-list a.client-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 4px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
}
.client-list a.client-row:hover { background: var(--bg); text-decoration: none; }
.client-list a.client-row:last-child { border-bottom: none; }

/* =====================================================================
   Login page
   ===================================================================== */

.login-wrap { max-width: 400px; margin: 90px auto; }
.login-wrap .brand-mark {
    text-align: center;
    font-weight: 700;
    font-size: 1.5rem;
    letter-spacing: -0.01em;
    margin-bottom: 28px;
    color: var(--text);
}
.login-wrap .brand-mark span { color: var(--accent); }

/* =====================================================================
   Layout utilities
   ===================================================================== */

.flex-between { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.flex-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.flex-col { display: flex; flex-direction: column; gap: 10px; }

.brand-logo { height: 28px; max-width: 180px; object-fit: contain; display: block; }
.login-logo { display: block; margin: 0 auto 18px; max-height: 60px; max-width: 200px; object-fit: contain; }
.login-coach-photo {
    display: block;
    margin: 0 auto 18px;
    width: 80px; height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border-bright);
}
.avatar { border-radius: 50%; object-fit: cover; }
.avatar-sm { width: 32px; height: 32px; }
.avatar-md { width: 48px; height: 48px; }
.avatar-lg { width: 72px; height: 72px; }
.avatar-fallback {
    border-radius: 50%;
    background: var(--accent-soft);
    color: var(--accent);
    display: flex; align-items: center; justify-content: center;
    font-weight: 700;
}

/* =====================================================================
   Admin feature toggles
   ===================================================================== */

.toggle-list { display: flex; flex-direction: column; gap: 4px; }
.toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 4px;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}
.toggle-row:last-child { border-bottom: none; }
.toggle-row .toggle-label { font-weight: 600; font-size: 0.9rem; }
.toggle-row select { width: auto; min-width: 140px; }

/* =====================================================================
   Tabs
   ===================================================================== */

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 24px; overflow-x: auto; }
.tab-link {
    padding: 10px 16px;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--muted);
    border-bottom: 2px solid transparent;
    white-space: nowrap;
    transition: color 0.15s var(--ease), border-color 0.15s var(--ease);
}
.tab-link:hover { color: var(--text); text-decoration: none; }
.tab-link.active { color: var(--accent); border-color: var(--accent); }

/* =====================================================================
   Chat / messaging
   ===================================================================== */

.comment-thread, .chat-thread {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 18px;
    max-height: 480px;
    overflow-y: auto;
    padding-right: 4px;
}
.comment, .chat-bubble {
    padding: 11px 15px;
    border-radius: var(--radius-sm);
    max-width: 78%;
    border: 1px solid var(--border);
    background: var(--bg-elevated);
}
.comment-admin, .chat-bubble.from-admin {
    background: var(--accent-soft);
    border-color: rgba(13, 148, 136, 0.18);
    align-self: flex-start;
}
.comment-client, .chat-bubble.from-client {
    background: var(--bg);
    align-self: flex-end;
    margin-left: auto;
}
.chat-bubble.is-pinned { border-color: var(--warn); box-shadow: 0 0 0 1px rgba(217,119,6,0.15); }
.comment-meta, .chat-meta { font-size: 0.7rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 4px; }
.comment-body, .chat-body { font-size: 0.92rem; white-space: pre-wrap; }
.chat-attachment { display: flex; align-items: center; gap: 8px; margin-top: 6px; font-size: 0.85rem; }
.chat-attachment img { max-width: 220px; border-radius: var(--radius-sm); display: block; }
.btn-link-sm {
    background: none; border: none; padding: 0; cursor: pointer;
    color: var(--muted); font-size: 0.72rem; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.03em;
}
.btn-link-sm:hover { color: var(--accent); }

/* =====================================================================
   Notifications
   ===================================================================== */

.notif-timeline { display: flex; flex-direction: column; }
.notif-item {
    display: flex;
    gap: 12px;
    padding: 14px 4px;
    border-bottom: 1px solid var(--border);
}
.notif-item:last-child { border-bottom: none; }
.notif-item.is-unread { background: var(--accent-soft); border-radius: var(--radius-sm); padding-left: 12px; padding-right: 12px; }
.notif-icon {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: var(--bg);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    font-size: 1rem;
}
.notif-title { font-weight: 600; font-size: 0.92rem; }
.notif-body  { color: var(--muted); font-size: 0.86rem; margin-top: 2px; }
.notif-time  { color: var(--muted-light); font-size: 0.74rem; margin-top: 4px; }
.notif-dot   { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex-shrink: 0; margin-top: 6px; }

/* =====================================================================
   Workout logging
   ===================================================================== */

.workout-exercise-header { text-align: center; margin-bottom: 28px; }
.workout-exercise-header h1 { font-size: 1.6rem; }
.set-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 4px;
    border-bottom: 1px solid var(--border);
}
.set-row:last-child { border-bottom: none; }
.set-row .set-num { width: 28px; font-weight: 700; color: var(--muted); }
.set-check {
    width: 36px; height: 36px;
    border-radius: 50%;
    border: 2px solid var(--border-bright);
    background: var(--bg-elevated);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.15s var(--ease), border-color 0.15s var(--ease), transform 0.15s var(--ease-spring);
    font-size: 1.1rem;
    color: transparent;
}
.set-check.is-complete { background: var(--accent); border-color: var(--accent); color: #fff; transform: scale(1.08); }
.pr-banner {
    background: linear-gradient(135deg, #fef9c3, #fde68a);
    border: 1px solid #fcd34d;
    color: #78350f;
    border-radius: var(--radius);
    padding: 16px 20px;
    text-align: center;
    font-weight: 700;
    margin-bottom: 20px;
    animation: pr-pop 0.5s var(--ease-spring);
}
@keyframes pr-pop { from { transform: scale(0.85); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.confetti-piece {
    position: fixed;
    top: -10px;
    width: 8px; height: 14px;
    opacity: 0.9;
    animation: confetti-fall 1.4s ease-out forwards;
    z-index: 999;
}
@keyframes confetti-fall {
    to { transform: translateY(100vh) rotate(540deg); opacity: 0; }
}

.empty-state { text-align: center; padding: 50px 20px; color: var(--muted); }
.empty-state .empty-icon { font-size: 2.2rem; margin-bottom: 12px; opacity: 0.6; }
.empty-state h3 { color: var(--text); }

/* =====================================================================
   Training calendar grid
   ===================================================================== */

.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-top: 16px; }
.calendar-weekday {
    text-align: center;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted);
    padding-bottom: 6px;
}
.calendar-cell {
    position: relative;
    aspect-ratio: 1 / 1;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-elevated);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
}
.calendar-cell-empty    { border: none; background: transparent; }
.calendar-cell-today    { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.calendar-cell-complete { background: var(--accent-soft); border-color: var(--accent); }
.calendar-day-num { font-size: 0.76rem; color: var(--muted); }
.calendar-cell-complete .calendar-day-num { color: var(--accent); }
.calendar-tap {
    width: 100%; height: 28px;
    border: none; background: none;
    color: var(--accent);
    font-size: 1.1rem; font-weight: 800;
    cursor: pointer;
    border-radius: 6px;
    font-family: inherit;
}
.calendar-tap:hover { background: var(--accent-soft); }

/* =====================================================================
   Before/after comparison slider
   ===================================================================== */

.compare-wrap {
    position: relative;
    width: 100%;
    max-width: 420px;
    margin: 0 auto 14px;
    aspect-ratio: 3 / 4;
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border);
    cursor: ew-resize;
    user-select: none;
}
.compare-after, .compare-before {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    object-fit: cover;
    display: block;
}
.compare-before-clip { position: absolute; top: 0; left: 0; height: 100%; width: 50%; overflow: hidden; }
.compare-handle {
    position: absolute;
    top: 0; left: 50%;
    height: 100%; width: 3px;
    background: #fff;
    box-shadow: 0 0 0 1px rgba(0,0,0,0.15);
    transform: translateX(-50%);
}
.compare-handle::after {
    content: '\21d4';
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 28px; height: 28px;
    border-radius: 50%;
    background: #fff;
    color: var(--text);
    box-shadow: var(--shadow);
    display: flex; align-items: center; justify-content: center;
    font-size: 0.9rem;
}

/* =====================================================================
   Misc / motion helpers
   ===================================================================== */

.fade-in-up { animation: fade-in-up 0.22s var(--ease) both; }
@keyframes fade-in-up {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0);   }
}

/* Chart.js canvas entry â applied via JS in dashboard */
@keyframes chart-enter {
    from { opacity: 0; transform: scaleY(0.88); transform-origin: bottom; }
    to   { opacity: 1; transform: scaleY(1); }
}
.chart-enter { animation: chart-enter 0.55s var(--ease) both; }

.skeleton {
    background: linear-gradient(90deg, var(--border) 25%, var(--bg) 37%, var(--border) 63%);
    background-size: 400% 100%;
    animation: skeleton-shimmer 1.4s ease infinite;
    border-radius: var(--radius-sm);
}
@keyframes skeleton-shimmer {
    0%   { background-position: 100% 50%; }
    100% { background-position: 0 50%; }
}

@media (max-width: 600px) {
    .topbar-inner { flex-direction: column; align-items: flex-start; }
    h1 { font-size: 1.5rem; }
    .hero-stat .hero-value { font-size: 2.4rem; }
}

/* Utility grid classes */
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) {
  .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}


/* viewer-relative chat alignment: your own messages always sit on the right */
body.role-admin .chat-bubble.from-admin,
body.role-superadmin .chat-bubble.from-admin {
    align-self: flex-end;
    margin-left: auto;
    background: var(--bg);
    border-color: var(--border);
}
body.role-admin .chat-bubble.from-client,
body.role-superadmin .chat-bubble.from-client {
    align-self: flex-start;
    margin-left: 0;
    background: var(--accent-soft);
    border-color: rgba(13, 148, 136, 0.18);
}


/* ==================== THEME 2.0 - warm modern (Chaart-inspired) ==================== */
:root {
    --bg: #F4EEE5;
    --bg-elevated: #FFFFFF;
    --card: #FFFFFF;
    --card-hover: #FFFFFF;
    --text: #2E2545;
    --text-soft: #4A4063;
    --muted: #8C84A0;
    --muted-light: #B4ADC6;
    --border: #EAE3D8;
    --border-bright: #DDD4C6;

    --accent: #6D5BD0;
    --accent-bright: #8672E8;
    --accent-soft: rgba(109, 91, 208, 0.10);

    --sidebar-bg: #FFFFFF;
    --sidebar-bg2: #FFFFFF;
    --sidebar-text: #7A7290;
    --sidebar-text-active: #FFFFFF;
    --sidebar-hover-bg: #F4EEE5;
    --sidebar-active-bg: #2E2545;
    --sidebar-border: #EFE9DE;

    --radius-sm: 14px;
    --radius: 20px;
    --radius-lg: 28px;
    --shadow-sm: 0 2px 6px rgba(46, 37, 69, 0.05);
    --shadow: 0 8px 24px rgba(46, 37, 69, 0.09);
    --shadow-lg: 0 20px 48px rgba(46, 37, 69, 0.13);
}
body {
    font-family: "Plus Jakarta Sans", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
h1, h2, h3 { letter-spacing: -0.025em; color: var(--text); }
h1 { font-weight: 800; }

/* light sidebar */
.sidebar {
    box-shadow: none;
    border-right: 1px solid var(--sidebar-border);
}
.sidebar-brand { color: var(--text); }
.sidebar-link:hover { color: var(--text); }
.sidebar-link.active { box-shadow: 0 8px 18px rgba(46, 37, 69, 0.22); }

/* pill buttons */
.btn {
    background: #2E2545;
    border-radius: 999px;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(46, 37, 69, 0.18);
}
.btn:hover { background: #3D3260; }
.btn-secondary {
    background: #FFFFFF;
    color: #2E2545;
    border: 1px solid var(--border-bright);
    box-shadow: none;
}
.btn-secondary:hover { background: #F4EEE5; color: #2E2545; }

/* softer cards */
.card { border: 1px solid var(--border); box-shadow: var(--shadow-sm); border-radius: var(--radius); }

/* cheerful stat-card tints (coach + SA dashboards) */
.stat-card.is-coral  { background: linear-gradient(150deg, #FFF1E8, #FFE3D1); border-color: #F8D8C2; }
.stat-card.is-violet { background: linear-gradient(150deg, #EFEBFF, #E2DBFB); border-color: #D8CFF5; }
.stat-card.is-sky    { background: linear-gradient(150deg, #E8F4FE, #D8ECFB); border-color: #C6E2F6; }

/* inputs */
input[type="text"], input[type="email"], input[type="password"], input[type="number"],
input[type="date"], input[type="datetime-local"], select, textarea {
    border-radius: 14px;
    border-color: var(--border-bright);
    background: #FFFFFF;
}
input:focus, select:focus, textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

/* tables breathe a little */
table th { color: var(--muted); font-weight: 600; text-transform: uppercase; font-size: .72rem; letter-spacing: .05em; }


/* ==================== MOBILE POLISH + PIZZAZZ ==================== */
/* gradient page titles */
h1 {
    background: linear-gradient(92deg, #2E2545 30%, #6D5BD0 90%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* staggered entry animations */
@keyframes riseIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.container .card, .container .stat-card, .container .client-card,
.container .qlink, .streak-card, .quick-card {
    animation: riseIn .45s var(--ease) both;
}
.grid > *:nth-child(2), .hero4 > *:nth-child(2), .qlink-grid > *:nth-child(2), .client-list > *:nth-child(2) { animation-delay: .06s; }
.grid > *:nth-child(3), .hero4 > *:nth-child(3), .qlink-grid > *:nth-child(3), .client-list > *:nth-child(3) { animation-delay: .12s; }
.grid > *:nth-child(4), .hero4 > *:nth-child(4), .qlink-grid > *:nth-child(4), .client-list > *:nth-child(4) { animation-delay: .18s; }
.grid > *:nth-child(5), .client-list > *:nth-child(5) { animation-delay: .24s; }
.grid > *:nth-child(6), .client-list > *:nth-child(6) { animation-delay: .3s; }

/* gentle card hover */
.card { transition: box-shadow .2s var(--ease), transform .2s var(--ease); }
.card:hover { box-shadow: var(--shadow); }

/* pill badges + poppier icon chips */
.badge { border-radius: 999px; font-weight: 700; letter-spacing: .02em; }
.icon-badge { box-shadow: inset 0 0 0 1px rgba(46, 37, 69, .06); }

/* respect reduced motion */
@media (prefers-reduced-motion: reduce) {
    .container .card, .container .stat-card, .container .client-card,
    .container .qlink, .streak-card, .quick-card { animation: none; }
    .flame .outer, .flame .inner { animation: none; }
}

/* ---- mobile: roomy, not crammed ---- */
@media (max-width: 880px) {
    h1 { font-size: 1.45rem; }
    h2 { margin: 26px 0 12px; }
    .container { padding: 18px 14px calc(96px + env(safe-area-inset-bottom)); }
    .grid, .grid-3, .grid-4 { grid-template-columns: 1fr 1fr !important; gap: 10px !important; }
    .grid-2 { grid-template-columns: 1fr !important; gap: 12px !important; }
    .card { padding: 16px; border-radius: 16px; }
    .stat-num { font-size: 1.6rem !important; }
    .hero4 { gap: 10px; }
    .streak-card, .quick-card { min-height: 112px; padding: 14px; }
    .card table { display: block; overflow-x: auto; }
    .qlink-grid { grid-template-columns: 1fr 1fr !important; gap: 10px; }
    .week-strip { gap: 4px; }
    .week-day { padding: 8px 2px; border-radius: 10px; }
    .week-day .wd-label { font-size: .68rem; }
    .chat-thread { max-height: 60vh; }
    .chat-bubble, .comment { max-width: 88%; }
    .flex-row, .flex-between { flex-wrap: wrap; }
    input[type="text"], input[type="email"], input[type="password"], input[type="number"],
    input[type="date"], input[type="datetime-local"], select, textarea { font-size: 16px; }
}
@media (max-width: 480px) {
    .client-card-stats { gap: 8px; }
    .stat-num { font-size: 1.45rem !important; }
    .streak-num { font-size: 1.9rem; }
}


/* readable chat guarantee - all roles, all viewers */
.chat-bubble, .comment { color: var(--text); }
.chat-meta, .comment-meta { color: var(--muted); }
.chat-body, .comment-body { color: var(--text); }
.chat-bubble a { color: var(--accent); font-weight: 600; }
.alert { color: var(--text-soft); }

/* ============================================================
   Mobile polish pass - app topbar, buttons, bottom-nav
   ============================================================ */
@media (max-width: 880px) {
    .topbar-inner { padding: 12px 18px; gap: 10px; }
    .topbar-inner .nav {
        width: 100%;
        justify-content: space-between;
        gap: 12px;
        flex-wrap: nowrap;
    }
    .nav-user {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        max-width: 40vw;
    }
    .nav a {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-width: 40px;
        min-height: 40px;
        padding: 8px 10px;
        border-radius: var(--radius-sm, 10px);
    }
    .nav a:hover { background: var(--bg); }
    .bottom-nav-inner { padding-bottom: env(safe-area-inset-bottom); }
    .bottom-nav-item { min-width: 0; }
}

@media (max-width: 380px) {
    .bottom-nav-item { font-size: 0.62rem; padding: 5px 4px; }
    .bottom-nav-item .icon { font-size: 1.1rem; }
}

/* Consistent breathing room between stacked/adjacent buttons,
   even outside a .flex-row wrapper */
.btn + .btn { margin-top: 10px; }
.flex-row > .btn + .btn,
.flex-row > .btn,
form .btn-inline + .btn-inline {
    margin-top: 0;
}
.flex-row { gap: 12px; }
@media (max-width: 480px) {
    .btn-lg, .btn-block { padding-top: 14px; padding-bottom: 14px; }
}

/* PWA / standalone polish - stop pull-to-refresh & rubber-band revealing browser chrome */
html, body {
    overscroll-behavior-y: none;
    -webkit-tap-highlight-color: transparent;
}
.app-shell, .main-area {
    overscroll-behavior-y: contain;
}
a, button, .btn { touch-action: manipulation; }
