/* ==========================================================================
   Signed-in shell — admin, mentor, care team and account holder all use it.
   ========================================================================== */
.app { display: grid; grid-template-columns: 264px minmax(0, 1fr); min-height: 100vh; }
/* Android app WebView session (logged in via /app/login/) — no
   sidebar, since the app's own bottom navigation already handles
   moving between screens */
.app--no-side { grid-template-columns: minmax(0, 1fr); }

.side {
  background: var(--ink-2);
  border-right: 1px solid var(--line);
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.side .brand { padding: 6px 10px 20px; }
.side__label {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--mist-dim);
  padding: 18px 12px 8px;
}
.side a.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 14.5px;
  color: var(--mist);
  transition: background .2s, color .2s;
}
.side a.nav-item:hover { background: rgba(255,255,255,.04); color: var(--paper); }
.side a.nav-item.is-active { background: var(--teal-dim); color: var(--teal); }
.side a.nav-item i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .5; flex: none; }
.side__foot { margin-top: auto; padding-top: 18px; border-top: 1px solid var(--line-soft); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px 18px;
  padding: 18px clamp(18px, 3vw, 36px);
  border-bottom: 1px solid var(--line);
  background: rgba(10,39,49,.7);
  backdrop-filter: blur(14px);
  position: sticky; top: 0; z-index: 40;
}
.topbar h1 { font-size: 21px; letter-spacing: -.03em; }
.topbar__sub { font-size: 13px; color: var(--mist-dim); margin-top: 3px; }
.topbar__right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.page { padding: clamp(20px, 3vw, 34px); flex: 1; }

.who {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 12px 6px 6px;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 13.5px;
}

/* stat cards */
.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 26px; }
.stat {
  padding: 20px 20px 22px;
  border-radius: var(--r);
  border: 1px solid var(--line);
  background: linear-gradient(160deg, rgba(28,76,87,.7), rgba(15,48,57,.7));
  position: relative;
  overflow: hidden;
  transition: border-color .3s, transform .3s var(--ease);
}
.stat:hover { border-color: rgba(79,182,193,.35); transform: translateY(-3px); }
.stat b { font-family: var(--font-display); font-size: 30px; font-weight: 700; letter-spacing: -.03em; display: block; line-height: 1.1; }
.stat span { font-family: var(--font-mono); font-size: 10px; letter-spacing: .15em; text-transform: uppercase; color: var(--mist-dim); }

/* card + table */
.card {
  border-radius: var(--r-lg);
  border: 1px solid rgba(255, 255, 255, .1);
  background: rgba(22, 63, 73, .38);
  backdrop-filter: blur(16px) saturate(140%);
  padding: 22px;
  margin-bottom: 18px;
}
.card__head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.card__head h2 { font-size: 17px; }
.card__head p { margin: 3px 0 0; font-size: 13px; color: var(--mist-dim); }

.grid-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; align-items: start; }
.grid-side { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 18px; align-items: start; }

.table-wrap { overflow-x: auto; margin: 0 -22px -22px; padding: 0 22px 6px; -webkit-overflow-scrolling: touch; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 640px; }
table.tbl th {
  text-align: left;
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--mist-dim);
  font-weight: 400;
  padding: 0 14px 11px 0;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
table.tbl td { padding: 13px 14px 13px 0; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
table.tbl tr:last-child td { border-bottom: 0; }
table.tbl tbody tr { transition: background .2s; }
table.tbl tbody tr:hover { background: rgba(255,255,255,.022); }
.muted { color: var(--mist-dim); }
.mono { font-family: var(--font-mono); font-size: 12.5px; }

.tag {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-mono);
  font-size: 9.5px; letter-spacing: .12em; text-transform: uppercase;
  padding: 4px 9px; border-radius: 999px;
  border: 1px solid var(--line); color: var(--mist);
  white-space: nowrap;
}
.tag--ok { color: var(--teal); border-color: rgba(79,182,193,.3); background: var(--teal-dim); }
.tag--warn { color: var(--amber); border-color: rgba(232,185,107,.3); background: var(--amber-dim); }
.tag--off { color: var(--rose); border-color: rgba(255,122,147,.3); background: rgba(255,122,147,.1); }

