/* Fitrika admin panel
   Colours come from the Fitrika app: forest-night surfaces, mint gradient actions,
   ember for "System" items. Sora for headings, Inter for all other text. */

:root {
  --night: #07130f;
  --pine: #0e2a21;
  --pine-line: #1c3b31;
  --mint: #19c98b;
  --spring: #3fe0a6;
  --mint-deep: #0f9d6b;
  --mint-wash: #e3f8ef;
  --ember: #f59a2b;
  --ember-wash: #fff1df;
  --paper: #f4f8f6;
  --card: #ffffff;
  --ink: #10201a;
  --ink-soft: #4b5f57;
  --ink-faint: #8a9b94;
  --line: #dbe6e1;
  --danger: #d6453d;
  --danger-wash: #fdeceb;

  /* sidebar */
  --side-bg: #0c1f1a;
  --side-line: #1b322b;
  --side-title: #5f8174;
  --side-text: #c8d6cf;
  --side-hover: #12302a;
  --side-active: #163a31;
  --side-badge: #1d3832;

  --font-display: "Sora", system-ui, sans-serif;     /* all headings */
  --font-text: "Inter", system-ui, sans-serif;       /* all other text */

  --radius-s: 8px;
  --radius-m: 12px;
  --radius-l: 20px;
  --sidebar-w: 256px;
  --gradient: linear-gradient(100deg, var(--mint) 0%, var(--spring) 100%);
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font-text);
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--paper);
}

h1, h2, h3 {
  font-family: var(--font-display);
  line-height: 1.15;
  margin: 0;
  letter-spacing: -0.01em;
}

button, input, select, textarea { font: inherit; color: inherit; }

[hidden] { display: none !important; }

a { color: inherit; }

:focus-visible {
  outline: 3px solid var(--spring);
  outline-offset: 2px;
}

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------- Brand mark ---------- */
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: #fff;
}
.brand-icon { flex: none; width: 32px; height: 32px; border-radius: 8px; }
.brand-word {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 22px;
  letter-spacing: 0.14em;
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.brand-tag {
  font-size: 12px;
  color: #9fc7b8;
  border: 1px solid var(--pine-line);
  border-radius: 999px;
  padding: 1px 8px;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 18px;
  border-radius: var(--radius-m);
  border: 1px solid transparent;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: transform .12s ease, box-shadow .12s ease, background-color .12s ease;
}
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .6; cursor: progress; }

.btn-primary {
  background: var(--gradient);
  color: #04291c;
  box-shadow: 0 6px 18px -8px rgba(25, 201, 139, .8);
}
.btn-primary:hover { box-shadow: 0 8px 22px -8px rgba(25, 201, 139, 1); }

