/* FS Coaching UI refresh. Visual-only layer: application hooks stay intact. */

:root {
  color-scheme: dark;
  --bg: #07090c;
  --surface: #11151a;
  --surface-2: #171c22;
  --line: #2b323b;
  --text: #f6f7f8;
  --muted: #a7adb7;
  --red: #ee3038;
  --red-2: #bf2028;
  --silver: #d9dce1;
  --green: #54d38a;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.3);
  --fs-bg: #07090c;
  --fs-sidebar: #090b0f;
  --fs-panel: #11151a;
  --fs-panel-2: #171c22;
  --fs-line: #2b323b;
  --fs-line-soft: rgba(255, 255, 255, 0.09);
  --fs-text: #f6f7f8;
  --fs-muted: #a7adb7;
  --fs-red: #ee3038;
  --fs-red-bright: #ff4b51;
  --fs-green: #52cf82;
  --fs-orange: #ffab45;
  --fs-blue: #4aa3ff;
  --fs-purple: #a879ff;
  --fs-radius-sm: 8px;
  --fs-radius: 14px;
  --fs-radius-lg: 18px;
  --fs-shadow: 0 16px 42px rgba(0, 0, 0, 0.24);
  --fs-shadow-raised: 0 24px 70px rgba(0, 0, 0, 0.38);
  --fs-sidebar-width: 240px;
  --fs-control-height: 46px;
  --fs-content-max: 1560px;
}

html {
  background: var(--fs-bg);
  scrollbar-color: #444b55 #0b0e12;
  scrollbar-width: thin;
}

body {
  line-height: 1.5;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  background: radial-gradient(circle at 76% -12%, rgba(238, 48, 56, 0.075), transparent 30%), var(--fs-bg);
}