.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 18px; }
.filters .field { width: auto; min-width: 160px; }

.empty { text-align: center; padding: 46px 20px; color: var(--mist-dim); }
.empty b { display: block; font-family: var(--font-display); font-size: 19px; color: var(--paper); margin-bottom: 7px; }

/* task list */
.task { display: flex; gap: 13px; align-items: flex-start; padding: 13px 0; border-bottom: 1px solid var(--line-soft); }
.task:last-child { border-bottom: 0; }
.task__box {
  width: 21px; height: 21px; border-radius: 7px; flex: none;
  border: 1.5px solid var(--line); background: transparent;
  display: grid; place-items: center; margin-top: 2px;
  transition: background .2s, border-color .2s;
}
.task__box:hover { border-color: var(--teal); }
.task.is-done .task__box { background: var(--teal); border-color: var(--teal); }
.task.is-done .task__box::after { content: "✓"; color: #032019; font-size: 12px; font-weight: 700; }
.task.is-done .task__t { text-decoration: line-through; color: var(--mist-dim); }
.task__t { font-size: 14.5px; }
.task__m { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--mist-dim); margin-top: 3px; }

/* streak + mood */
.streak { display: flex; align-items: baseline; gap: 10px; }
.streak b { font-family: var(--font-display); font-size: 52px; font-weight: 700; letter-spacing: -.05em; color: var(--amber); line-height: 1; }
.dots { display: flex; gap: 5px; margin-top: 16px; flex-wrap: wrap; }
.dots i { width: 13px; height: 13px; border-radius: 4px; background: rgba(255,255,255,.07); display: block; }
.dots i.on { background: var(--amber); }

.mood-scale { display: flex; gap: 8px; flex-wrap: wrap; }
.mood-scale label {
  flex: 1; min-width: 62px;
  text-align: center;
  padding: 13px 6px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  cursor: pointer;
  font-size: 12px;
  color: var(--mist);
  transition: all .2s;
}
.mood-scale input { position: absolute; opacity: 0; pointer-events: none; }
.mood-scale label:hover { border-color: var(--teal); }
.mood-scale input:checked + span, .mood-scale label.is-picked { background: var(--teal-dim); border-color: var(--teal); color: var(--teal); }
.mood-scale label em { display: block; font-style: normal; font-size: 19px; margin-bottom: 5px; }

/* bar chart */
.bars { display: flex; align-items: flex-end; gap: 4px; height: 132px; }
.bars .bar { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; height: 100%; gap: 6px; align-items: center; }
.bars .bar i {
  width: 100%;
  border-radius: 5px 5px 2px 2px;
  background: linear-gradient(180deg, var(--teal), rgba(31, 76, 85, .35));
  display: block;
  min-height: 3px;
  transform-origin: bottom;
  animation: grow .8s var(--ease) both;
}
@keyframes grow { from { transform: scaleY(0); } }
.bars .bar.zero i { background: rgba(255,255,255,.06); }
.bars .bar span { font-family: var(--font-mono); font-size: 9px; color: var(--mist-dim); }

/* chat */
.thread { display: flex; flex-direction: column; gap: 12px; max-height: 58vh; overflow-y: auto; padding-right: 6px; margin-bottom: 18px; }
.msg { max-width: 74%; padding: 12px 15px; border-radius: 15px; font-size: 14.5px; border: 1px solid var(--line); }
.msg--in { background: rgba(255,255,255,.035); border-bottom-left-radius: 5px; align-self: flex-start; }
.msg--out { background: var(--teal); color: #032019; border-color: transparent; border-bottom-right-radius: 5px; align-self: flex-end; }
.msg time { display: block; font-family: var(--font-mono); font-size: 9.5px; opacity: .6; margin-top: 6px; }
.composer { display: flex; gap: 10px; align-items: flex-end; }
.composer .field { flex: 1; }

.list-link { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--line-soft); transition: padding-left .25s var(--ease); }
.list-link:last-child { border-bottom: 0; }
.list-link:hover { padding-left: 6px; }