.btn-ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--ink);
}
.btn-ghost:hover { background: #eaf1ee; }

.btn-icon {
  min-height: 36px;
  width: 36px;
  padding: 0;
  border-radius: var(--radius-s);
}

/* ---------- Forms ---------- */
.field { display: grid; gap: 6px; }
.field label { font-weight: 600; font-size: 14px; }
.field .hint { font-size: 13px; color: var(--ink-faint); }

.input {
  width: 100%;
  min-height: 46px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  background: #fff;
  transition: border-color .12s ease, box-shadow .12s ease;
}
.input:hover { border-color: #bfd2ca; }
.input:focus {
  outline: none;
  border-color: var(--mint);
  box-shadow: 0 0 0 4px rgba(25, 201, 139, .18);
}
.input[readonly] { background: #f3f6f5; color: var(--ink-faint); cursor: not-allowed; }
.input[readonly]:focus { box-shadow: none; border-color: var(--line); }

.form-error {
  display: none;
  padding: 10px 12px;
  border-radius: var(--radius-s);
  background: var(--danger-wash);
  color: #9b2620;
  font-size: 14px;
}
.form-error.is-visible { display: block; }

/* ======================================================================
   Login - one screen, never scrolls
   ====================================================================== */
.login-page {
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

.auth {
  height: 100vh;
  height: 100dvh;
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
}

/* The photo already carries the FITRIKA logo and name, so nothing is laid over it */
.auth-brand {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: flex-end;
  padding: 28px clamp(24px, 4vw, 48px);
  background: #0f1511;   /* same as the photo's edges, shown while it loads */
}
.auth-photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 30%;
}

/* Logo above the form - only shown when the photo is hidden (short screens) */
.auth-logo { display: none; width: 140px; height: auto; }
.auth-brand::after {
  /* soft fade into the form side */
  content: "";
  position: absolute;
  inset: 0 0 0 auto;
  width: 30%;
  background: linear-gradient(90deg, transparent, rgba(7, 19, 15, .55));
  pointer-events: none;
}

.auth-form {
  display: grid;
  place-items: center;
  padding: 32px 24px;
  background: var(--paper);
  overflow: hidden;
}
.auth-card {
  width: 100%;
  max-width: 400px;
  display: grid;
  gap: 20px;
}
.auth-card h2 { font-size: 20px; font-weight: 700; color: var(--ink-soft); }

/* Headline: words rise in one after another, then a mint bar draws under it */
.auth-title {
  font-size: clamp(30px, 3vw, 40px);
  font-weight: 800;
  line-height: 1.08;
  color: var(--ink);
}
.auth-title .line { display: block; }
.auth-title .w {
  display: inline-block;
  opacity: 0;
  transform: translateY(.45em);
  animation: word-in .55s cubic-bezier(.2, .7, .2, 1) forwards;
  animation-delay: calc(.15s + var(--i) * .08s);
}
.auth-title::after {
  content: "";
  display: block;
  width: 0;
  height: 4px;
  margin-top: 16px;
  border-radius: 4px;
  background: var(--gradient);
  animation: bar-in .6s ease-out 1s forwards;
}
@keyframes word-in { to { opacity: 1; transform: none; } }
@keyframes bar-in { to { width: 56px; } }

.password-wrap { position: relative; }
.password-wrap .input { padding-right: 76px; }
.password-toggle {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  border: 0;
  background: none;
  font-size: 13px;
  font-weight: 600;
  color: var(--mint-deep);
  padding: 8px 10px;
  border-radius: var(--radius-s);
  cursor: pointer;
}
.auth-card .btn-primary { width: 100%; min-height: 50px; font-size: 16px; }

/* Phones: photo band on top (shows the logo), form below - still one screen */
@media (max-width: 860px) {
  .auth {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 33%) minmax(0, 1fr);
  }
  .auth-brand { padding: 16px; }
  .auth-photo { object-position: center 18%; }
  .auth-brand::after {
    inset: auto 0 0 0;
    width: auto;
    height: 40%;
    background: linear-gradient(180deg, transparent, rgba(7, 19, 15, .5));
  }
  .auth-form { place-items: start center; padding: 24px 16px; }
  .auth-card { gap: 14px; }
  .auth-title { font-size: 25px; }
  .auth-title::after { margin-top: 10px; height: 3px; }
  .auth-card h2 { font-size: 17px; }
}

/* Short phones: while an error is showing, the headline makes room for it */
@media (max-width: 860px) and (max-height: 720px) {
  .auth-card:has(.form-error.is-visible) .auth-title { display: none; }
}

/* Very short screens (phone held sideways): drop the photo so the form still fits */
@media (max-width: 860px) and (max-height: 620px) {
  .auth { grid-template-rows: 1fr; }
  .auth-brand { display: none; }
  .auth-form { place-items: center; }
  .auth-title { display: none; }
  .auth-logo { display: block; width: 96px; margin: 0 auto; }
}
@media (min-width: 861px) and (max-height: 600px) {
  .auth-card { gap: 12px; }
  .auth-title { font-size: 26px; }
}

/* ======================================================================
   Panel shell
   ====================================================================== */
.shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: 100vh;
  min-height: 100dvh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 22px 14px 18px;
  background: var(--side-bg);
  border-right: 1px solid var(--side-line);
  color: var(--side-text);
}
.sidebar-logo {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 2px 10px 0;
  text-decoration: none;
}
.sidebar-logo img { width: auto; height: 54px; }

.nav {
  display: grid;
  align-content: start;
  gap: 20px;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-width: none;
}
.nav::-webkit-scrollbar { display: none; }
.nav-group { display: grid; gap: 2px; }
.nav-group-title {
  padding: 0 12px 6px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--side-title);
}
.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 42px;
  padding: 0 12px;
  border-radius: 10px;
  text-decoration: none;
  color: var(--side-text);
  font-weight: 500;
  font-size: 15px;
}
.nav-link svg { flex: none; opacity: .85; }
.nav-link:hover { background: var(--side-hover); color: #fff; }
.nav-link.is-active {
  background: var(--side-active);
  color: #fff;
  box-shadow: inset 3px 0 0 var(--spring);
}
.nav-link.is-active svg { color: var(--spring); opacity: 1; }
.nav-count {
  margin-left: auto;
  min-width: 30px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--side-badge);
  color: #b9c8c1;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 12px;
  font-weight: 600;
  text-align: center;
}
.nav-link.is-active .nav-count { background: #1f4a3d; color: #e6f4ee; }

.sidebar-foot {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 8px 0;
  border-top: 1px solid var(--side-line);
}
.avatar {
  flex: none;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: #1f4a3b;
  color: #5ee0a8;
  font-weight: 700;
  font-size: 14px;
  font-family: var(--font-display);
}
.who { min-width: 0; line-height: 1.3; }
.who strong { display: block; color: #fff; font-size: 14.5px; font-family: var(--font-display); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who span { font-size: 12.5px; color: var(--side-title); }
.logout {
  margin-left: auto;
  border: 0;
  background: none;
  color: #9fb9ae;
  padding: 8px;
  border-radius: var(--radius-s);
  cursor: pointer;
}
.logout:hover { background: var(--side-hover); color: #fff; }

.main { min-width: 0; display: flex; flex-direction: column; }

.topbar {
  display: none;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--side-bg);
  color: #fff;
}
.menu-btn {
  border: 1px solid var(--pine-line);
  background: none;
  color: #fff;
  border-radius: var(--radius-s);
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  cursor: pointer;
}

.content {
  width: 100%;
  max-width: 1180px;
  padding: 36px clamp(16px, 3vw, 40px) 56px;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}
.page-head h1 { font-size: clamp(26px, 3vw, 34px); font-weight: 750; }
.page-head p { margin: 6px 0 0; color: var(--ink-soft); max-width: 60ch; }

.scrim { display: none; }

@media (max-width: 960px) {
  .shell { grid-template-columns: 1fr; }
  .topbar { display: flex; position: sticky; top: 0; z-index: 20; }
  .sidebar {
    position: fixed;
    z-index: 40;
    left: 0;
    width: min(84vw, 300px);
    transform: translateX(-102%);
    transition: transform .22s ease;
  }
  .shell.nav-open .sidebar { transform: none; }
  .shell.nav-open .scrim {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 30;
    background: rgba(7, 19, 15, .55);
  }
  .content { padding-top: 24px; }
}

/* ======================================================================
   Dashboard
   ====================================================================== */
.overview {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1px;                         /* the 1px gaps show the background as divider lines */
  border: 1px solid var(--line);
  border-radius: var(--radius-l);
  background: var(--line);
  overflow: hidden;
}
.overview-item {
  padding: 22px 22px 20px;
  background: var(--card);
  text-decoration: none;
}
.overview-item:hover { background: #f8fbfa; }
.overview-label { color: var(--ink-soft); font-weight: 500; }
.overview-value {
  display: block;
  margin: 6px 0 2px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 34px;
  line-height: 1.1;
}
.overview-sub { font-size: 13px; color: var(--ink-faint); }

.next-up {
  margin-top: 28px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
}
.next-card {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 18px;
  border-radius: var(--radius-m);
  border: 1px dashed #c9d9d2;
  color: var(--ink-soft);
}
.next-card strong { display: block; color: var(--ink); margin-bottom: 2px; }
.next-card.is-ready { border-style: solid; background: var(--card); text-decoration: none; }
.next-card.is-ready:hover { border-color: var(--mint); }
.next-card svg { flex: none; color: var(--mint-deep); margin-top: 2px; }

.section-title { font-size: 18px; font-weight: 700; margin: 36px 0 0; }

@media (max-width: 760px) {
  .overview { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .overview-value { font-size: 28px; }
}

/* ======================================================================
   Data table (Exercise master and future lists)
   ====================================================================== */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.search {
  position: relative;
  flex: 1 1 260px;
  max-width: 380px;
}
.search svg {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ink-faint);
  pointer-events: none;
}
.search .input { padding-left: 42px; }

.segmented {
  display: inline-flex;
  padding: 4px;
  border-radius: var(--radius-m);
  background: #e6eeea;
}
.segmented button {
  border: 0;
  background: none;
  padding: 7px 14px;
  border-radius: var(--radius-s);
  font-weight: 600;
  font-size: 14px;
  color: var(--ink-soft);
  cursor: pointer;
}
.segmented button[aria-pressed="true"] {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 1px 3px rgba(16, 32, 26, .12);
}
.result-count { margin-left: auto; color: var(--ink-faint); font-size: 14px; }

.table-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-l);
  background: var(--card);
  overflow: hidden;
}
.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
  background: #f7faf9;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
}
.table td {
  padding: 14px 18px;
  border-bottom: 1px solid #edf2f0;
  vertical-align: middle;
}
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: #fafcfb; }
.table .col-actions { width: 1%; white-space: nowrap; text-align: right; }
.cell-title { font-weight: 600; }
.cell-muted { color: var(--ink-faint); }
.row-inactive .cell-title { color: var(--ink-faint); }

/* Status switch */
.switch {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border: 0;
  background: none;
  padding: 4px 0;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
}
.switch-track {
  position: relative;
  width: 40px;
  height: 22px;
  border-radius: 999px;
  background: #cdd9d4;
  transition: background-color .15s ease;
}
.switch-track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .2);
  transition: transform .15s ease;
}
.switch[aria-checked="true"] .switch-track { background: var(--mint); }
.switch[aria-checked="true"] .switch-track::after { transform: translateX(18px); }
.switch[aria-checked="true"] .switch-text { color: var(--mint-deep); }
.switch[aria-checked="false"] .switch-text { color: var(--ink-faint); }
.switch[disabled] { opacity: .5; cursor: progress; }

.empty {
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 56px 20px;
  text-align: center;
  color: var(--ink-soft);
}
.empty strong { color: var(--ink); font-size: 17px; }

.loading-row td { color: var(--ink-faint); text-align: center; padding: 40px; }

@media (max-width: 720px) {
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 4px 12px;
    padding: 14px 16px;
    border-bottom: 1px solid #edf2f0;
  }
  .table tr:last-child { border-bottom: 0; }
  .table td { padding: 0; border: 0; grid-column: 1 / -1; }
  .table tbody tr:hover td { background: none; }
  .table td[data-label]:not(.cell-title-wrap)::before {
    content: attr(data-label) ": ";
    color: var(--ink-faint);
  }
  .table .cell-title-wrap { grid-column: 1; grid-row: 1; align-self: center; }
  .table td.col-actions { grid-column: 2; grid-row: 1; width: auto; }
  .table td.cell-status { margin-top: 4px; }
  .result-count { margin-left: 0; width: 100%; }
}

/* ---------- Dialog ---------- */
.dialog {
  width: min(520px, calc(100vw - 32px));
  padding: 0;
  border: 0;
  border-radius: var(--radius-l);
  box-shadow: 0 30px 80px -20px rgba(7, 19, 15, .45);
  color: var(--ink);
}
.dialog::backdrop { background: rgba(7, 19, 15, .55); }
/* The dialog lets dropdown lists (Select2) hang outside it; the form inside scrolls instead */
.dialog { overflow: visible; max-height: none; }
.dialog form {
  display: grid;
  gap: 18px;
  padding: 26px;
  max-height: calc(100vh - 48px);
  max-height: calc(100dvh - 48px);
  overflow-y: auto;
  border-radius: inherit;
}
.dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.dialog-head h2 { font-size: 22px; font-weight: 700; }
.dialog-head p { margin: 4px 0 0; color: var(--ink-soft); font-size: 14px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 4px; }
.dialog .grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 520px) {
  .dialog .grid-2 { grid-template-columns: 1fr; }
  .dialog-actions .btn { flex: 1; }
}