::selection { color: #fff; background: rgba(238, 48, 56, 0.78); }

button, a, input, select, textarea, [tabindex] { -webkit-tap-highlight-color: transparent; }

button, a, input, select, textarea {
  transition: border-color 150ms ease, background-color 150ms ease, color 150ms ease, box-shadow 150ms ease, opacity 150ms ease, transform 150ms ease;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid #ff6a70;
  outline-offset: 3px;
  box-shadow: 0 0 0 5px rgba(255, 74, 81, 0.18);
}

button:disabled,
input:disabled,
select:disabled,
textarea:disabled,
[aria-disabled="true"] {
  opacity: 0.52;
  cursor: not-allowed;
  box-shadow: none;
}

input,
textarea,
select,
.field input,
.field textarea,
.field select {
  min-height: var(--fs-control-height);
  padding: 11px 13px;
  border: 1px solid #343b45;
  border-radius: 10px;
  color: var(--fs-text);
  background: #0b0e12;
}

textarea, .field textarea { min-height: 110px; line-height: 1.55; }
input::placeholder, textarea::placeholder { color: #727a86; opacity: 1; }
input:hover:not(:disabled), textarea:hover:not(:disabled), select:hover:not(:disabled) { border-color: #4a535f; }

input:focus,
textarea:focus,
select:focus,
.field input:focus,
.field textarea:focus,
.field select:focus {
  border-color: #ff5c63;
  box-shadow: 0 0 0 4px rgba(238, 48, 56, 0.14);
}

.field { gap: 8px; }
.field > span, form label > span { color: #d6dae0; font-size: 13px; font-weight: 720; line-height: 1.35; }
.field-help, .field > small, form label > small, .modal-note { color: var(--fs-muted); line-height: 1.5; }
.form-error, .auth-error { color: #ff8a8f; line-height: 1.45; }

.primary-button, .ghost-button, .icon-button, .photo-upload-button { min-height: 44px; border-radius: 10px; }

.primary-button {
  border-color: rgba(255, 116, 121, 0.7);
  background: linear-gradient(135deg, #ef343c, #c91e28);
  box-shadow: 0 10px 26px rgba(226, 36, 45, 0.24);
}

.primary-button:hover:not(:disabled) {
  border-color: rgba(255, 169, 173, 0.9);
  background: linear-gradient(135deg, #ff454d, #db2731);
  box-shadow: 0 12px 30px rgba(226, 36, 45, 0.32);
  transform: translateY(-1px);
}

.ghost-button, .icon-button, .photo-upload-button {
  border-color: #39414b;
  color: #f0f2f4;
  background: #15191f;
}

.ghost-button:hover:not(:disabled),
.icon-button:hover:not(:disabled),
.photo-upload-button:hover:not(:disabled) {
  border-color: #5a6470;
  background: #1c2229;
}

.primary-button::after,
.ghost-button::after,
.nav-item::after,
.coach-tabs button::after,
.client-tabs button::after,
.client-bottom-nav button::after,
.auth-tabs button::after { display: none; }

.auth-gate {
  padding: clamp(18px, 4vw, 48px);
  background: linear-gradient(90deg, rgba(5, 7, 9, 0.96) 0%, rgba(5, 7, 9, 0.82) 48%, rgba(5, 7, 9, 0.42) 100%), url("/assets/coaching-hero-premium.png") center / cover no-repeat, var(--fs-bg);
}

.auth-card {
  width: min(100%, 540px);
  gap: 22px;
  padding: clamp(22px, 4vw, 34px);
  border-color: rgba(255, 255, 255, 0.14);
  border-radius: var(--fs-radius-lg);
  background: linear-gradient(160deg, rgba(19, 23, 29, 0.98), rgba(9, 11, 15, 0.98));
  box-shadow: var(--fs-shadow-raised);
}

.auth-card::before,
.client-app::before,
.panel::before,
.client-card::before,
.client-hero-card::before {
  animation: none;
  opacity: 0.78;
  filter: none;
  background: linear-gradient(90deg, transparent, rgba(255, 76, 83, 0.82), transparent) top / 100% 1px no-repeat;
}

.auth-brand img { width: 66px; height: 66px; border-radius: 14px; }
.auth-brand h1 { margin: 3px 0 0; font-size: clamp(26px, 5vw, 34px); letter-spacing: -0.035em; }
.auth-panel h2 { margin: 0; font-size: 22px; }
.auth-panel > p { margin: -6px 0 0; line-height: 1.55; }

.auth-tabs { gap: 6px; padding: 5px; border-color: #303741; border-radius: 12px; background: #0a0d11; }
.auth-tabs button { min-height: 46px; border-radius: 8px; }
.auth-tabs button.active { border-color: rgba(255, 83, 90, 0.68); background: #2a1418; box-shadow: inset 0 0 0 1px rgba(255, 101, 107, 0.08); }

.app-intro { background: radial-gradient(circle at 50% 45%, rgba(238, 48, 56, 0.16), transparent 25%), #050609; }
.intro-beam { display: none; }
.intro-logo-wrap { border-radius: 24px; animation: none; box-shadow: 0 24px 70px rgba(0, 0, 0, 0.5), 0 0 50px rgba(238, 48, 56, 0.18); }
.intro-logo-wrap img { border-radius: 18px; }

.panel,
.client-card,
.client-hero-card,
.metrics-grid article,
.post,
.tracker-item,
.file-item,
.program-item,
.profile-edit-card {
  border-color: var(--fs-line);
  border-radius: var(--fs-radius);
  background: linear-gradient(155deg, rgba(19, 24, 30, 0.99), rgba(13, 17, 22, 0.99));
  box-shadow: var(--fs-shadow);
}

.panel, .client-card, .client-hero-card, .profile-edit-card { padding: clamp(16px, 2vw, 22px); }
.panel-head { gap: 16px; align-items: flex-start; margin-bottom: 16px; }
.panel-head h2, .panel-head h3, .client-section-head h2, .client-section-head h3 { text-wrap: balance; }
.panel-head > div > span:not(.eyebrow), .client-section-head > p { color: var(--fs-muted); line-height: 1.55; }
.eyebrow { color: #ff6268; font-weight: 850; letter-spacing: 0.11em; }

.status-pill {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  border-color: rgba(82, 207, 130, 0.4);
  border-radius: 999px;
  color: #86e7aa;
  background: rgba(47, 147, 87, 0.15);
  white-space: nowrap;
}

body.admin-desktop .app-shell { grid-template-columns: var(--fs-sidebar-width) minmax(0, 1fr); }
body.admin-desktop .sidebar { gap: 12px; padding: 22px 16px; background: linear-gradient(180deg, #090b0f, #080a0d); }
body.admin-desktop .brand { min-height: 66px; padding: 0 8px 20px; }
body.admin-desktop .desktop-section-nav { gap: 5px; }

body.admin-desktop .desktop-section-nav button {
  min-height: 56px;
  grid-template-columns: 22px minmax(0, 1fr);
  column-gap: 11px;
  padding: 10px 11px;
  border-radius: 10px;
}

body.admin-desktop .desktop-section-nav button strong { font-size: 13px; line-height: 1.25; }
body.admin-desktop .desktop-section-nav button span { color: #9299a4; font-size: 9px; line-height: 1.35; }
body.admin-desktop .desktop-section-nav button:hover { transform: none; }
body.admin-desktop .desktop-section-nav button.active { border-color: rgba(255, 76, 83, 0.58); background: linear-gradient(90deg, rgba(238, 48, 56, 0.2), rgba(238, 48, 56, 0.06)); box-shadow: inset 3px 0 0 var(--fs-red); }

body.admin-desktop main { max-width: var(--fs-content-max); margin-inline: auto; padding: 0 clamp(20px, 2.2vw, 34px) 36px; }

body.admin-desktop .topbar {
  min-height: 92px;
  margin: 0 clamp(-34px, -2.2vw, -20px) 24px;
  padding: 18px clamp(20px, 2.2vw, 34px);
  border-bottom-color: var(--fs-line);
  background: rgba(7, 9, 12, 0.92);
}

body.admin-desktop .topbar h1 { font-size: clamp(26px, 2.2vw, 34px); line-height: 1.08; }
.topbar-copy p { color: #aeb4bd; font-size: 12px; }
body.admin-desktop .admin-kpi-grid, .admin-command-dashboard { gap: 16px; }
body.admin-desktop .admin-kpi-card { min-height: 138px; padding: 18px; }
.admin-command-dashboard .panel { padding: 18px; }
.admin-checkin-row, .admin-alert, .admin-activity-list article { border-bottom-color: var(--fs-line-soft); }
.admin-checkin-row:hover, .admin-alert:hover, .admin-activity-list article:hover { background: rgba(255, 255, 255, 0.035); }
.admin-activity-list > .tracker-item:only-child {
  width: 100%;
  min-height: 110px;
  grid-template-columns: minmax(0, 1fr);
  place-content: center;
  padding: 22px;
  overflow-wrap: normal;
  color: var(--fs-muted);
  text-align: center;
}

.coach-tabs, .client-tabs, .client-content-jump-nav { scrollbar-width: none; }
.coach-tabs::-webkit-scrollbar, .client-tabs::-webkit-scrollbar, .client-content-jump-nav::-webkit-scrollbar { display: none; }

.coach-tabs, .client-tabs {
  gap: 6px;
  padding: 5px;
  border: 1px solid var(--fs-line);
  border-radius: 12px;
  background: #0b0e12;
}

.coach-tabs button, .client-tabs button { min-height: 44px; flex: 0 0 auto; padding: 9px 14px; border: 1px solid transparent; border-radius: 8px; }
.coach-tabs button.active, .client-tabs button.active { border-color: rgba(255, 79, 86, 0.58); color: #fff; background: rgba(238, 48, 56, 0.17); box-shadow: inset 0 -2px 0 #ff535a; }
.client-content-jump-nav { gap: 8px; padding-bottom: 4px; }
.client-content-jump-nav button { min-height: 44px; flex: 0 0 auto; }

.file-grid, .progress-photo-grid, .exercise-video-grid { gap: 12px; }
.file-item, .program-item, .progress-photo-grid article, .exercise-video-grid article { overflow: hidden; }
.file-item img, .program-item img, .progress-photo-grid img, .exercise-video-grid img { object-fit: cover; }

.client-section-head { margin-bottom: 2px; }
.client-section-head h2 { margin: 4px 0 5px; font-size: clamp(26px, 4vw, 34px); letter-spacing: -0.035em; }
.client-section-head p { max-width: 72ch; margin: 0; }
body.client-desktop .client-desktop-sidebar { width: var(--fs-sidebar-width); background: linear-gradient(180deg, #090b0f, #080a0d); }
body.client-desktop .client-app { max-width: var(--fs-content-max); }

.client-dashboard-hero {
  background: linear-gradient(90deg, rgba(7, 9, 12, 0.98) 0%, rgba(7, 9, 12, 0.82) 49%, rgba(7, 9, 12, 0.18) 100%), url("/assets/coaching-hero-premium.png") center / cover no-repeat;
}

.client-hero-copy h2 { line-height: 1.03; }
.client-performance-strip article { border-color: var(--fs-line); border-radius: 12px; background: rgba(255, 255, 255, 0.025); }

dialog {
  width: min(760px, calc(100vw - 32px));
  max-width: calc(100vw - 32px);
  max-height: calc(100dvh - 32px);
  padding: 0;
  border: 1px solid #343c46;
  border-radius: var(--fs-radius-lg);
  color: var(--fs-text);
  background: #10141a;
  box-shadow: var(--fs-shadow-raised);
  overflow: auto;
  overscroll-behavior: contain;
}

dialog::backdrop { background: rgba(2, 4, 7, 0.82); backdrop-filter: blur(6px); }

.modal-card {
  width: 100%;
  max-height: none;
  gap: 18px;
  padding: clamp(18px, 3vw, 28px);
  border: 0;
  border-radius: inherit;
  background: linear-gradient(160deg, #141920, #0d1116);
  overflow: visible;
}

.modal-actions {
  position: sticky;
  z-index: 3;
  bottom: 0;
  gap: 10px;
  margin: 6px clamp(-28px, -3vw, -18px) clamp(-28px, -3vw, -18px);
  padding: 14px clamp(18px, 3vw, 28px) max(14px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--fs-line);
  background: rgba(14, 18, 23, 0.96);
  backdrop-filter: blur(12px);
}

.modal-card > .panel-head:first-child { padding-bottom: 14px; border-bottom: 1px solid var(--fs-line); }
.modal-card > .panel-head:first-child .icon-button { flex: 0 0 44px; }

.empty-state, .loading-state, .error-state {
  min-height: 110px;
  display: grid;
  place-content: center;
  padding: 22px;
  border: 1px dashed #39414c;
  border-radius: 12px;
  color: var(--fs-muted);
  background: rgba(255, 255, 255, 0.018);
  text-align: center;
}

.app-update-banner { border: 1px solid rgba(255, 84, 91, 0.46); border-radius: 14px; box-shadow: var(--fs-shadow-raised); }

@media (max-width: 1180px) and (min-width: 1000px) {
  :root { --fs-sidebar-width: 220px; }
  body.admin-desktop main { padding-inline: 20px; }
  body.admin-desktop .topbar { margin-inline: -20px; padding-inline: 20px; }
}

@media (max-width: 999px) {
  .coach-tabs, .client-tabs, .client-content-jump-nav {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scroll-snap-type: x proximity;
  }
  .coach-tabs button, .client-tabs button, .client-content-jump-nav button { scroll-snap-align: start; }
  body.client-only .client-dashboard-hero {
    min-height: 380px;
    padding-right: 18px;
    background: linear-gradient(180deg, rgba(5, 7, 10, 0.2), rgba(5, 7, 10, 0.96) 72%), url("/assets/coaching-hero-premium.png") 66% center / cover no-repeat;
  }
}

@media (max-width: 700px) {
  body.admin-only:not(.desktop-runtime) main { padding-inline: 14px; }
  body.admin-only:not(.desktop-runtime) .topbar, body.client-only .client-header { border-bottom-color: var(--fs-line); background: rgba(8, 10, 14, 0.94); backdrop-filter: blur(16px); }
  .admin-bottom-nav, .client-bottom-nav { border-color: #343b45; background: rgba(12, 15, 19, 0.96); box-shadow: 0 -12px 36px rgba(0, 0, 0, 0.35); backdrop-filter: blur(18px); }
  .admin-bottom-nav button, .client-bottom-nav button { min-height: 56px; border-radius: 10px; }
  .admin-bottom-nav button.active, .client-bottom-nav button.active { color: #fff; background: rgba(238, 48, 56, 0.16); box-shadow: inset 0 2px 0 #ff5057; }
  .panel, .client-card, .client-hero-card, .profile-edit-card { padding: 16px; border-radius: 13px; }
  .panel-head { gap: 10px; margin-bottom: 14px; }
  .file-grid, .progress-photo-grid, .exercise-video-grid { grid-template-columns: minmax(0, 1fr); }
  .client-content-section .file-item, .client-content-section .program-item { min-height: 0; }
  dialog { width: calc(100vw - 16px); max-width: calc(100vw - 16px); max-height: calc(100dvh - 16px); border-radius: 16px; }
  .modal-actions { flex-wrap: wrap; }
  .modal-actions > button { flex: 1 1 140px; }
  .auth-gate { align-items: end; padding: 16px; background-position: 66% center; }
  .auth-card { max-height: calc(100dvh - 32px); overflow: auto; }
}

@media (max-width: 420px) {
  .auth-card { gap: 17px; padding: 20px; border-radius: 16px; }
  .auth-brand img { width: 56px; height: 56px; }
  .auth-brand h1 { font-size: 27px; }
  .client-section-head h2 { font-size: 27px; }
  .client-content-jump-nav { margin-inline: -12px; padding-inline: 12px; }
}

@media (max-height: 720px) and (min-width: 621px) {
  dialog { max-height: calc(100dvh - 16px); }
  .auth-card { max-height: calc(100dvh - 24px); overflow: auto; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto; animation-duration: 0.01ms; animation-iteration-count: 1; transition-duration: 0.01ms; }
}

@media (forced-colors: active) {
  .primary-button, .ghost-button, .icon-button, .status-pill, .panel, .client-card, dialog { border: 1px solid CanvasText; }
}