.pill-row { display: flex; gap: 8px; flex-wrap: wrap; }
.pill {
  padding: 7px 14px; border-radius: 999px; border: 1px solid var(--line);
  font-size: 13px; color: var(--mist); transition: all .2s;
}
.pill:hover { border-color: var(--teal); color: var(--teal); }
.pill.is-on { background: var(--teal-dim); border-color: rgba(79,182,193,.4); color: var(--teal); }

.mobile-bar { display: none; }

@media (max-width: 1100px) {
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-side, .grid-3 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 860px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .side {
    position: fixed; inset: 0 auto 0 0; width: 268px; z-index: 120;
    transform: translateX(-100%); transition: transform .35s var(--ease);
    box-shadow: 0 0 60px rgba(0,0,0,.6);
  }
  .side.is-open { transform: none; }
  .scrim { position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 110; opacity: 0; pointer-events: none; transition: opacity .3s; }
  .scrim.is-on { opacity: 1; pointer-events: auto; }
  .mobile-bar { display: flex; align-items: center; gap: 12px; }
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .topbar h1 { font-size: 18px; }
}
@media (max-width: 560px) {
  .stat-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
  .stat b { font-size: 24px; }
  .card { padding: 17px; }
  .table-wrap { margin: 0 -17px -17px; padding: 0 17px 6px; }
  .msg { max-width: 88%; }
}

/* auth pages */
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.auth-side {
  padding: clamp(30px, 5vw, 64px);
  background: linear-gradient(165deg, rgba(31, 76, 85, .2), var(--ink) 62%);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
}
/* fills whatever space is left (with or without the logo above it,
   with or without the copyright below it) and centers itself in it —
   robust regardless of which siblings are actually present */
.auth-side__tagline { flex: 1; display: flex; flex-direction: column; justify-content: center; }
.auth-side h2 { font-size: clamp(28px, 3.4vw, 44px); letter-spacing: -.04em; margin: 0 0 18px; }
.auth-main { display: grid; place-items: center; padding: clamp(28px, 5vw, 64px); }
.auth-card { width: min(100%, 400px); }
.auth-card h1 { font-size: 30px; margin-bottom: 10px; }
.auth-card > p { color: var(--mist); margin: 0 0 28px; font-size: 15px; }
.field--otp { text-align: center; font-family: var(--font-mono); font-size: 26px; letter-spacing: .5em; padding: 16px; }
.hint {
  margin-top: 20px; padding: 13px 15px; border-radius: var(--r-sm);
  background: var(--amber-dim); border: 1px solid rgba(232,185,107,.25);
  font-size: 13px; color: var(--amber);
}
.hint b { font-family: var(--font-mono); }
@media (max-width: 860px) {
  /* single centered card, vertically centered in the viewport — same
     feel as the bare /app/login/ page — desktop keeps its two-column
     split untouched above this breakpoint. */
  .auth-wrap {
    grid-template-columns: minmax(0, 1fr);
    min-height: 100vh;
    align-content: center;
    max-width: 440px;
    margin: 0 auto;
    padding: 32px 0;
  }
  .auth-side {
    padding: 0 24px 22px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    background: none;
    display: block;
  }
  .auth-side .brand { margin-bottom: 16px; }
  .auth-side h2 { font-size: 21px; margin: 0 0 8px; }
  .auth-side .lede { font-size: 14px; margin: 0; }
  .auth-side .help { display: none; }
  .auth-main { padding: 22px 24px 0; place-items: stretch; }
  .auth-card { width: 100%; }
}