/* ---------- Toast ---------- */
.toasts {
  position: fixed;
  z-index: 60;
  right: 20px;
  bottom: 20px;
  display: grid;
  gap: 10px;
}
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 240px;
  max-width: 360px;
  padding: 12px 16px;
  border-radius: var(--radius-m);
  background: var(--night);
  color: #fff;
  box-shadow: 0 14px 40px -12px rgba(7, 19, 15, .6);
  animation: toast-in .2s ease;
}
.toast::before {
  content: "";
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--spring);
}
.toast.is-error::before { background: #ff7a70; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }
@media (max-width: 520px) {
  .toasts { left: 16px; right: 16px; }
  .toast { max-width: none; }
}

/* ======================================================================
   Sidebar head + collapse (desktop)
   ====================================================================== */
.sidebar-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}
.logo-icon { display: none; width: 40px; height: 40px; border-radius: 10px; }
.collapse-btn {
  flex: none;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  margin-top: 4px;
  border: 1px solid var(--pine-line);
  border-radius: var(--radius-s);
  background: none;
  color: #9fc7b8;
  cursor: pointer;
  transition: background-color .12s ease, transform .2s ease;
}
.collapse-btn:hover { background: var(--pine); color: #fff; }

.shell { transition: grid-template-columns .22s ease; }
.nav-link { white-space: nowrap; }

@media (min-width: 961px) {
  .sidebar-collapsed { --sidebar-w: 76px; }
  .sidebar-collapsed .sidebar { padding: 16px 10px; gap: 14px; align-items: stretch; }
  .sidebar-collapsed .sidebar-head { flex-direction: column; align-items: center; gap: 10px; }
  .sidebar-collapsed .sidebar-logo { padding: 0; justify-content: center; }
  .sidebar-collapsed .logo-full,
  .sidebar-collapsed .sidebar-logo .brand-tag,
  .sidebar-collapsed .nav-text,
  .sidebar-collapsed .nav-count,
  .sidebar-collapsed .who { display: none; }
  .sidebar-collapsed .logo-icon { display: block; width: 36px; height: 36px; }
  .sidebar-collapsed .collapse-btn { width: 30px; height: 30px; margin: 0; transform: rotate(180deg); }
  .sidebar-collapsed .nav { gap: 6px; }
  .sidebar-collapsed .nav-group { justify-items: center; gap: 4px; }
  .sidebar-collapsed .nav-group-title {
    width: 28px;
    height: 1px;
    margin: 2px 0 4px;
    padding: 0;
    overflow: hidden;
    color: transparent;
    background: var(--side-line);
  }
  .sidebar-collapsed .nav-link {
    justify-content: center;
    width: 44px;
    min-height: 44px;
    padding: 0;
  }
  .sidebar-collapsed .nav-link.is-active { box-shadow: inset 0 0 0 1px #24493d; }
  .sidebar-collapsed .sidebar-foot { flex-direction: column; gap: 6px; padding: 10px 0 0; }
  .sidebar-collapsed .avatar { width: 32px; height: 32px; font-size: 14px; }
  .sidebar-collapsed .logout { margin-left: 0; }
}
@media (max-width: 960px) {
  .collapse-btn { display: none; }
}

/* ======================================================================
   Shared bits for the new pages
   ====================================================================== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
}
.badge-system { background: var(--ember-wash); color: #a85a07; }
.badge-trainer { background: var(--mint-wash); color: var(--mint-deep); }
.badge-muted { background: #edf2f0; color: var(--ink-soft); }

.tag-list { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  padding: 1px 10px;
  border: 1px solid #b7e9d4;
  border-radius: 999px;
  color: var(--mint-deep);
  font-size: 12.5px;
  background: #f3fcf8;
}

.cell-sub { display: block; font-size: 13px; color: var(--ink-faint); margin-top: 2px; }
.row-link { cursor: pointer; }

.pager {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 12px 16px;
  border-top: 1px solid #edf2f0;
  font-size: 14px;
  color: var(--ink-soft);
}
.pager[hidden] { display: none; }

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 14px;
  color: var(--ink-soft);
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
}
.back-link:hover { color: var(--ink); }

.notice {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 14px;
  margin-bottom: 18px;
  border-radius: var(--radius-m);
  background: var(--ember-wash);
  color: #7a4306;
  font-size: 14px;
}

select.input {
  appearance: none;
  padding-right: 38px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%234b5f57' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}
textarea.input { min-height: 96px; padding: 12px 14px; resize: vertical; line-height: 1.5; }

.btn-danger-ghost { background: none; border-color: #f2c9c6; color: var(--danger); }
.btn-danger-ghost:hover { background: var(--danger-wash); }
.btn-sm { min-height: 34px; padding: 0 12px; font-size: 14px; }

.dialog-wide { width: min(640px, calc(100vw - 32px)); }

/* Tag input (max 5) */
.tag-input {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  min-height: 46px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  background: #fff;
  cursor: text;
}
.tag-input:focus-within { border-color: var(--mint); box-shadow: 0 0 0 4px rgba(25, 201, 139, .18); }
.tag-input input { flex: 1 1 120px; min-width: 100px; border: 0; outline: 0; padding: 6px; background: none; }
.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 4px 3px 10px;
  border-radius: 999px;
  background: var(--mint-wash);
  color: var(--mint-deep);
  font-size: 13px;
  font-weight: 600;
}
.tag-chip button {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border: 0;
  border-radius: 50%;
  background: none;
  color: inherit;
  cursor: pointer;
}
.tag-chip button:hover { background: rgba(15, 157, 107, .15); }

/* ======================================================================
   Workout plan detail
   ====================================================================== */
.plan-card {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius-l);
  background: var(--card);
}
.plan-card-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 14px; }
.plan-card h1 { font-size: clamp(24px, 2.6vw, 30px); font-weight: 750; }
.plan-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 8px; }
.plan-desc { margin: 14px 0 0; color: var(--ink-soft); max-width: 70ch; white-space: pre-line; }
.plan-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.plan-card .tag-list { margin-top: 14px; }

.days-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 30px 0 12px; }
.days-head h2 { font-size: 20px; font-weight: 700; }

.day {
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  background: var(--card);
}
.day + .day { margin-top: 10px; }
.day-summary {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
}
.day-number {
  flex: none;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 12px;
  background: var(--night);
  color: var(--spring);
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1;
  text-align: center;
  font-size: 11px;
}
.day-number b { display: block; font-size: 18px; }
.day-title { min-width: 0; flex: 1; }
.day-title strong { display: block; font-size: 16px; }
.day-title span { font-size: 13.5px; color: var(--ink-faint); }
.day-actions { display: flex; gap: 6px; }
.day-toggle svg { transition: transform .2s ease; }
.day.is-open .day-toggle svg { transform: rotate(180deg); }
.day-body { padding: 0 16px 16px; border-top: 1px solid #edf2f0; }

.ex-view { padding: 14px 0; border-bottom: 1px dashed #dbe6e1; }
.ex-view:last-child { border-bottom: 0; padding-bottom: 0; }
.ex-view-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 12px; }
.ex-view-head strong { font-size: 15px; }
.ex-view-meta { font-size: 13.5px; color: var(--ink-soft); }
.set-table { margin-top: 8px; border-collapse: collapse; font-size: 14px; }
.set-table th { text-align: left; font-weight: 600; color: var(--ink-faint); padding: 4px 18px 4px 0; font-size: 12.5px; }
.set-table td { padding: 4px 18px 4px 0; }
.video-link { display: inline-flex; align-items: center; gap: 6px; margin-top: 8px; color: var(--mint-deep); font-weight: 600; font-size: 14px; }

/* ======================================================================
   Day plan form
   ====================================================================== */
.form-section {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-l);
  background: var(--card);
}
.form-section + .form-section { margin-top: 14px; }

