:root {
  --app-bg: #f4f7fb;
  --app-dark: #0f172a;
  --app-card: #ffffff;
  --app-muted: #64748b;
  --app-border: #e5e7eb;
  --app-primary: #2563eb;
  --app-success: #16a34a;
  --app-danger: #dc2626;
  --app-warning: #f59e0b;
  --app-purple: #7c3aed;
}

body { background: var(--app-bg); color: #172033; }
.app-shell { min-height: 100vh; }
.app-container { max-width: 1480px; }
.app-main { padding-bottom: 5.5rem !important; }
.auth-bg { min-height: 100vh; background: radial-gradient(circle at top left, #e0f2fe, transparent 35%), #f8fafc; }

.app-topbar { background: linear-gradient(135deg, #0f172a 0%, #1e293b 55%, #0f766e 100%); box-shadow: 0 10px 30px rgba(15, 23, 42, .18); }
.brand-mark { width: 32px; height: 32px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; background: rgba(255,255,255,.14); }
.navbar .nav-link { border-radius: .65rem; padding-left: .85rem !important; padding-right: .85rem !important; }
.navbar .nav-link.active, .navbar .nav-link:hover { background: rgba(255,255,255,.12); }

.card { border: 0; border-radius: 1.15rem; box-shadow: 0 12px 28px rgba(15, 23, 42, .06); }
.card-body { padding: 1.35rem; }
.small-muted { color: var(--app-muted); font-size: .875rem; }
.text-white-75 { color: rgba(255,255,255,.75); }
.section-kicker { color: var(--app-muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .055em; font-weight: 800; margin-bottom: .35rem; }

.app-hero { display: flex; justify-content: space-between; gap: 1rem; align-items: center; padding: 1.4rem; border-radius: 1.35rem; background: radial-gradient(circle at top left, rgba(45,212,191,.55), transparent 36%), linear-gradient(135deg, #0f172a 0%, #1d4ed8 55%, #0f766e 100%); color: white; box-shadow: 0 18px 45px rgba(37, 99, 235, .22); }
.app-hero h1 { font-weight: 850; }
.app-hero-actions { display: flex; gap: .75rem; flex-wrap: wrap; justify-content: flex-end; }

.metric-card { height: 100%; background: var(--app-card); border-radius: 1rem; padding: 1rem 1.1rem; box-shadow: 0 10px 24px rgba(15, 23, 42, .055); }
.metric-card span { display: block; color: var(--app-muted); font-size: .82rem; margin-bottom: .25rem; }
.metric-card strong { font-size: 1.55rem; line-height: 1.1; font-weight: 850; }
.stat-card .value { font-size: 1.6rem; font-weight: 800; }
.action-card { background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%); }

.pill { display: inline-flex; align-items: center; gap: .35rem; border-radius: 999px; padding: .38rem .65rem; font-size: .82rem; font-weight: 700; color: #334155; background: #eef2ff; }
.text-bg-purple { color: #fff; background: var(--app-purple) !important; }

.last-run-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }
.last-run-grid div { background: #f8fafc; border: 1px solid var(--app-border); border-radius: .85rem; padding: .75rem; }
.last-run-grid span { display: block; color: var(--app-muted); font-size: .78rem; }
.last-run-grid strong { font-size: .98rem; }

.week-strip { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: .55rem; }
.week-day { text-decoration: none; color: #1f2937; min-height: 108px; background: #f8fafc; border: 1px solid var(--app-border); border-radius: .95rem; padding: .7rem; display: flex; flex-direction: column; gap: .25rem; transition: .15s; }
.week-day:hover { transform: translateY(-1px); box-shadow: 0 12px 22px rgba(15,23,42,.08); }
.week-day .dow { color: var(--app-muted); font-weight: 800; font-size: .78rem; }
.week-day strong { font-size: 1.35rem; line-height: 1; }
.week-day em { font-style: normal; font-size: .8rem; line-height: 1.18; margin-top: .15rem; }
.week-day.today { outline: 3px solid rgba(37,99,235,.18); background: #eff6ff; }
.week-day.done { border-color: rgba(22, 163, 74, .35); background: #f0fdf4; }
.week-day.skipped { border-color: rgba(220, 38, 38, .32); background: #fff1f2; }

.pain-list { border-top: 1px solid var(--app-border); }
.pain-list div { display: flex; justify-content: space-between; gap: .75rem; padding: .55rem 0; border-bottom: 1px solid var(--app-border); }
.pain-list span { color: var(--app-muted); }

.calendar-grid,
.plan-calendar-grid { display: grid !important; grid-template-columns: repeat(7, minmax(0, 1fr)) !important; gap: .55rem; }
.calendar-day,
.plan-calendar-day { min-height: 118px; background: #fff; border-radius: .85rem; padding: .65rem; border: 1px solid #e5e7eb; cursor: pointer; transition: .15s; }
.calendar-day:hover,
.plan-calendar-day:hover { transform: translateY(-1px); box-shadow: 0 .4rem 1rem rgba(15,23,42,.08); }
.calendar-day.out,
.plan-calendar-day.out { opacity: .35; }
.calendar-day.done,
.plan-calendar-day.done { border-color: #22c55e; background: #f0fdf4; }
.calendar-day.skipped,
.plan-calendar-day.skipped { border-color: #ef4444; background: #fff1f2; }
.calendar-day.strength,
.plan-calendar-day.strength { box-shadow: inset 0 0 0 3px rgba(168,85,247,.12); }
.calendar-day.long,
.plan-calendar-day.long { box-shadow: inset 0 0 0 3px rgba(249,115,22,.13); }
.calendar-day.pain,
.plan-calendar-day.pain { border-color: #f97316; }
.badge-soft { background: #eef2ff; color: #3730a3; }
.map { height: 65vh; min-height: 420px; border-radius: 1rem; overflow: hidden; }

.mobile-bottom-nav { position: fixed; z-index: 1030; left: .75rem; right: .75rem; bottom: .75rem; height: 64px; display: grid; grid-template-columns: repeat(4, 1fr); background: rgba(15,23,42,.94); backdrop-filter: blur(10px); border-radius: 1.1rem; box-shadow: 0 18px 45px rgba(15, 23, 42, .28); padding: .35rem; }
.mobile-bottom-nav a { color: rgba(255,255,255,.68); text-decoration: none; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .12rem; border-radius: .85rem; font-size: .72rem; font-weight: 700; }
.mobile-bottom-nav a i { font-size: 1.15rem; }
.mobile-bottom-nav a.active { background: rgba(255,255,255,.14); color: #fff; }

@media (max-width: 991.98px) {
  .app-main { padding-left: .85rem; padding-right: .85rem; }
  .app-hero { align-items: flex-start; flex-direction: column; }
  .app-hero-actions { width: 100%; justify-content: stretch; }
  .app-hero-actions .btn { flex: 1; }
  .week-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .calendar-grid, .plan-calendar-grid { gap: .35rem !important; }
  .calendar-day, .plan-calendar-day { min-height: 92px; padding: .5rem; border-radius: .7rem; }
}

@media (max-width: 575.98px) {
  .card-body { padding: 1rem; }
  .metric-card { padding: .85rem; }
  .metric-card strong { font-size: 1.25rem; }
  .last-run-grid { grid-template-columns: 1fr; }
  .week-strip { grid-template-columns: 1fr; }
  .calendar-day, .plan-calendar-day { min-height: 82px; font-size: .86rem; }
}

/* Security minimum update */
.account-danger-zone {
  border-color: rgba(220, 53, 69, .35) !important;
  background: linear-gradient(180deg, rgba(220,53,69,.04), rgba(255,255,255,1));
}
.security-note {
  border-left: 4px solid rgba(13,110,253,.45);
  background: rgba(13,110,253,.06);
  border-radius: .75rem;
  padding: .85rem 1rem;
}

/* PWA update */
.pwa-install-card {
  position: fixed;
  right: 1rem;
  bottom: 5.4rem;
  z-index: 1040;
  max-width: 360px;
  background: rgba(15, 23, 42, .96);
  color: #fff;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 1.15rem;
  box-shadow: 0 24px 70px rgba(15,23,42,.35);
  padding: 1rem;
  display: none;
}
.pwa-install-card.show { display: block; }
.pwa-install-card .pwa-title { font-weight: 800; margin-bottom: .15rem; }
.pwa-install-card .pwa-text { color: rgba(255,255,255,.72); font-size: .88rem; margin-bottom: .8rem; }
.pwa-install-card .btn-close { filter: invert(1) grayscale(100%); opacity: .75; }
.pwa-offline-badge {
  position: fixed;
  left: 50%;
  bottom: 5.4rem;
  transform: translateX(-50%);
  z-index: 1041;
  display: none;
  background: #991b1b;
  color: #fff;
  border-radius: 999px;
  padding: .45rem .85rem;
  box-shadow: 0 14px 35px rgba(15,23,42,.25);
  font-size: .85rem;
  font-weight: 800;
}
.pwa-offline-badge.show { display: inline-flex; align-items: center; gap: .35rem; }
.pwa-standalone .mobile-bottom-nav { bottom: max(.75rem, env(safe-area-inset-bottom)); }
@media (display-mode: standalone) {
  body.app-shell { padding-top: env(safe-area-inset-top); }
}
@media (max-width: 575.98px) {
  .pwa-install-card { left: .75rem; right: .75rem; bottom: 5.2rem; max-width: none; }
  .pwa-offline-badge { bottom: 5.2rem; }
}

/* PWA install menu update */
.mobile-bottom-nav { grid-template-columns: repeat(5, 1fr); }
.mobile-bottom-nav a { font-size: .66rem; }
.mobile-bottom-nav a i { font-size: 1.05rem; }
.install-step-card {
  border: 1px solid var(--app-border);
  background: #f8fafc;
  border-radius: 1rem;
  padding: 1rem;
}
.install-step-icon {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #e0f2fe;
  color: #075985;
  font-size: 1.35rem;
  margin-bottom: .75rem;
}
@media (max-width: 575.98px) {
  .mobile-bottom-nav { left: .5rem; right: .5rem; gap: .15rem; }
  .mobile-bottom-nav a { font-size: .61rem; }
  .mobile-bottom-nav a i { font-size: 1rem; }
}

/* Paid plan / billing preparation */
.current-plan-card { min-width: 260px; }
.pricing-card { border: 1px solid rgba(15, 23, 42, .08); transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease; }
.pricing-card:hover { transform: translateY(-2px); box-shadow: 0 .75rem 1.75rem rgba(15,23,42,.08); }
.pricing-highlight { border-color: rgba(13,110,253,.35); box-shadow: 0 .5rem 1.5rem rgba(13,110,253,.10); }
.pricing-current { outline: 2px solid rgba(25,135,84,.2); }
.pricing-price { font-size: 1.55rem; font-weight: 800; letter-spacing: -.03em; color: #0f172a; }
.pricing-features li { display:flex; gap:.55rem; align-items:flex-start; margin:.55rem 0; color:#475569; }
.pricing-features i { color:#198754; margin-top:.1rem; }
.feature-table th, .feature-table td { text-align:center; }
.feature-table th:first-child, .feature-table td:first-child { text-align:left; }
.locked-feature { opacity:.62; }
.pro-lock-note { border:1px dashed rgba(13,110,253,.35); background:rgba(13,110,253,.06); border-radius:1rem; padding:.85rem 1rem; }
@media (max-width: 991.98px) { .current-plan-card { min-width: 100%; } }

/* Step2Run Stripe pricing */
.billing-period-wrap { display:flex; justify-content:center; }
.billing-period-toggle { display:inline-flex; gap:.25rem; padding:.35rem; border-radius:999px; background:#e9eef7; box-shadow: inset 0 0 0 1px rgba(15,23,42,.06); }
.billing-period-toggle a { text-decoration:none; color:#334155; padding:.65rem 1rem; border-radius:999px; font-weight:700; }
.billing-period-toggle a.active { background:#fff; color:#0d6efd; box-shadow: 0 .25rem .75rem rgba(15,23,42,.08); }
.pricing-grid .col-lg-4 { display:flex; }
.pricing-card-v2 { position:relative; width:100%; overflow:hidden; border-radius:1.35rem; }
.pricing-card-v2 .pricing-card-head { display:flex; justify-content:space-between; align-items:flex-start; gap:1rem; }
.pricing-featured { transform: translateY(-.35rem); border:2px solid rgba(13,110,253,.45) !important; box-shadow:0 1rem 2.75rem rgba(13,110,253,.16) !important; }
.pricing-featured:hover { transform: translateY(-.55rem); }
.best-badge { position:absolute; top:0; left:50%; transform:translateX(-50%); background:#0d6efd; color:#fff; font-size:.78rem; font-weight:800; letter-spacing:.02em; padding:.35rem .85rem; border-radius:0 0 .9rem .9rem; }
.pricing-featured .card-body { padding-top:2.75rem !important; }
.feature-table td:not(:first-child), .feature-table th:not(:first-child) { text-align:center; }
@media (max-width: 991.98px) {
  .pricing-featured { transform:none; }
  .pricing-featured:hover { transform:translateY(-2px); }
}

/* Detailed pain log */
.text-bg-purple{background:#7c3aed!important;color:#fff!important}
.text-bg-orange{background:#f97316!important;color:#fff!important}
.pain-entry{background:#fff;border-radius:1rem}
.pain-flag-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:.45rem .75rem}
.pain-flag{background:#f8fafc;border:1px solid #e5e7eb;border-radius:.65rem;padding:.45rem .55rem;margin:0;font-size:.9rem;display:flex;gap:.4rem;align-items:center}
.pain-flag .form-check-input{margin:0;flex:0 0 auto}
.pain-summary-list{display:flex;flex-direction:column;gap:.7rem}
.pain-summary-item{border:1px solid #e5e7eb;border-radius:.9rem;padding:.75rem;background:#fff}
.pain-summary-head{display:flex;justify-content:space-between;align-items:flex-start;gap:.75rem;margin-bottom:.4rem}
.pain-meta{display:flex;flex-wrap:wrap;gap:.35rem;color:#64748b;font-size:.875rem}
.pain-redflags{border-left:4px solid #ef4444;background:#fff1f2;border-radius:.6rem;padding:.55rem .7rem;color:#991b1b;font-size:.9rem}
.pain-quick-card{border:1px solid #e5e7eb;border-radius:1rem;background:#fff;padding:1rem}
.pain-quick-score{font-size:2rem;font-weight:800;line-height:1;color:#0f172a}
@media (max-width: 575.98px){.pain-flag-grid{grid-template-columns:1fr}.pain-summary-head{display:block}.mobile-bottom-nav a span{font-size:.64rem}}

/* Adaptive training suggestions */
.adaptive-card { border: 1px solid rgba(14,165,233,.25); }
.adaptive-list { display: grid; gap: .85rem; }
.adaptive-item { display:flex; justify-content:space-between; align-items:flex-start; gap:1rem; padding:1rem; border-radius:1rem; border:1px solid #e5e7eb; background:#fff; }
.adaptive-item.severity-critical { border-color:#ef4444; background:#fff1f2; }
.adaptive-item.severity-high { border-color:#f97316; background:#fff7ed; }
.adaptive-item.severity-medium { border-color:#0ea5e9; background:#f0f9ff; }
.adaptive-main { min-width:0; }
.adaptive-actions { display:flex; gap:.5rem; flex-wrap:wrap; justify-content:flex-end; min-width:150px; }
.adaptive-modal-box { margin:1rem 0; padding:1rem; border-radius:1rem; background:#f0f9ff; border:1px solid rgba(14,165,233,.3); }
.plan-calendar-day.adaptive .calendar-title-line::after,
.calendar-day.adaptive .calendar-title-line::after { content:' · javaslat'; color:#0284c7; font-weight:700; }
@media (max-width: 768px) { .adaptive-item { flex-direction:column; } .adaptive-actions { width:100%; justify-content:flex-start; } }

/* Step2Run setup wizard */
.wizard-step { display: none; }
.wizard-step.active { display: block; }
.choice-card { display: block; border: 1px solid var(--bs-border-color); border-radius: 1rem; padding: 1rem; cursor: pointer; background: #fff; height: 100%; transition: .15s ease; }
.choice-card:hover { transform: translateY(-1px); box-shadow: 0 .5rem 1.25rem rgba(15,23,42,.08); }
.choice-card input { margin-right: .5rem; }
.choice-card:has(input:checked) { border-color: #2563eb; background: #eff6ff; box-shadow: inset 0 0 0 2px rgba(37,99,235,.16); }
.weekday-pills { display: flex; flex-wrap: wrap; gap: .5rem; }
.weekday-pills label { cursor: pointer; }
.weekday-pills input { position: absolute; opacity: 0; pointer-events: none; }
.weekday-pills span { display: inline-flex; align-items: center; justify-content: center; min-width: 5.2rem; padding: .55rem .8rem; border-radius: 999px; border: 1px solid #cbd5e1; background: #fff; font-weight: 600; color: #334155; }
.weekday-pills input:checked + span { background: #0f172a; color: #fff; border-color: #0f172a; }
.setup-wizard .dynamic-row { border-color: #dbeafe !important; }
@media (max-width: 767.98px) { .weekday-pills span { min-width: auto; padding: .5rem .7rem; } .setup-wizard .card-body { padding: 1.25rem !important; } }


/* Coach module */
.coach-client-card { transition: transform .15s ease, box-shadow .15s ease; }
.coach-client-card:hover { transform: translateY(-2px); box-shadow: 0 1rem 2rem rgba(15,23,42,.08) !important; }
.coach-risk-ok { border-left: 5px solid #198754; }
.coach-risk-watch { border-left: 5px solid #ffc107; }
.coach-risk-danger { border-left: 5px solid #dc3545; }
.coach-note { border-left: 4px solid rgba(13,110,253,.35); background: rgba(13,110,253,.04); }
.coach-recommendation { border-left: 4px solid rgba(25,135,84,.45); background: rgba(25,135,84,.04); }
.coach-invite-token { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; word-break: break-all; }
@media (max-width: 991.98px) { .coach-sticky-actions { position: sticky; bottom: 78px; z-index: 5; } }