/* account-holder search (manual enrolment) */
.form-row { position: relative; }
.search-results {
  position: absolute; z-index: 20; left: 0; right: 0; top: calc(100% + 6px);
  border-radius: var(--r-md); border: 1px solid var(--line);
  background: var(--panel-2); box-shadow: 0 18px 40px rgba(0,0,0,.35);
  max-height: 320px; overflow-y: auto;
}
.search-results__empty { padding: 14px 16px; font-size: 13px; color: var(--mist-dim); }
.search-result {
  display: flex; flex-direction: column; gap: 2px;
  padding: 12px 16px; border-bottom: 1px solid var(--line-soft);
  text-decoration: none; color: var(--paper);
}
.search-result:last-child { border-bottom: 0; }
.search-result:hover { background: rgba(79,182,193,.1); }
.search-result__name { font-weight: 600; font-size: 14px; }
.search-result__meta { font-family: var(--font-mono); font-size: 11px; letter-spacing: .04em; color: var(--mist); }
.search-result__ben { font-size: 12px; color: var(--mist-dim); }

/* staff caseload disclosure */
.caseload { padding: 0 0 14px; }
.caseload summary {
  cursor: pointer; list-style: none; font-size: 12.5px; color: var(--mist-dim);
  font-family: var(--font-mono); letter-spacing: .04em; padding: 4px 0;
}
.caseload summary::-webkit-details-marker { display: none; }
.caseload summary::before { content: "▸ "; }
.caseload[open] summary::before { content: "▾ "; }
.caseload__list { padding-top: 6px; }
.caseload .list-link { padding: 10px 0; }

/* enrolments grouped by account holder */
.owner-group + .owner-group { margin-top: 16px; }
.owner-group__head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding-bottom: 14px; margin-bottom: 14px; border-bottom: 1px solid var(--line);
}
.owner-group__head h3 { font-size: 17px; margin: 0 0 2px; }
.owner-group__beneficiary + .owner-group__beneficiary { margin-top: 20px; }
.owner-group__beneficiary-head { font-size: 14px; font-weight: 600; margin-bottom: 8px; }

/* course cards */
.course-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 18px; }
.course {
  border-radius: var(--r-xl);
  border: 1px solid rgba(255, 255, 255, .12);
  background: rgba(22, 63, 73, .4);
  backdrop-filter: blur(16px) saturate(140%);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform .45s var(--ease), border-color .45s, background .45s;
}
.course:hover { transform: translateY(-6px); border-color: rgba(79,182,193,.45); background: rgba(28,76,87,.6); }
.course__img { aspect-ratio: 16/9; background: linear-gradient(140deg, var(--panel-2), var(--ink-2)); position: relative; overflow: hidden; }
.course__img img { width: 100%; height: 100%; object-fit: cover; transition: transform .7s var(--ease); }
.course:hover .course__img img { transform: scale(1.06); }
.course__glyph { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--font-display); font-size: 46px; color: rgba(79,182,193,.22); letter-spacing: -.05em; }
/* no cover image or icon graphic — just the care-team badge, sitting
   inline at the top of the body instead of pinned over a now-absent
   image slot */
.course__care {
  display: inline-flex;
  align-self: flex-start;
  font-family: var(--font-mono); font-size: 9px; letter-spacing: .13em; text-transform: uppercase;
  padding: 5px 10px; border-radius: 999px; margin-bottom: 12px;
  background: var(--teal-dim); border: 1px solid rgba(79,182,193,.3); color: var(--teal);
}
.course__body { padding: 18px 18px 20px; display: flex; flex-direction: column; flex: 1; }
.course__body h3 { font-size: 18px; margin-bottom: 6px; }
.course__body p { color: var(--mist); font-size: 14px; margin: 0 0 16px; flex: 1; }
.course__foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-top: 12px; border-top: 1px solid var(--line-soft); }
.course__foot .price { font-family: var(--font-display); font-size: 21px; font-weight: 700; letter-spacing: -.03em; }
@media (max-width: 640px) { .course-grid { grid-template-columns: minmax(0, 1fr); } }