.ex-block {
  border: 1px solid var(--line);
  border-radius: var(--radius-l);
  background: var(--card);
}
.ex-block + .ex-block { margin-top: 14px; }
.ex-block-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid #edf2f0;
}
.ex-block-head strong { color: var(--mint-deep); font-size: 15px; }
.ex-block-body { display: grid; gap: 16px; padding: 18px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.autofill-note { font-size: 12.5px; color: var(--mint-deep); }

.stepper { display: inline-flex; align-items: center; gap: 10px; }
.stepper button {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 9px;
  background: var(--gradient);
  color: #04291c;
  cursor: pointer;
}
.stepper button[disabled] { opacity: .4; cursor: not-allowed; }
.stepper output { min-width: 24px; text-align: center; font-weight: 700; font-size: 17px; }

.sets { display: grid; gap: 10px; }
.set-row {
  display: grid;
  grid-template-columns: 64px repeat(3, minmax(0, 1fr));
  align-items: end;
  gap: 10px;
  padding: 12px;
  border-radius: var(--radius-m);
  background: #f7faf9;
}
.set-row .set-label { align-self: center; font-weight: 700; font-size: 14px; }
.set-row .field label { font-size: 12.5px; font-weight: 600; color: var(--ink-soft); }
.set-row .input { min-height: 40px; }

.video-choice { display: grid; gap: 10px; }
.video-choice .segmented { justify-self: start; flex-wrap: wrap; }
.video-current { font-size: 14px; color: var(--ink-soft); }
.video-current a { color: var(--mint-deep); font-weight: 600; }

.add-ex {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 52px;
  margin-top: 14px;
  border: 1.5px dashed #9fdcc3;
  border-radius: var(--radius-l);
  background: #f3fcf8;
  color: var(--mint-deep);
  font-weight: 700;
  cursor: pointer;
}
.add-ex:hover { background: var(--mint-wash); }

.form-footer {
  position: sticky;
  bottom: 0;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
  padding: 14px 0;
  background: linear-gradient(180deg, rgba(244, 248, 246, 0) 0%, var(--paper) 30%);
}

@media (max-width: 640px) {
  .grid-2 { grid-template-columns: 1fr; }
  .set-row { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .set-row .set-label { grid-column: 1 / -1; }
  .form-footer .btn { flex: 1; }
  .day-summary { flex-wrap: wrap; }
  .day-actions { width: 100%; justify-content: flex-end; }
}

/* ======================================================================
   Diet plan detail
   ====================================================================== */
.week-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 28px 0 14px;
  flex-wrap: wrap;
}
.week-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
  max-width: 100%;
}
.week-tabs::-webkit-scrollbar { display: none; }
.week-tab {
  flex: none;
  padding: 8px 14px;
  border: 0;
  border-bottom: 3px solid transparent;
  background: none;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 16px;
  color: var(--ink-faint);
  cursor: pointer;
}
.week-tab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--mint); }
.week-add {
  flex: none;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  margin-left: 6px;
  border: 0;
  border-radius: 50%;
  background: var(--gradient);
  color: #04291c;
  cursor: pointer;
}

.weekdays {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-l);
  background: var(--card);
}
.weekday {
  padding: 10px 0;
  border: 0;
  border-radius: var(--radius-m);
  background: none;
  color: var(--ink-soft);
  font-weight: 600;
  cursor: pointer;
  line-height: 1.2;
}
.weekday small { display: block; font-size: 11.5px; font-weight: 500; color: var(--ink-faint); margin-top: 2px; }
.weekday:hover { background: #f1f6f4; }
.weekday[aria-selected="true"] { background: var(--gradient); color: #04291c; }
.weekday[aria-selected="true"] small { color: #0a4a33; }

.day-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin: 22px 0 12px;
}
.day-head h2 { font-size: 18px; font-weight: 700; }
.day-total { color: #c26a0a; font-weight: 700; }

.meal {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 16px;
  padding: 16px 16px 16px 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius-l);
  background: var(--card);
  overflow: hidden;
}
.meal::before {
  content: "";
  position: absolute;
  left: 0; top: 14px; bottom: 14px;
  width: 4px;
  border-radius: 0 4px 4px 0;
  background: var(--mint);
}
.meal-name { font-family: var(--font-display); font-weight: 700; font-size: 17px; }
.meal-kcal { color: var(--ink-faint); font-size: 13.5px; }
.meal-side { display: flex; align-items: flex-start; gap: 10px; grid-row: span 2; }
.meal-actions { display: flex; flex-direction: column; gap: 6px; }
.meal-items { grid-column: 1; display: grid; gap: 4px; margin-top: 8px; }
.meal-item { display: flex; justify-content: space-between; gap: 12px; font-size: 14.5px; }
.meal-item span:last-child { color: var(--ink-soft); white-space: nowrap; }
.meal-empty {
  grid-column: 1;
  margin-top: 6px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--mint-deep);
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}

.donut {
  position: relative;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  flex: none;
}
.donut::after {
  content: "";
  position: absolute;
  inset: 13px;
  border-radius: 50%;
  background: var(--card);
}
.macro-legend { display: grid; gap: 2px; font-size: 12px; color: var(--ink-soft); white-space: nowrap; }
.macro-legend i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; }
.c-protein { background: #19c98b; }
.c-carbs { background: #f59a2b; }
.c-fat { background: #8b5cf6; }

.meal-gap { display: flex; justify-content: center; padding: 8px 0; }
.meal-add {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border: 0;
  border-radius: 999px;
  background: none;
  color: var(--ink-soft);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
}
.meal-add span {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--gradient);
  color: #04291c;
}
.meal-add:hover { color: var(--ink); }

/* Meal editor */
.food-rows { display: grid; gap: 10px; }
.food-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto auto;
  align-items: center;
  gap: 8px 14px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
}
.food-row strong { display: block; font-size: 15px; }
.food-row .cell-sub { margin: 0; }
.food-row .stepper input {
  width: 58px;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  text-align: center;
  font-weight: 700;
}
.food-cal { text-align: right; font-weight: 700; white-space: nowrap; }
.food-cal small { display: block; font-weight: 500; color: var(--ink-faint); font-size: 11.5px; }
.food-macros {
  grid-column: 1 / -1;
  display: flex;
  gap: 16px;
  padding: 6px 10px;
  border-radius: 8px;
  background: #f1faf6;
  font-size: 13px;
  color: var(--ink-soft);
}
.food-macros b { color: var(--mint-deep); font-weight: 600; }
.meal-totals {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  padding: 12px 14px;
  border-radius: var(--radius-m);
  background: var(--night);
  color: #d6ece3;
  font-size: 14px;
}
.meal-totals b { color: #fff; }
.add-food { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; }

@media (max-width: 640px) {
  .weekday { padding: 8px 0; font-size: 13px; }
  .weekday small { display: none; }
  .meal { grid-template-columns: minmax(0, 1fr) auto; }
  .macro-legend { display: none; }
  .food-row { grid-template-columns: minmax(0, 1fr) auto; }
  .food-row > div:first-child { grid-column: 1; grid-row: 1; }
  .food-row [data-remove-food] { grid-column: 2; grid-row: 1; }
  .food-row .stepper { grid-column: 1; grid-row: 2; }
  .food-row .food-cal { grid-column: 2; grid-row: 2; }
  .food-row .food-macros { grid-row: 3; }
  .add-food { grid-template-columns: 1fr; }
}

/* Dashboard overview on phones: an odd last card spans both columns */
@media (max-width: 760px) {
  .overview-item:last-child:nth-child(odd) { grid-column: 1 / -1; }
}

/* ======================================================================
   Searchable dropdowns (Select2) in the panel's style
   ====================================================================== */
body .select2-container--default .select2-selection--single {
  height: 46px;
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  background: #fff;
}
body .select2-container--default .select2-selection--single .select2-selection__rendered {
  line-height: 44px;
  padding-left: 14px;
  padding-right: 36px;
  color: var(--ink);
}
body .select2-container--default .select2-selection--single .select2-selection__placeholder { color: var(--ink-faint); }
body .select2-container--default .select2-selection--single .select2-selection__arrow { height: 44px; right: 8px; }
body .select2-container--default.select2-container--focus .select2-selection--single,
body .select2-container--default.select2-container--open .select2-selection--single {
  border-color: var(--mint);
  box-shadow: 0 0 0 4px rgba(25, 201, 139, .18);
  outline: none;
}
body .select2-dropdown {
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  overflow: hidden;
  box-shadow: 0 16px 40px -16px rgba(7, 19, 15, .35);
  font-family: var(--font-text);
}
body .select2-container--open .select2-dropdown--below { margin-top: 4px; border-top: 1px solid var(--line); }
body .select2-container--open .select2-dropdown--above { margin-top: -4px; border-bottom: 1px solid var(--line); }
body .select2-search--dropdown { padding: 8px; }
body .select2-container--default .select2-search--dropdown .select2-search__field {
  min-height: 38px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-s);
  outline: none;
}
body .select2-container--default .select2-search--dropdown .select2-search__field:focus { border-color: var(--mint); }
body .select2-results__option { padding: 9px 12px; font-size: 14.5px; }
body .select2-container--default .select2-results > .select2-results__options { max-height: 240px; overscroll-behavior: contain; }
body .select2-container--open { z-index: 60; }
body .select2-container--default .select2-results__option--highlighted[aria-selected] { background: var(--mint-wash); color: var(--ink); }
body .select2-container--default .select2-results__option[aria-selected="true"] { background: #f1f6f4; font-weight: 600; }
body .select2-results__option .opt-sub { display: block; font-size: 12.5px; color: var(--ink-faint); }

/* Checkbox row */
.check { display: flex; align-items: center; gap: 10px; font-weight: 500; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--mint-deep); }

/* "New food" / "New exercise" inline form */
.label-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.link-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 4px;
  border: 0;
  background: none;
  color: var(--mint-deep);
  font-weight: 600;
  font-size: 13.5px;
  cursor: pointer;
}
.link-btn:hover { text-decoration: underline; }
.link-btn[disabled] { opacity: .5; cursor: not-allowed; text-decoration: none; }

/* Assessment form builder: a question's answer options */
.option-list { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.option-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.option-row .input { flex: 1 1 160px; min-width: 120px; }
.option-row .switch { flex: 0 0 auto; }
.option-row .option-extra-label { flex: 1 1 100%; }
.new-item {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1.5px dashed #9fdcc3;
  border-radius: var(--radius-m);
  background: #f6fdfa;
}
.new-item-head { display: flex; justify-content: space-between; align-items: center; }
.new-item-head strong { font-size: 15px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.new-item .input { min-height: 40px; }
@media (max-width: 640px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ======================================================================
   Dashboard
   ====================================================================== */
.dash-hero {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  padding: 30px 30px 74px;
  border-radius: var(--radius-l);
  color: #e6f4ee;
  background:
    radial-gradient(55% 90% at 100% 0%, rgba(63, 224, 166, .22) 0%, transparent 60%),
    radial-gradient(40% 70% at 0% 100%, rgba(25, 201, 139, .16) 0%, transparent 60%),
    var(--night);
}
.dash-hero::after {
  /* faint pulse line across the band */
  content: "";
  position: absolute;
  inset: auto 0 34px 0;
  height: 40px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 600 40' preserveAspectRatio='none'%3E%3Cpath d='M0 26H160l10-14 9 14h40l12-24 16 38 12-24h70l9-10 9 10h60l12-20 14 34 10-14h157' fill='none' stroke='%2319c98b' stroke-opacity='.35' stroke-width='1.5'/%3E%3C/svg%3E") center / 100% 100% no-repeat;
  pointer-events: none;
}
.dash-hero-text { position: relative; z-index: 1; max-width: 640px; }
.dash-date { margin: 0 0 6px; color: #8fb8a8; font-weight: 500; }
.dash-hero h1 { font-size: clamp(28px, 3.4vw, 42px); font-weight: 800; color: #fff; }
.dash-lead { margin: 10px 0 0; color: #b5d6ca; font-size: 16px; }
.dash-actions { position: relative; z-index: 1; display: flex; flex-wrap: wrap; gap: 8px; }
.dash-action {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  border: 1px solid var(--pine-line);
  border-radius: 999px;
  background: rgba(14, 42, 33, .7);
  color: #e6f4ee;
  font-weight: 600;
  font-size: 14px;
  text-decoration: none;
  transition: background-color .15s ease, border-color .15s ease;
}
.dash-action svg { color: var(--spring); }
.dash-action:hover { background: var(--pine); border-color: #2b5a4a; }

.kpi-grid {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin: -50px 18px 0;
}
.kpi {
  display: grid;
  gap: 2px;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-l);
  background: var(--card);
  box-shadow: 0 18px 40px -26px rgba(7, 19, 15, .45);
  text-decoration: none;
  transition: transform .15s ease, box-shadow .15s ease;
}
.kpi:hover { transform: translateY(-2px); box-shadow: 0 22px 44px -24px rgba(7, 19, 15, .5); }
.kpi-label { color: var(--ink-soft); font-weight: 600; }
.kpi-value {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 40px;
  line-height: 1.1;
  color: var(--ink);
}
.kpi-delta { font-size: 13px; color: var(--ink-faint); }
.kpi-delta.is-up { color: var(--mint-deep); font-weight: 600; }

.dash-grid { display: grid; gap: 16px; margin-top: 16px; }
.dash-grid:first-of-type { margin-top: 22px; }
.dash-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 22px; }
.dash-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.dash-grid-wide { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); }
.dash-stack { display: grid; gap: 16px; align-content: start; }

.dash-card {
  min-width: 0;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-l);
  background: var(--card);
}
.dash-card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.dash-card h2 { font-size: 17px; font-weight: 700; }
.dash-card-head p { margin: 3px 0 0; font-size: 13.5px; color: var(--ink-faint); }

.chart-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; color: var(--ink-soft); }
.chart-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }

.chart { position: relative; min-height: 240px; }
.chart svg { display: block; overflow: visible; }
.chart .grid-line { stroke: #edf2f0; stroke-width: 1; }
.chart .axis-base { stroke: #cfdcd6; stroke-width: 1; }
.chart .axis-text { fill: var(--ink-faint); font-size: 11.5px; font-family: var(--font-text); }
.chart .direct-label { fill: var(--ink-soft); font-size: 12px; font-weight: 600; font-family: var(--font-text); }
.chart .crosshair { stroke: #9fb3ab; stroke-width: 1; stroke-dasharray: 3 3; }
.chart-empty { margin: 0; padding: 40px 10px; text-align: center; color: var(--ink-faint); }
.chart-tip {
  position: absolute;
  z-index: 5;
  display: grid;
  gap: 3px;
  min-width: 130px;
  padding: 8px 10px;
  border-radius: var(--radius-s);
  background: var(--night);
  color: #d6ece3;
  font-size: 13px;
  pointer-events: none;
  box-shadow: 0 10px 28px -10px rgba(7, 19, 15, .6);
}
.chart-tip strong { color: #fff; }
.chart-tip b { color: #fff; margin-left: 6px; }
.chart-tip i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; }

.bar-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.bar-list-row { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; margin-bottom: 5px; }
.bar-list-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-list-row b { font-weight: 600; color: var(--ink-soft); white-space: nowrap; }
.bar-list-track { display: flex; gap: 2px; height: 8px; border-radius: 4px; background: #edf2f0; overflow: hidden; }
.bar-list-fill { display: block; height: 100%; border-radius: 4px; background: var(--mint-deep); }

.activity { list-style: none; margin: 0; padding: 0; }
.activity-item {
  position: relative;
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: baseline;
  padding: 10px 0;
}
.activity-item + .activity-item { border-top: 1px solid #f0f4f2; }
.activity-dot { width: 9px; height: 9px; border-radius: 50%; background: #cfdcd6; transform: translateY(1px); }
.activity-item.is-create .activity-dot { background: var(--mint); }
.activity-item.is-delete .activity-dot { background: #e0736b; }
.activity-item.is-update .activity-dot { background: #6a5ad4; }
.activity-text { font-size: 14.5px; }
.activity-text .badge { margin-left: 4px; font-size: 11.5px; padding: 0 8px; }
.activity time { font-size: 12.5px; color: var(--ink-faint); white-space: nowrap; }

.meter { display: block; text-decoration: none; }
.meter + .meter { margin-top: 14px; }
.meter-row { display: flex; justify-content: space-between; font-size: 14px; margin-bottom: 6px; }
.meter-row b { font-weight: 600; }
.meter-track { display: block; height: 10px; border-radius: 5px; background: #edf2f0; overflow: hidden; }
.meter-fill { display: block; height: 100%; border-radius: 5px; background: var(--gradient); }

.library { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.library a {
  display: grid;
  padding: 12px 14px;
  border-radius: var(--radius-m);
  background: #f4f8f6;
  text-decoration: none;
}
.library a:hover { background: var(--mint-wash); }
.library b { font-family: var(--font-display); font-size: 24px; font-weight: 800; }
.library span { font-size: 13px; color: var(--ink-soft); }

@media (max-width: 1180px) {
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dash-grid-3 { grid-template-columns: 1fr 1fr; }
  .dash-grid-3 > :last-child { grid-column: 1 / -1; }
}
@media (max-width: 900px) {
  .dash-grid-2, .dash-grid-wide { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .dash-hero { padding: 22px 18px 64px; }
  .kpi-grid { margin: -44px 8px 0; gap: 10px; }
  .kpi { padding: 14px; }
  .kpi-value { font-size: 30px; }
  .dash-grid-3 { grid-template-columns: 1fr; }
  .dash-card { padding: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  .kpi:hover { transform: none; }
}

/* ======================================================================
   Tables - refreshed look + pagination
   ====================================================================== */
.table-card { box-shadow: 0 1px 2px rgba(16, 32, 26, .04), 0 12px 32px -24px rgba(16, 32, 26, .25); }
.table th {
  padding: 12px 18px;
  background: #f7faf9;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #6b8077;
  white-space: nowrap;
}
.table td { padding: 13px 18px; font-size: 14.5px; }
.table tbody tr { transition: background-color .12s ease; }
.table tbody tr:hover td { background: #f6fbf9; }
.table tbody tr:nth-child(even) td { background: #fcfdfd; }
.table tbody tr:nth-child(even):hover td { background: #f6fbf9; }
.cell-title { font-weight: 600; color: var(--ink); }

.cell-person { display: flex; align-items: center; gap: 12px; }
.row-avatar {
  flex: none;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--mint-wash);
  color: var(--mint-deep);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 13px;
}
.row-inactive .row-avatar { background: #eef2f0; color: var(--ink-faint); }

.pager {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 18px;
  padding: 12px 18px;
  border-top: 1px solid #edf2f0;
  background: #fbfdfc;
  font-size: 14px;
  color: var(--ink-soft);
}
.pager-info b { color: var(--ink); font-weight: 600; }
.pager-size { display: inline-flex; align-items: center; gap: 8px; margin-left: auto; }
.pager-size select {
  min-height: 34px;
  padding: 0 28px 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%234b5f57' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 8px center;
  appearance: none;
  cursor: pointer;
}
.pager-pages { display: inline-flex; align-items: center; gap: 4px; }
.pager-pages button {
  display: grid;
  place-items: center;
  min-width: 34px;
  height: 34px;
  padding: 0 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: none;
  color: var(--ink-soft);
  font-weight: 600;
  cursor: pointer;
}
.pager-pages button:hover:not([disabled]) { background: #eef5f2; color: var(--ink); }
.pager-pages button[aria-current="page"] { background: var(--gradient); color: #04291c; }
.pager-pages button[disabled] { opacity: .35; cursor: not-allowed; }
.pager-gap { padding: 0 4px; color: var(--ink-faint); }

@media (max-width: 720px) {
  .table tbody tr:nth-child(even) td, .table tbody tr:hover td { background: none; }
  .pager { justify-content: space-between; }
  .pager-size { margin-left: 0; }
  .pager-pages { width: 100%; justify-content: center; }
}

/* ======================================================================
   Exercise videos: thumbnail + pop-up player
   ====================================================================== */
.video-thumb {
  position: relative;
  display: block;
  width: 240px;
  max-width: 100%;
  aspect-ratio: 16 / 9;
  margin-top: 10px;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: var(--radius-m);
  background: var(--night);
  cursor: pointer;
}
.video-thumb img, .video-thumb video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
  transition: transform .25s ease, opacity .2s ease;
}
.video-thumb::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(7, 19, 15, .05), rgba(7, 19, 15, .55));
}
.video-play {
  position: absolute;
  z-index: 1;
  left: 50%;
  top: 50%;
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--gradient);
  color: #04291c;
  transform: translate(-50%, -50%);
  box-shadow: 0 8px 22px -6px rgba(0, 0, 0, .5);
  transition: transform .2s ease;
}
.video-play svg { margin-left: 3px; }
.video-source {
  position: absolute;
  z-index: 1;
  left: 10px;
  bottom: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(7, 19, 15, .7);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
}
.video-thumb:hover img, .video-thumb:hover video { transform: scale(1.04); }
.video-thumb:hover .video-play { transform: translate(-50%, -50%) scale(1.08); }

.video-current { display: grid; gap: 4px; font-size: 14px; color: var(--ink-soft); }
.video-current .video-thumb { margin-top: 2px; width: 200px; }

.video-dialog { width: min(920px, calc(100vw - 32px)); background: #000; overflow: hidden; }
.video-dialog-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 10px 10px 18px;
  background: var(--night);
  color: #fff;
}
.video-dialog-title { flex: 1; min-width: 0; font-family: var(--font-display); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.video-dialog-open { color: #9fdcc3; font-size: 13px; font-weight: 600; white-space: nowrap; }
.video-dialog-head .btn-ghost { color: #fff; border-color: var(--pine-line); }
.video-dialog-head .btn-ghost:hover { background: var(--pine); }
.video-frame { aspect-ratio: 16 / 9; background: #000; }
.video-frame iframe, .video-frame video { width: 100%; height: 100%; border: 0; display: block; }

@media (max-width: 640px) {
  .video-thumb { width: 100%; }
  .video-dialog-open { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .video-thumb:hover img, .video-thumb:hover video, .video-thumb:hover .video-play { transform: none; }
  .video-thumb:hover .video-play { transform: translate(-50%, -50%); }
}

/* Workout day accordion: whole header clickable, exercises side by side */
.day-summary { cursor: pointer; border-radius: var(--radius-m); }
.day-summary:hover { background: #fafcfb; }
.day.is-open { border-color: #bfe8d6; box-shadow: 0 12px 30px -24px rgba(16, 32, 26, .35); }
.day.is-open .day-summary { border-radius: var(--radius-m) var(--radius-m) 0 0; }
.ex-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  padding-top: 16px;
}
.ex-grid .ex-view {
  padding: 16px;
  border: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  border-radius: var(--radius-m);
  background: #fbfdfc;
}
.ex-grid .ex-view:last-child { padding-bottom: 16px; }
.ex-grid .video-thumb { width: 100%; max-width: 320px; }
@media (max-width: 900px) {
  .ex-grid { grid-template-columns: 1fr; }
}

/* ======================================================================
   Loaders
   ====================================================================== */
/* Page loader: the Fitrika icon, shown while a page and its first data load
   (at least ~0.5 s, so it never just flickers). */
.page-loader {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 18px;
  background: rgba(244, 248, 246, .92);
  transition: opacity .25s ease, visibility .25s ease;
}
.page-loader.is-hidden { opacity: 0; visibility: hidden; pointer-events: none; }
.page-loader.is-busy { background: rgba(7, 19, 15, .55); backdrop-filter: blur(2px); }
.page-loader .loader-mark,
.page-loader .loader-bar,
.page-loader .loader-text { opacity: 0; animation: loader-in .2s ease forwards; }
.page-loader.is-hidden .loader-mark,
.page-loader.is-hidden .loader-bar,
.page-loader.is-hidden .loader-text { animation: none; }

.loader-mark {
  position: relative;
  width: 72px;
  height: 72px;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 18px 40px -16px rgba(7, 19, 15, .55);
}
.loader-mark img { display: block; width: 100%; height: 100%; animation: loader-breathe 1.6s ease-in-out infinite; }
.loader-mark::after {
  /* light sweeping across the runner */
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 30%, rgba(255, 255, 255, .28) 50%, transparent 70%);
  transform: translateX(-120%);
  animation: loader-sheen 1.6s ease-in-out infinite;
}
.loader-mark::before {
  /* soft mint pulse around the tile */
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: inherit;
  animation: loader-pulse 1.6s ease-out infinite;
}
.loader-bar {
  position: relative;
  width: 112px;
  height: 3px;
  border-radius: 3px;
  overflow: hidden;
  background: rgba(25, 201, 139, .18);
}
.loader-bar::after {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 40%;
  border-radius: 3px;
  background: var(--gradient);
  animation: loader-slide 1.1s ease-in-out infinite;
}
.loader-text { margin: 0; color: var(--ink-soft); font-weight: 600; font-size: 14px; }
.page-loader.is-busy .loader-text { color: #e6f4ee; }
.page-loader.is-busy .loader-bar { background: rgba(255, 255, 255, .15); }

@keyframes loader-in { to { opacity: 1; } }
@keyframes loader-breathe { 50% { transform: scale(1.06); } }
@keyframes loader-sheen { 60%, 100% { transform: translateX(120%); } }
@keyframes loader-pulse {
  0% { box-shadow: 0 0 0 0 rgba(63, 224, 166, .45); }
  100% { box-shadow: 0 0 0 18px rgba(63, 224, 166, 0); }
}
@keyframes loader-slide {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(260%); }
}

/* Thin progress line at the very top while a request runs */
.top-progress {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 210;
  width: 0;
  height: 3px;
  background: var(--gradient);
  box-shadow: 0 0 10px rgba(63, 224, 166, .7);
  opacity: 0;
  pointer-events: none;
}
.top-progress.is-active { opacity: 1; width: 80%; transition: width 6s cubic-bezier(.1, .7, .2, 1); }
.top-progress.is-done { width: 100%; opacity: 0; transition: width .2s ease, opacity .3s ease .15s; }

/* Busy button: label hidden, spinner in its place, no double clicks */
.btn.is-loading, button.is-loading {
  position: relative;
  color: transparent !important;
  pointer-events: none;
}
.btn.is-loading svg, button.is-loading svg { visibility: hidden; }
.btn.is-loading::after, button.is-loading::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 18px;
  height: 18px;
  margin: -9px 0 0 -9px;
  border-radius: 50%;
  border: 2.5px solid rgba(16, 32, 26, .2);
  border-top-color: var(--ink);
  animation: spin .7s linear infinite;
}
.btn.is-loading[disabled] { opacity: 1; cursor: progress; }   /* busy, not unavailable */
.btn-primary.is-loading::after { border-color: rgba(4, 41, 28, .25); border-top-color: #04291c; }
.btn-danger-ghost.is-loading::after { border-color: rgba(214, 69, 61, .25); border-top-color: var(--danger); }
@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  .loader-mark img, .loader-mark::after, .loader-mark::before, .loader-bar::after { animation: none; }
  .btn.is-loading::after, button.is-loading::after { animation-duration: 1.5s; }
}

/* ======================================================================
   Prospects & follow-ups
   ====================================================================== */
.seg-count {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 20px;
  margin-left: 6px;
  padding: 0 6px;
  border-radius: 999px;
  background: rgba(16, 32, 26, .07);
  font-size: 12px;
}
.segmented button[aria-pressed="true"] .seg-count { background: var(--mint-wash); color: var(--mint-deep); }

.mini-progress { display: inline-flex; align-items: center; gap: 8px; }
.mini-progress-track { width: 70px; height: 6px; border-radius: 3px; background: #e6eeea; overflow: hidden; }
.mini-progress-track span { display: block; height: 100%; border-radius: 3px; background: var(--gradient); }
.mini-progress b { font-size: 13px; font-weight: 600; color: var(--ink-soft); }

.prospect-layout {
  display: grid;
  grid-template-columns: minmax(280px, 380px) minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}
.prospect-card { position: sticky; top: 20px; }
.prospect-head { display: flex; align-items: center; gap: 14px; }
.prospect-head h1 { font-size: 22px; }
.prospect-avatar {
  flex: none;
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: var(--gradient);
  color: #04291c;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 19px;
}
.contact-list { list-style: none; margin: 16px 0 0; padding: 0; display: grid; gap: 8px; }
.contact-list li { display: flex; align-items: center; gap: 10px; color: var(--ink-soft); }
.contact-list svg { color: var(--mint-deep); flex: none; }
.contact-list a { color: var(--ink); text-decoration: none; overflow-wrap: anywhere; }
.contact-list a:hover { text-decoration: underline; }
.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 16px 0 0; padding: 14px 0 0; border-top: 1px solid #edf2f0; }
.facts dt, .facts-label { font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-faint); }
.facts dd { margin: 2px 0 0; font-weight: 600; }
.status-switch { display: flex; margin-top: 6px; }
.status-switch button { flex: 1; }

.followup-progress { color: var(--mint-deep); font-weight: 600; }
.timeline { list-style: none; margin: 0; padding: 0 0 0 34px; position: relative; display: grid; gap: 14px; }
.timeline::before {
  content: "";
  position: absolute;
  left: 11px;
  top: 14px;
  bottom: 14px;
  width: 2px;
  background: #dfe8e4;
}
.step { position: relative; }
.step-dot {
  position: absolute;
  left: -34px;
  top: 22px;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #dfe8e4;
  border: 4px solid var(--paper);
  color: #04291c;
}
.step.is-current .step-dot { background: #fff; box-shadow: inset 0 0 0 2px var(--mint); }
.step.is-done .step-dot { background: var(--mint); }
.step-card {
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-l);
  background: var(--card);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.step.is-current .step-card { border-color: #9fdcc3; box-shadow: 0 10px 28px -22px rgba(16, 32, 26, .4); }
.step.is-done .step-card { border-color: #9fdcc3; background: #f3fcf8; }
.step-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.step-label { font-size: 11.5px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-faint); }
.step.is-done .step-label, .step.is-current .step-label { color: var(--mint-deep); }
.step h3 { margin: 2px 0 0; font-size: 17px; font-weight: 700; }
.step:not(.is-done):not(.is-current) h3 { color: var(--ink-soft); }
.step-desc { margin: 4px 0 0; color: var(--ink-soft); font-size: 14px; }
.step-toggle {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--ink-soft);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
}
.step-toggle:hover { border-color: var(--mint); color: var(--ink); }
.step-toggle[aria-pressed="true"] { background: var(--gradient); border-color: transparent; color: #04291c; }
.step-items { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 6px; }
.step-item { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: 14.5px; }
.step-item input { width: 17px; height: 17px; accent-color: var(--mint-deep); cursor: pointer; }
.step-item input:checked + span { color: var(--ink-faint); text-decoration: line-through; text-decoration-color: rgba(15, 157, 107, .5); }
.step-note { margin-top: 12px; min-height: 0; font-size: 14px; background: rgba(255, 255, 255, .7); transition: border-color .2s ease, box-shadow .2s ease; }
.step-note.is-saved { border-color: var(--mint); box-shadow: 0 0 0 3px rgba(25, 201, 139, .15); }
.step-when { display: block; margin-top: 8px; font-size: 12.5px; color: var(--mint-deep); }

.checklist-preview { display: flex; flex-wrap: wrap; gap: 4px 6px; }
.checklist-preview span:not(.cell-muted) { padding: 1px 8px; border-radius: 999px; background: #eef4f1; font-size: 12.5px; color: var(--ink-soft); }
.order-pill {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: var(--night);
  color: var(--spring);
  font-family: var(--font-display);
  font-weight: 700;
}

@media (max-width: 960px) {
  .prospect-layout { grid-template-columns: 1fr; }
  .prospect-card { position: static; }
}
@media (max-width: 520px) {
  .step-top { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-delay: 0s !important;
    transition-duration: .01ms !important;
  }
}

/* ---------- Members > assessments (status, answers, fill on behalf) ---------- */
a.assess-link { text-decoration: none; }
a.assess-link:hover b { color: var(--mint-deep); text-decoration: underline; }
.assess-summary { align-self: center; }
.assess-summary .mini-progress-track { width: 120px; }
.assess-list { display: grid; gap: 12px; }
.assess-card { border: 1px solid var(--line); border-radius: var(--radius-l); background: var(--card); }
.assess-card.is-filled { border-color: #bfe9d6; }
.assess-head { display: flex; align-items: center; gap: 14px; padding: 16px 18px; }
.assess-title { display: grid; gap: 3px; flex: 1; min-width: 0; }
.assess-title strong { font-family: var(--font-display); font-size: 16px; }
.assess-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 4px; font-size: 13px; }
.assess-actions { display: flex; align-items: center; gap: 6px; }
.assess-card.is-open .day-toggle svg { transform: rotate(180deg); }
.assess-body { padding: 0 18px 18px; border-top: 1px solid var(--line); }
.answer-list { display: grid; gap: 12px; margin: 16px 0 0; padding-left: 22px; }
.answer-list li { display: grid; gap: 4px; }
.answer-q { color: var(--ink-soft); }
.answer-a { justify-self: start; padding: 3px 10px; border-radius: 999px; background: var(--mint-wash); color: var(--mint-deep); font-weight: 600; font-size: 14px; }
.answer-a.is-blank { background: #eef2f0; color: var(--ink-faint); font-weight: 500; }
.answer-extra { padding: 8px 12px; border-left: 3px solid var(--mint); background: #f6faf8; border-radius: 0 var(--radius-s) var(--radius-s) 0; }

.fill-card { padding: 18px; border: 1px solid var(--line); border-radius: var(--radius-l); background: var(--card); }
.fill-card + .fill-card { margin-top: 12px; }
.fill-q { display: flex; gap: 10px; margin: 0; font-weight: 600; line-height: 1.45; }
.fill-num { flex: 0 0 auto; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; background: var(--mint-wash); color: var(--mint-deep); font-size: 13px; }
.fill-q .req { color: var(--danger); }
.fill-help { margin: 6px 0 0 36px; color: var(--ink-faint); font-size: 13.5px; }
.choice-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-top: 14px; }
.choice { min-height: 44px; padding: 10px 14px; border: 1px solid var(--line); border-radius: var(--radius-m); background: #fff; color: var(--ink-soft); font-weight: 600; text-align: center; cursor: pointer; transition: border-color .12s, background .12s; }
.choice:hover { border-color: #bfd2ca; }
.choice[aria-checked="true"] { border-color: var(--mint); background: var(--mint-wash); color: var(--mint-deep); }
.choice[aria-checked="true"]::before { content: "\2713  "; }
.fill-extra { margin-top: 12px; border-color: var(--mint); }
@media (max-width: 640px) {
  .assess-head { flex-wrap: wrap; }
  .assess-actions { width: 100%; justify-content: flex-end; }
}

/* People list: trainer rating */
.rating-cell { display: inline-flex; align-items: center; gap: 5px; }
.rating-star { color: var(--ember); font-size: 15px; }

/* ======================================================================
   Responsive tables (every .table-card)
   - wide: normal table
   - medium: short columns stay on one line, text columns wrap, and if it still
     doesn't fit the table scrolls sideways inside its card (nothing gets cut off)
   - narrow: each row becomes a card. This goes by the table's OWN width (container
     query), so it also kicks in when the sidebar takes space on a laptop / tablet.
   ====================================================================== */
.table-card {
  position: relative;          /* keeps the hidden screen-reader labels inside the scrolling card */
  container-type: inline-size;
  container-name: table-card;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
  scrollbar-color: #c9d8d1 transparent;
}
.table-card::-webkit-scrollbar { height: 8px; }
.table-card::-webkit-scrollbar-thumb { background: #c9d8d1; border-radius: 8px; }
.table td { white-space: nowrap; }
.table td.cell-title-wrap { white-space: normal; min-width: 200px; }
.table td .checklist-preview, .table td .tag-list, .table td.cell-wrap { white-space: normal; }
.table td.cell-wrap { min-width: 180px; }
.table .cell-title-wrap .cell-title { overflow-wrap: anywhere; }
.pager { position: sticky; left: 0; }          /* stays in view while the table scrolls sideways */

/* While a table scrolls sideways: name column pinned left, actions pinned right */
.table-card.is-scrollable .table tr > :first-child,
.table-card.is-scrollable .table tr > .col-actions { position: sticky; z-index: 1; background: #fff; }
.table-card.is-scrollable .table tr > :first-child { left: 0; box-shadow: 8px 0 10px -10px rgba(16, 32, 26, .35); }
.table-card.is-scrollable .table tr > .col-actions { right: 0; box-shadow: -8px 0 10px -10px rgba(16, 32, 26, .35); }
.table-card.is-scrollable .table thead th { background: #f7faf9; }
.table-card.is-scrollable .table tbody tr:nth-child(even) > :first-child,
.table-card.is-scrollable .table tbody tr:nth-child(even) > .col-actions { background: #fcfdfd; }
.table-card.is-scrollable .table tbody tr:hover > :first-child,
.table-card.is-scrollable .table tbody tr:hover > .col-actions { background: #f6fbf9; }

@container table-card (max-width: 760px) {
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 4px 12px;
    padding: 14px 16px;
    border-bottom: 1px solid #edf2f0;
  }
  .table tr:last-child { border-bottom: 0; }
  .table td { padding: 0; border: 0; grid-column: 1 / -1; white-space: normal; min-width: 0; font-size: 14px; }
  .table-card .table tr > * { position: static !important; box-shadow: none !important; }
  .table tbody tr:hover td, .table tbody tr:nth-child(even) td { background: none; }
  .table td[data-label]:not(.cell-title-wrap)::before {
    content: attr(data-label) ": ";
    color: var(--ink-faint);
  }
  .table td.cell-title-wrap { grid-column: 1; grid-row: 1; align-self: center; min-width: 0; }
  .table td.col-actions { grid-column: 2; grid-row: 1; width: auto; display: flex; gap: 4px; align-items: center; justify-content: flex-end; }
  .table td.cell-status { margin-top: 4px; }
  .table .loading-row td { text-align: center; padding: 28px 0; }
  .pager { position: static; justify-content: space-between; }
  .pager-size { margin-left: 0; }
  .pager-pages { width: 100%; justify-content: center; }
}

/* Card rows with room to spare: the details sit two per line instead of one */
@container table-card (min-width: 481px) and (max-width: 760px) {
  .table tr { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 6px 20px; }
  .table td.cell-title-wrap { grid-column: 1; }
  .table td.col-actions { grid-column: 2; }
  .table td:not(.cell-title-wrap):not(.col-actions) { grid-column: auto; overflow-wrap: anywhere; }
  .table td.cell-wrap { grid-column: 1 / -1; }
}

/* Assessment builder: the answer-type hint under the selector */
.type-hint { display: block; margin-top: 6px; }

/* Assessments: multiple picks, typed answers, multi-select buttons */
.answer-set { display: grid; gap: 8px; }
.answer-pick { display: grid; gap: 6px; justify-items: start; }
.answer-text { padding: 10px 14px; border: 1px solid var(--line); border-radius: var(--radius-m); background: #f6faf8; white-space: pre-wrap; overflow-wrap: anywhere; }
.choice.is-multi[aria-checked="true"]::before { content: "\2713  "; }
.fill-text { margin-top: 12px; }
.fill-q > span:last-child { min-width: 0; }
