/* ==========================================================================
   Lime Digital Institute LMS — design system
   Implements the tokens, components and responsive rules from the handoff.
   No other colours. No gradients except the two functional ones.
   ========================================================================== */

:root {
  /* Colour */
  --red:            #ED3237;
  --red-tint:       rgba(237, 50, 55, 0.10);
  --red-wash:       rgba(237, 50, 55, 0.05);
  --red-wash-2:     rgba(237, 50, 55, 0.04);
  --ink:            #212529;
  --muted:          #6B7280;
  --surface:        #F7F7F7;
  --white:          #FFFFFF;
  --border:         rgba(18, 33, 48, 0.08);
  --track:          rgba(18, 33, 48, 0.08);
  --bar-inactive:   rgba(18, 33, 48, 0.15);

  /* Geometry */
  --r-card:         9px;
  --r-small:        4px;
  --r-pill:         999px;

  /* Spacing */
  --pad-card:       25px;
  --pad-card-dense: 20px;
  --pad-page:       24px;
  --gap-section:    24px;

  --font: Poppins, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: ui-monospace, Menlo, Monaco, "Cascadia Mono", monospace;
}

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

/*
 * Course/session/article text isn't selectable or copyable anywhere in the
 * app — deters casual copy-paste of paid content. Form fields and anything
 * editable are explicitly exempted, since that would otherwise break basic
 * editing (can't select-all in a title input, Quill's editor stops working,
 * etc.). The Materials page is exempted wholesale via .allow-select, since
 * file names/details there are meant to be copyable.
 */
body {
  -webkit-user-select: none;
  -moz-user-select: none;
  user-select: none;
  /* iOS Safari still opens its selection/callout menu on a long-press even
     with user-select:none unless this is set explicitly — the CSS property
     that actually suppresses it is this one, not user-select. */
  -webkit-touch-callout: none;
}
input, textarea, select, [contenteditable="true"], [contenteditable="true"] *,
.allow-select, .allow-select * {
  -webkit-user-select: text;
  -moz-user-select: text;
  user-select: text;
}

/*
 * The UA rule for [hidden] is display:none, but any author rule that sets
 * display — .player__error { display:flex }, for one — outranks it and the
 * element stays on screen while JS believes it is hidden. Restore the
 * invariant once, globally.
 */
[hidden] { display: none !important; }

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

/*
 * A full-height flex column so the bottom tab bar sits at the true bottom
 * of the screen even when the page content is short (short content used to
 * leave `.tabbar` floating right after it, with empty space below — sticky
 * only pins against a scrolling container taller than the viewport). `.page`
 * below grows to fill any leftover space, pushing the tab bar down; on tall
 * pages this has no effect and `.tabbar`'s own `position:sticky` still
 * handles pinning correctly during scroll.
 */
body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  background: var(--white);
  color: var(--ink);
  font: 400 16px/24px var(--font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img { max-width: 100%; display: block; }

a { color: var(--red); text-decoration: none; }
a:hover { color: var(--ink); }

input, textarea, select, button { font-family: var(--font); }

:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 2px;
  border-radius: var(--r-small);
}

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ------------------------------------------------------------ typography -- */

h1, h2, h3, h4 { margin: 0; }

.h1        { font: 700 32px/38px var(--font); overflow-wrap: anywhere; }
.h2        { font: 500 30px/38px var(--font); overflow-wrap: anywhere; }
.h3        { font: 500 20px/26px var(--font); overflow-wrap: anywhere; }
.eyebrow   { font: 500 16px/16px var(--font); letter-spacing: 2px; text-transform: uppercase; }
.eyebrow-sm{ font: 500 12px/16px var(--font); letter-spacing: 2px; text-transform: uppercase; color: var(--muted); }
.lead      { font: 500 16px/24px var(--font); color: var(--muted); margin: 0; overflow-wrap: anywhere; }
.body      { font: 400 16px/24px var(--font); margin: 0; overflow-wrap: anywhere; }
.meta      { font: 400 13px/20px var(--font); color: var(--muted); overflow-wrap: anywhere; }
.label     { font: 500 14px/22px var(--font); overflow-wrap: anywhere; }
.mono      { font-family: var(--mono); font-size: 13px; }

.text-red   { color: var(--red); }
.text-ink   { color: var(--ink); }
.text-muted { color: var(--muted); }
.text-right { text-align: right; }
.pretty     { text-wrap: pretty; }
.nowrap     { white-space: nowrap; }
.truncate   { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }

/* ---------------------------------------------------------------- layout -- */

.stack       { display: flex; flex-direction: column; gap: var(--gap-section); }
.stack-sm    { display: flex; flex-direction: column; gap: 12px; }
.stack-xs    { display: flex; flex-direction: column; gap: 8px; }
.stack-14    { display: flex; flex-direction: column; gap: 14px; }
.row         { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.row-20      { display: flex; flex-wrap: wrap; gap: 20px; }
.row-24      { display: flex; flex-wrap: wrap; gap: var(--gap-section); }
.row-top     { align-items: flex-start; }
.row-between { justify-content: space-between; }
.push        { margin-left: auto; }
.grow        { flex: 1 1 auto; min-width: 0; }
.self-start  { align-self: flex-start; }

.page {
  width: 100%;
  flex: 1 0 auto;
  max-width: 1180px;
  margin: 0 auto;
  padding: var(--pad-page);
  padding-bottom: 60px;
  box-sizing: border-box;
}

/*
 * A flex column stretches its children across the cross axis, which makes a
 * badge or button span the whole card. Inline-sized components shrink back to
 * their content when they sit directly in a stack.
 */
.stack > img,       .stack-sm > img,       .stack-xs > img,       .stack-14 > img,
.stack > .badge,    .stack-sm > .badge,    .stack-xs > .badge,    .stack-14 > .badge,
.stack > .chip,     .stack-sm > .chip,     .stack-xs > .chip,     .stack-14 > .chip,
.stack > .btn,      .stack-sm > .btn,      .stack-xs > .btn,      .stack-14 > .btn,
.stack > .btn-link, .stack-sm > .btn-link, .stack-xs > .btn-link, .stack-14 > .btn-link,
.stack > .avatar,   .stack-sm > .avatar,   .stack-xs > .avatar,
.stack > .toggle,   .stack-sm > .toggle,   .stack-xs > .toggle,
.stack > .segmented,.stack-sm > .segmented,.stack-xs > .segmented,
.stack > .chip-row, .stack-sm > .chip-row, .stack-xs > .chip-row {
  align-self: flex-start;
}

/* …unless they are explicitly full-width. */
.stack > .btn--block,      .stack-sm > .btn--block,      .stack-xs > .btn--block,
.stack > .segmented--block,.stack-sm > .segmented--block,.stack-xs > .segmented--block {
  align-self: stretch;
}

.divider { height: 1px; background: var(--border); border: 0; margin: 0; }

/* Placeholder for imagery the client is still supplying. */
.ph {
  background: repeating-linear-gradient(135deg, #EFEFEF 0 6px, var(--surface) 6px 12px);
  border-radius: var(--r-card);
  display: flex; align-items: center; justify-content: center;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  text-align: center;
  overflow: hidden;
}
.ph img { width: 100%; height: 100%; object-fit: cover; }

/* Course thumbnail — fixed 16:9, width-driven. Callers set width via the
   `style` prop passed to partials/thumb.php; height follows automatically
   so every thumbnail crops the same way regardless of where it's shown. */
.thumb { aspect-ratio: 16 / 9; }

/* ----------------------------------------------------------------- cards -- */

.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  padding: var(--pad-card);
  overflow-wrap: anywhere;
}
.card--surface { background: var(--surface); }
.card--dense   { padding: var(--pad-card-dense); }
.card--flush   { padding: 0; overflow: hidden; }

a.card, .card--click { cursor: pointer; color: inherit; display: block; }
a.card:hover, .card--click:hover { border-color: rgba(237, 50, 55, 0.35); }
a.card:hover .h3, .card--click:hover .h3 { color: var(--red); }

/* --------------------------------------------------------------- buttons -- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 42px; padding: 0 20px;
  border-radius: var(--r-pill);
  font: 500 14px/1 var(--font);
  cursor: pointer;
  border: 1px solid transparent;
  background: transparent;
  white-space: nowrap;
  transition: background-color .12s ease, color .12s ease, border-color .12s ease;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn--primary   { background: var(--red); color: var(--white); border-color: var(--red); }
.btn--primary:hover:not(:disabled) { background: #d42a2f; border-color: #d42a2f; color: var(--white); }

.btn--secondary { background: var(--white); color: var(--red); border-color: var(--border); }
.btn--secondary:hover:not(:disabled) { border-color: var(--red); color: var(--red); }

.btn--neutral   { background: var(--white); color: var(--ink); border-color: var(--border); }
.btn--neutral:hover:not(:disabled) { border-color: var(--muted); color: var(--ink); }

.btn--ghost     { background: transparent; color: var(--white); border-color: rgba(255,255,255,.5); }
.btn--ghost:hover:not(:disabled) { background: rgba(255,255,255,.14); color: var(--white); }

.btn--sm    { height: 38px; padding: 0 16px; }
.btn--xs    { height: 32px; padding: 0 14px; font-size: 13px; }
.btn--block { width: 100%; }
.btn--danger{ background: var(--white); color: var(--red); border-color: var(--border); }

.btn-link {
  background: none; border: 0; padding: 0; cursor: pointer;
  font: 500 14px/22px var(--font); color: var(--red);
}
.btn-link--underline { text-decoration: underline; }
.btn-link--muted { color: var(--muted); }

/* ------------------------------------------------------- chips and pills -- */

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px;
  border-radius: var(--r-pill);
  border: 1px solid var(--border);
  background: var(--white);
  color: var(--ink);
  font: 500 13px/16px var(--font);
  cursor: pointer;
  white-space: nowrap;
}
.chip:hover { border-color: var(--muted); color: var(--ink); }
.chip.is-active,
.chip--on { background: var(--red); color: var(--white); border-color: var(--red); }
.chip.is-active:hover, .chip--on:hover { color: var(--white); }

.chip--static { cursor: default; }
.chip--static:hover { border-color: var(--border); }

.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }

.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 12px;
  border-radius: var(--r-pill);
  font: 500 12px/16px var(--font);
  background: var(--surface);
  color: var(--muted);
  border: 1px solid var(--border);
  white-space: nowrap;
}
.badge--red     { background: var(--red); color: var(--white); border-color: var(--red); }
.badge--tint    { background: var(--red-tint); color: var(--red); border-color: transparent; }

.pin-strip {
  display: flex; align-items: center; gap: 6px;
  font: 600 11px/1 var(--font); letter-spacing: .2px; color: var(--red);
  margin-bottom: 12px;
}
.badge--neutral { background: var(--surface); color: var(--muted); }

/* ---------------------------------------------------- segmented control -- */

.segmented {
  display: inline-flex;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  padding: 5px;
  gap: 4px;
  max-width: 100%;
}
.segmented__item {
  border: 0; background: transparent; cursor: pointer;
  padding: 9px 16px;
  border-radius: var(--r-pill);
  font: 500 14px/1 var(--font);
  color: var(--muted);
  white-space: nowrap;
}
.segmented__item.is-active { background: var(--red); color: var(--white); }
.segmented--block { display: flex; width: 100%; }
.segmented--block .segmented__item { flex: 1 1 0; text-align: center; }
.segmented--white { background: var(--white); }

/* ------------------------------------------------------------------ tabs -- */

.tabs {
  display: flex; gap: 4px;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }

.tabs__item {
  background: transparent; border: 0; cursor: pointer;
  padding: 12px 14px;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  font: 500 14px/22px var(--font);
  color: var(--muted);
  white-space: nowrap;
}
.tabs__item.is-active { color: var(--red); border-bottom-color: var(--red); }
.tabs__item:hover { color: var(--ink); }
.tabs__item.is-active:hover { color: var(--red); }

/* -------------------------------------------------------------- progress -- */

.progress {
  height: 6px;
  background: var(--track);
  border-radius: var(--r-pill);
  overflow: hidden;
  width: 100%;
}
.progress__fill {
  height: 100%;
  background: var(--red);
  border-radius: var(--r-pill);
  transition: width .3s ease;
}
.progress--thin { height: 5px; }
.progress--thick { height: 8px; }

/* --------------------------------------------------------------- avatars -- */

.avatar {
  width: 38px; height: 38px; flex: none;
  border-radius: var(--r-pill);
  background: var(--track);
  color: var(--muted);
  display: inline-flex; align-items: center; justify-content: center;
  font: 600 14px/1 var(--font);
  overflow: hidden;
  text-transform: uppercase;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar--me { background: var(--red); color: var(--white); }
.avatar--30 { width: 30px; height: 30px; font-size: 11px; }
.avatar--34 { width: 34px; height: 34px; font-size: 12px; }
.avatar--42 { width: 42px; height: 42px; font-size: 15px; }
.avatar--48 { width: 48px; height: 48px; font-size: 17px; }
.avatar--80 { width: 80px; height: 80px; font-size: 26px; }
.avatar--32 { width: 32px; height: 32px; font-size: 12px; }

/* ----------------------------------------------------------------- forms -- */

.field { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.field__label { font: 500 14px/22px var(--font); color: var(--ink); }
.field__label .qualifier { color: var(--red); font-weight: 500; }
.field__hint { font: 400 13px/20px var(--font); color: var(--muted); }
.field__ok   { font: 500 13px/20px var(--font); color: var(--red); }
.field__error{ font: 400 13px/20px var(--font); color: var(--red); }

.input {
  width: 100%;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  padding: 14px 16px;
  font: 400 14px/22px var(--font);
  color: var(--ink);
}
.input::placeholder { color: var(--muted); }
.input:focus { border-color: var(--red); outline: none; }
.input.is-invalid { border-color: var(--red); }
.input--focus { border-color: var(--red); }

textarea.input { min-height: 84px; resize: vertical; }
textarea.input--tall { min-height: 110px; }

select.input {
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 20px) 22px, calc(100% - 15px) 22px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 40px;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
}

.search {
  display: flex; align-items: center; gap: 8px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  padding: 10px 14px;
  min-width: 0;
}
.search input {
  border: 0; outline: none; background: transparent;
  font: 400 13px/20px var(--font); color: var(--ink);
  width: 100%; min-width: 0;
}
.search input::placeholder { color: var(--muted); }

.icon-circle {
  width: 12px; height: 12px; flex: none;
  border: 1.5px solid var(--muted);
  border-radius: 50%;
}

/* Toggle: 44x26 track, 20px knob, 3px inset. */
.toggle { display: inline-flex; align-items: center; gap: 12px; cursor: pointer; }
.toggle input { position: absolute; opacity: 0; width: 0; height: 0; }
.toggle__track {
  width: 44px; height: 26px; flex: none;
  border-radius: var(--r-pill);
  background: var(--track);
  position: relative;
  transition: background-color .15s ease;
}
.toggle__track::after {
  content: "";
  position: absolute; top: 3px; left: 3px;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--white);
  transition: transform .15s ease;
}
.toggle input:checked + .toggle__track { background: var(--red); }
.toggle input:checked + .toggle__track::after { transform: translateX(18px); }
.toggle input:focus-visible + .toggle__track { outline: 2px solid var(--red); outline-offset: 2px; }
.toggle__text { font: 400 14px/22px var(--font); }

.checkbox { width: 18px; height: 18px; accent-color: var(--red); cursor: pointer; flex: none; }

/* Dropzone */
.dropzone {
  border: 1.5px dashed var(--red);
  background: var(--red-wash-2);
  border-radius: var(--r-card);
  padding: 32px 24px;
  text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
}

/* ------------------------------------------------------------ file icons -- */

.file-icon {
  width: 38px; height: 38px; flex: none;
  border-radius: var(--r-small);
  background: var(--white);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font: 600 10px/1 var(--font);
  text-transform: uppercase;
  color: var(--muted);
}
.file-icon--28 { width: 28px; height: 28px; font-size: 9px; }

/* ---------------------------------------------------------------- tables -- */

.table { display: flex; flex-direction: column; }
.table__head {
  display: flex; gap: 12px;
  background: var(--surface);
  padding: 12px 20px;
  border-radius: var(--r-card) var(--r-card) 0 0;
  border: 1px solid var(--border);
}
.table__head > * {
  font: 500 12px/1 var(--font);
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--muted);
}
.table__row {
  display: flex; gap: 12px; align-items: center;
  padding: 16px 20px;
  border: 1px solid var(--border);
  border-top: 0;
}
.table__row:last-child { border-radius: 0 0 var(--r-card) var(--r-card); }
.table__row.is-selected { background: var(--red-tint); }
.table__row--head-less:first-child { border-top: 1px solid var(--border); border-radius: var(--r-card) var(--r-card) 0 0; }

.bulk-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px;
  background: var(--red-wash);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  padding: 12px 20px;
}

/* --------------------------------------------------------------- listing -- */

/* Rows separated by a top border, no outer card. */
.list { display: flex; flex-direction: column; }
.list__row {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px;
  padding: 16px 0;
  border-top: 1px solid var(--border);
}
.list__row:first-child { border-top: 0; }

.grid-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
}
.grid-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 20px;
}

/* Manual article body — Quill's raw output has no styling of its own once
   it leaves the editor, so give its tags reasonable defaults here. */
.article-body { line-height: 1.6; color: var(--ink); }
.article-body h1 { font: 700 26px/32px var(--font); margin: 24px 0 12px; }
.article-body h2 { font: 600 22px/28px var(--font); margin: 22px 0 10px; }
.article-body h3 { font: 600 18px/24px var(--font); margin: 18px 0 8px; }
.article-body p, .article-body ul, .article-body ol, .article-body blockquote { margin: 0 0 14px; }
.article-body ul, .article-body ol { padding-left: 24px; }
.article-body a { color: var(--red); }
.article-body blockquote {
  border-left: 3px solid var(--border);
  padding-left: 14px;
  color: var(--muted);
}
.article-body pre {
  background: var(--surface);
  border-radius: var(--r-small);
  padding: 12px 14px;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 13px;
  margin: 0 0 14px;
}
.article-body code {
  font-family: var(--mono);
  font-size: 0.9em;
  background: var(--surface);
  padding: 1px 5px;
  border-radius: 3px;
}
.article-body img { max-width: 100%; border-radius: var(--r-small); }
.article-body table { border-collapse: collapse; width: 100%; margin: 0 0 14px; }
.article-body td, .article-body th {
  border: 1px solid var(--border);
  padding: 8px 10px;
  text-align: left;
}

/* Manuals index — a 3:4 portrait "book cover", same shape whether the
   cover is a real image or a plain color block. */
.manual-card { overflow: hidden; }
.manual-card__cover {
  display: block;
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
}
.manual-card__cover--solid { position: relative; }
.manual-card__cover--solid::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.08);
}

/* Manuals index — fixed 2 columns always, even on mobile (unlike the
   auto-fill .grid-cards used elsewhere), matching the reference layout. */
.manuals-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}
@media (max-width: 520px) {
  .manuals-grid { gap: 12px; }
}

.stat__label { font: 500 12px/16px var(--font); letter-spacing: 2px; text-transform: uppercase; color: var(--muted); }
.stat__value { font: 700 32px/38px var(--font); color: var(--ink); }
.stat__meta  { font: 400 13px/20px var(--font); color: var(--muted); }
.stat__delta { font: 500 13px/20px var(--font); color: var(--red); }

/* Number square used for module rows and date badges. */
.num-square {
  width: 42px; height: 42px; flex: none;
  border-radius: var(--r-card);
  background: var(--red-tint);
  color: var(--red);
  display: flex; align-items: center; justify-content: center;
  font: 600 14px/1 var(--font);
}
/*
 * Course overview accordion — each module is a <details>, so it works with
 * no JS and gets free keyboard/click toggling. `list-style:none` +
 * `::-webkit-details-marker{display:none}` strip the native triangle since
 * the chevron SVG in the summary rotates instead (via [open] below).
 */
.accordion-section { border-bottom: 1px solid var(--border); }
.accordion-section:last-child { border-bottom: 0; }
.accordion-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 4px; cursor: pointer; list-style: none;
}
.accordion-head::-webkit-details-marker { display: none; }
.accordion-chevron { color: var(--muted); flex: none; transition: transform .18s ease; }
.accordion-section[open] > .accordion-head .accordion-chevron { transform: rotate(90deg); color: var(--red); }

.lecture-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 4px 10px 40px;
  color: inherit;
  border-radius: var(--r-small);
}
.lecture-row:hover { background: var(--surface); }
.lecture-row__icon {
  width: 26px; height: 26px; border-radius: 7px; flex: none;
  background: var(--surface); color: var(--muted);
  display: flex; align-items: center; justify-content: center;
}
.lecture-row.is-done .lecture-row__icon { background: var(--red-tint); color: var(--red); }
.lecture-row__title { display: block; font: 500 13.5px/1.4 var(--font); color: var(--ink); }
.lecture-row__meta { font: 400 12px/1.6 var(--font); color: var(--muted); }
.lecture-row__time { font: 600 11.5px/1 var(--font); white-space: nowrap; }

@media (max-width: 640px) {
  .lecture-row { padding-left: 30px; }
}

.date-badge {
  width: 44px; flex: none;
  border-radius: var(--r-card);
  background: var(--red-tint);
  color: var(--red);
  padding: 6px 0;
  text-align: center;
}
.date-badge__day   { font: 600 14px/18px var(--font); display: block; }
.date-badge__month { font: 400 10px/12px var(--font); display: block; text-transform: uppercase; }

.dot-status {
  width: 30px; height: 30px; flex: none;
  border-radius: var(--r-pill);
  display: flex; align-items: center; justify-content: center;
  font: 500 12px/1 var(--font);
  background: var(--surface);
  color: var(--muted);
  border: 1px solid var(--border);
}
.dot-status--done    { background: var(--red-tint); color: var(--red); border-color: transparent; }
.dot-status--current { background: var(--red); color: var(--white); border-color: var(--red); }

.bullet-red {
  width: 8px; height: 8px; flex: none;
  border-radius: 50%;
  background: var(--red);
  margin-top: 8px;
}

/* ----------------------------------------------------------- bar charts -- */

.chart-bars {
  display: flex; align-items: flex-end; gap: 10px;
  height: 140px;
}
.chart-bars--150 { height: 150px; }
.chart-bar { flex: 1 1 0; display: flex; flex-direction: column; align-items: center; gap: 8px; height: 100%; }
.chart-bar__fill {
  width: 100%;
  background: var(--bar-inactive);
  border-radius: var(--r-small);
  margin-top: auto;
}
.chart-bar__fill.is-current { background: var(--red); }
.chart-bar__label { font: 400 11px/1 var(--font); color: var(--muted); }

.spark {
  width: 100%; height: 200px; display: block;
}
.spark__line { fill: none; stroke: var(--red); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.spark__area { fill: var(--red-tint); stroke: none; }
.spark__grid { stroke: var(--border); stroke-width: 1; }

/* ---------------------------------------------------------------- player -- */

.player {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: var(--r-card);
  background: var(--ink);
  overflow: hidden;
}
.player iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.player video  { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: var(--ink); }

/* --- custom player chrome ------------------------------------------------ */

.player__frame { position: absolute; inset: 0; }
.player__frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/*
 * The shield sits over the whole iframe so YouTube's own title bar, share and
 * logo controls can never be clicked. Every interaction goes through our own
 * controls instead.
 */
.player__shield {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  background: transparent;
  border: 0; padding: 0; margin: 0;
  cursor: pointer;
  z-index: 2;
}
.player__shield:focus-visible { outline: 2px solid var(--red); outline-offset: -4px; }

.player__center {
  position: absolute; inset: 0; z-index: 3;
  display: flex; align-items: center; justify-content: center;
  pointer-events: none;
}

/*
 * YouTube renders its own poster/title/channel-name/logo overlay any time
 * playback is not actively running — before the first play, when paused,
 * and after it ends — the one piece of chrome the click-shield cannot
 * suppress, because it is a visibility problem, not a click one. Previously
 * this only covered the unstarted/finished states, so pausing mid-session
 * (not just the very first frame) let that overlay show through. An opaque
 * cover any time the centre overlay itself is shown handles every case,
 * since `showCentre(true)` in app.js already fires for unstarted/paused/
 * finished alike.
 */
.player__center:not([hidden]) { background: var(--ink); }
.player__bigplay {
  width: 74px; height: 74px;
  border-radius: var(--r-pill);
  background: var(--red);
  display: block;
  position: relative;
}
.player__bigplay::after {
  content: "";
  position: absolute; top: 50%; left: 54%;
  transform: translate(-50%, -50%);
  border-left: 22px solid var(--white);
  border-top: 14px solid transparent;
  border-bottom: 14px solid transparent;
}

.player__spinner {
  position: absolute; top: 50%; left: 50%; z-index: 3;
  width: 42px; height: 42px; margin: -21px 0 0 -21px;
  border: 3px solid rgba(255,255,255,.25);
  border-top-color: var(--red);
  border-radius: 50%;
  animation: player-spin .8s linear infinite;
  pointer-events: none;
}
@keyframes player-spin { to { transform: rotate(360deg); } }

/*
 * The lower half is near-solid on purpose. YouTube draws its "More videos"
 * card and watch-later button along the bottom edge in the closing seconds,
 * and a soft gradient lets them show through between our own controls.
 */
.player__bar {
  position: absolute; inset: auto 0 0 0; z-index: 4;
  padding: 44px 14px 10px;
  background: linear-gradient(
    rgba(0, 0, 0, 0) 0%,
    rgba(0, 0, 0, .70) 38%,
    rgba(18, 20, 23, .97) 62%,
    rgba(18, 20, 23, 1) 100%
  );
  color: var(--white);
  opacity: 1;
  transition: opacity .2s ease;
}
.player.is-idle .player__bar { opacity: 0; pointer-events: none; }
.player.is-idle .player__shield { cursor: none; }

.player__scrub { padding: 6px 0; cursor: pointer; position: relative; }
.player__scrub-track {
  height: 4px; border-radius: var(--r-pill);
  background: rgba(255,255,255,.28);
  position: relative; overflow: hidden;
  transition: height .12s ease;
}
.player__scrub:hover .player__scrub-track,
.player__scrub:focus-visible .player__scrub-track { height: 6px; }
.player__scrub-buffer {
  position: absolute; inset: 0 auto 0 0;
  background: rgba(255,255,255,.2);
  width: 0;
}
.player__scrub-fill {
  position: absolute; inset: 0 auto 0 0;
  background: var(--red);
  width: 0;
}
.player__scrub-knob {
  position: absolute; top: 50%; left: 0;
  width: 12px; height: 12px; margin: -6px 0 0 -6px;
  border-radius: 50%; background: var(--red);
  opacity: 0; transition: opacity .12s ease;
  pointer-events: none;
}
.player__scrub:hover .player__scrub-knob,
.player__scrub:focus-visible .player__scrub-knob { opacity: 1; }

.player__row { display: flex; align-items: center; gap: 10px; margin-top: 2px; }

.player__btn {
  background: none; border: 0; padding: 6px;
  color: var(--white); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--r-small);
  min-width: 34px; min-height: 34px;
}
.player__btn svg { width: 20px; height: 20px; fill: currentColor; display: block; }
.player__btn:hover { color: var(--red); }
.player__btn--text { font: 500 13px/1 var(--font); }

.player__time { font: 400 12px/1 var(--font); white-space: nowrap; }

.player__vol { display: flex; align-items: center; gap: 6px; }
.player__range {
  width: 76px; height: 4px; cursor: pointer;
  appearance: none; background: rgba(255,255,255,.3);
  border-radius: var(--r-pill);
}
.player__range::-webkit-slider-thumb {
  appearance: none; width: 11px; height: 11px;
  border-radius: 50%; background: var(--white); cursor: pointer;
}
.player__range::-moz-range-thumb {
  width: 11px; height: 11px; border: 0;
  border-radius: 50%; background: var(--white); cursor: pointer;
}

.player__menu {
  position: absolute; right: 12px; bottom: 54px; z-index: 5;
  background: rgba(20, 22, 25, .96);
  border-radius: var(--r-card);
  padding: 6px;
  display: flex; flex-direction: column; gap: 2px;
  min-width: 92px;
}
.player__menu button {
  background: none; border: 0; cursor: pointer;
  color: var(--white); text-align: left;
  font: 400 13px/1 var(--font);
  padding: 8px 12px; border-radius: var(--r-small);
}
.player__menu button:hover { background: rgba(255,255,255,.12); }
.player__menu button.is-active { color: var(--red); font-weight: 500; }

/*
 * CSS-forced landscape. iOS Safari has no Fullscreen API for a plain <div>
 * (root.requestFullscreen is undefined there), so tapping Fullscreen/Rotate
 * on an iPhone previously did nothing at all — the reported bug. This class
 * is the fallback for that case (and the primary mechanism for the manual
 * Rotate button everywhere): it visually rotates the player 90deg and pins
 * it to fill the viewport while the phone is still held in portrait, using
 * the standard rotate-fullscreen trick (`left:100%` + `rotate(90deg)` around
 * a top-left origin). Real `:fullscreen` + `screen.orientation.lock()` are
 * still attempted first where supported (mostly Android Chrome); this runs
 * whether or not those succeed.
 */
.player--rotated {
  position: fixed;
  top: 0; left: 100%;
  width: 100vh; height: 100vw;
  aspect-ratio: auto;
  transform-origin: 0 0;
  transform: rotate(90deg);
  z-index: 1000;
  border-radius: 0;
}
html.player-rotate-lock { overflow: hidden; }

@media (max-width: 640px) {
  .player__vol { display: none; }
  .player__bar { padding: 32px 10px 8px; }
}

.player__error {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; padding: 24px; text-align: center;
  color: var(--white);
}

/* ------------------------------------------------------------- community -- */

.thread {
  margin-left: 20px;
  padding-left: 20px;
  border-left: 2px solid var(--border);
  display: flex; flex-direction: column; gap: 14px;
}

.post__actions {
  display: flex; flex-wrap: wrap; align-items: center; gap: 16px;
  border-top: 1px solid var(--border);
  padding-top: 14px;
}
/* Natural aspect ratio, not force-cropped into a fixed box — a portrait
   phone photo and a wide screenshot should each show in full, Pinterest-style,
   rather than both getting cropped to the same 260px-tall window. */
.post__image {
  display: block;
  width: 100%; height: auto; max-height: 520px; object-fit: contain;
  background: var(--surface);
  border-radius: var(--r-card);
}
.post__video {
  display: block;
  width: 100%; max-height: 520px;
  border-radius: var(--r-card);
  background: #000;
}
.comment-pill {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  padding: 8px 8px 8px 14px;
}
.comment-pill input {
  border: 0; background: transparent; outline: none; flex: 1 1 auto; min-width: 0;
  font: 400 13px/20px var(--font);
}

.announce-card {
  background: var(--red);
  color: var(--white);
  border-radius: var(--r-card);
  padding: var(--pad-card);
}
.announce-card .eyebrow-sm { color: rgba(255,255,255,.75); }
.announce-card a { color: var(--white); }

/* --------------------------------------------------------------- top nav -- */

.topbar {
  flex-shrink: 0;
  position: sticky; top: 0; z-index: 40;
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px;
  padding: 14px 24px;
  background: var(--white);
  border-bottom: 1px solid var(--border);
}
.topbar__logo { height: 38px; width: auto; flex: none; }
.topbar__nav { display: flex; align-items: center; gap: 4px; flex: 1 1 auto; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.topbar__nav::-webkit-scrollbar { display: none; }

.nav-pill {
  padding: 9px 14px;
  border-radius: var(--r-pill);
  font: 500 14px/1 var(--font);
  color: var(--muted);
  background: transparent;
  border: 0; cursor: pointer;
  white-space: nowrap;
}
.nav-pill:hover { color: var(--ink); }
.nav-pill.is-active { background: var(--red-tint); color: var(--red); }

.topbar__right { margin-left: auto; display: flex; align-items: center; gap: 14px; flex: 0 1 auto; min-width: 0; }
.topbar__search { flex: 0 1 230px; min-width: 0; }
.topbar__user { font: 500 14px/1 var(--font); }


/* Bottom tab bar (mobile only). This needs to be `sticky`, not `fixed` —
   `fixed` is anchored to the browser's "large" viewport, which on Android
   Chrome includes the area behind its own collapsible bottom toolbar, so
   the bar renders partly hidden underneath it. `sticky` stays in normal
   flow and tracks the real visible viewport as that toolbar shows/hides,
   giving the same "always pinned while scrolling" result without the clip. */
.tabbar {
  display: none;
  flex-shrink: 0;
  position: sticky; bottom: 0; z-index: 40;
  background: var(--white);
  border-top: 1px solid var(--border);
  padding: 10px 8px 14px;
}
.tabbar__item {
  flex: 1 1 0;
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  background: none; border: 0; cursor: pointer;
  color: var(--muted);
  font: 500 11px/1 var(--font);
  padding: 4px 0;
  min-height: 44px;
}
.tabbar__item.is-active { color: var(--red); }
.tabbar__icon { width: 20px; height: 20px; display: block; }
.tabbar__icon svg { width: 100%; height: 100%; display: block; }

/* Community composer opener on mobile: a circular + button instead of a
   full-width "Share something…" bar, so it reads as a quick action rather
   than eating a row of layout. Offset well above the tab bar's own height
   (not flush at bottom:0) so it clears Android Chrome's collapsible bottom
   toolbar the same way `.tabbar` avoids it by staying off the true edge. */
.fab {
  position: fixed;
  right: 16px;
  bottom: calc(78px + env(safe-area-inset-bottom, 0px));
  z-index: 39;
  width: 52px; height: 52px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--red);
  color: var(--white);
  border: 0;
  box-shadow: 0 6px 16px rgba(0, 0, 0, .24);
  cursor: pointer;
}
.fab svg { width: 22px; height: 22px; }
.fab:active { transform: scale(0.94); }

/* --------------------------------------------------------------- notices -- */

.flash-stack {
  display: flex; flex-direction: column; gap: 10px;
  max-width: 1180px; margin: 0 auto;
  padding: 16px 24px 0;
}
.flash {
  display: flex; align-items: flex-start; gap: 12px;
  border-radius: var(--r-card);
  padding: 14px 16px;
  font: 400 14px/22px var(--font);
  border: 1px solid var(--border);
}
.flash--success { background: var(--red-tint); color: var(--ink); border-color: transparent; }
.flash--error   { background: var(--red); color: var(--white); border-color: var(--red); }
.flash--info    { background: var(--surface); color: var(--ink); }
.flash__close { margin-left: auto; background: none; border: 0; cursor: pointer; color: inherit; font-size: 16px; line-height: 1; }

.empty {
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  background: var(--surface);
  padding: 40px 25px;
  text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
}

/* -------------------------------------------------------------- auth page -- */

.auth {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface);
  padding: 24px;
}
.auth__card {
  width: 100%; max-width: 420px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  padding: 32px;
  display: flex; flex-direction: column; gap: 20px;
}
/*
 * align-self is load-bearing: .auth__card is a flex column, so without it the
 * logo is stretched to the full card width while height stays fixed, which
 * destroys the aspect ratio.
 */
.auth__logo {
  height: 46px;
  width: auto;
  max-width: 180px;
  object-fit: contain;
  object-position: left center;
  align-self: flex-start;
}

/* ------------------------------------------------------- swatches (admin) -- */

.swatch {
  width: 44px; height: 44px;
  border-radius: var(--r-card);
  border: 1px solid var(--border);
  cursor: pointer;
  padding: 0;
}
.swatch.is-active { box-shadow: 0 0 0 2px var(--ink); }

.logo-well {
  width: 96px; height: 72px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  padding: 8px;
  display: flex; align-items: center; justify-content: center;
}
.logo-well img { max-height: 100%; width: auto; }

.integration-icon {
  width: 36px; height: 36px; flex: none;
  border-radius: var(--r-card);
  background: var(--surface);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font: 600 12px/1 var(--font);
  color: var(--muted);
  text-transform: uppercase;
}

.matrix { width: 100%; border-collapse: collapse; }
.matrix th {
  font: 500 12px/1 var(--font);
  letter-spacing: 1px; text-transform: uppercase; color: var(--muted);
  text-align: left; padding: 12px 16px; background: var(--surface);
  white-space: nowrap;
}
.matrix th:not(:first-child), .matrix td:not(:first-child) { text-align: center; }
.matrix td {
  padding: 14px 16px;
  border-top: 1px solid var(--border);
  font: 400 14px/22px var(--font);
}
.matrix .yes { color: var(--red); font-weight: 500; }
.matrix .no  { color: var(--muted); }
.matrix-scroll { overflow-x: auto; }
.matrix-scroll table { min-width: 560px; }

/* ------------------------------------------------------------ responsive -- */

@media (max-width: 640px) {
  :root { --pad-page: 16px; --pad-card: 20px; --gap-section: 20px; }

  .h1 { font-size: 26px; line-height: 32px; }
  .h2 { font-size: 24px; line-height: 30px; }

  /* .tabbar is sticky, so it reserves its own space in the document flow —
     the page just needs a little breathing room below the last card. */
  .page { padding-bottom: 24px; }

  /* Top nav collapses to just the logo on mobile — no menu, no search
     icon, no avatar. The bottom tab bar is the only navigation; search
     and account actions live on the Profile tab instead. */
  .topbar__nav,
  .topbar__right,
  .topbar__mobile-actions { display: none !important; }
  .tabbar { display: flex; }

  /* Tables become stacked cards. */
  .table__head { display: none; }
  .table__row {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    border-radius: var(--r-card) !important;
    border-top: 1px solid var(--border);
    margin-bottom: 10px;
  }
  .table__row > * { flex: 1 1 auto !important; width: 100%; }
  .cell-label { display: block !important; }

  /* Side rails move below main content. Some pages size these with a
     percentage flex-basis, which (unlike a fixed px basis) never exceeds
     100% of a narrow container and so never wraps on its own — force it. */
  /* min-width:0 too: flex-basis alone doesn't stop an unshrinkable-content
     child (see .chip-row--scroll below) from forcing these wider via the
     automatic-minimum-size rule — same bug, belt and suspenders. */
  .rail     { order: 2; flex-basis: 100% !important; min-width: 0; }
  .main-col { order: 1; flex-basis: 100% !important; min-width: 0; }

  .btn--stack-block { width: 100%; }
  .post__image, .post__video { border-radius: 0; width: calc(100% + 40px); margin-left: -20px; max-height: 420px; }
  .thread { margin-left: 0; padding-left: 12px; }
  /* Segmented control stays side by side on mobile, scaled down to fit.
     The base rule's `white-space: nowrap` plus a flex item's default
     `min-width: auto` meant a long label ("Course space · all enrolled")
     could neither wrap nor shrink, forcing the page wider than the screen.
     `min-width: 0` + `white-space: normal` let each half shrink and wrap to
     a second line if needed, so both always fit whatever the screen width. */
  .segmented { width: 100%; }
  .segmented__item {
    flex: 1 1 0;
    min-width: 0;
    white-space: normal;
    text-align: center;
    padding: 8px 6px;
    font-size: 12px;
    line-height: 16px;
  }
  .hide-mobile { display: none !important; }
  .player { border-radius: 0; width: calc(100% + 32px); margin-left: -16px; }

  /*
   * Filter chips scroll sideways rather than wrapping onto extra rows,
   * which on a phone pushed the actual feed further down the page.
   *
   * `width: 100%; min-width: 0` here is load-bearing, not decoration.
   * `> .chip { flex: none }` below makes every chip unshrinkable so the
   * label text never gets squeezed — but that same unshrinkable content
   * is what CSS uses to compute this row's own "automatic minimum size"
   * as a flex item. Without an explicit min-width, that automatic minimum
   * (the summed natural width of all four chips, ~440px) overrides the
   * stretch this element would otherwise get from its column-flex parent
   * (.main-col), so instead of scrolling inside its own box, the row (and
   * everything above/below it, the whole .main-col) got forced wider than
   * the phone screen — a global page-level horizontal scroll, not just a
   * chip-row one. `min-width: 0` opts out of that automatic minimum, so
   * the overflow stays local to this row as intended.
   */
  .chip-row--scroll {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    width: 100%;
    min-width: 0;
  }
  .chip-row--scroll::-webkit-scrollbar { display: none; }
  .chip-row--scroll > .chip { flex: none; }
}

@media (min-width: 641px) {
  .show-mobile { display: none !important; }
  .cell-label  { display: none; }
}

.cell-label {
  font: 500 12px/1 var(--font);
  letter-spacing: 1px; text-transform: uppercase; color: var(--muted);
  margin-bottom: 6px;
}

@media print {
  .topbar, .tabbar, .btn, .flash-stack { display: none !important; }
}

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

/* ------------------------------------------------------------------- chat -- */

.room-row {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 4px; color: inherit;
  border-bottom: 1px solid var(--border);
}
.room-row:last-child { border-bottom: 0; }
.room-avatar {
  width: 42px; height: 42px; border-radius: 12px; flex: none;
  background: var(--ink); color: var(--white);
  display: flex; align-items: center; justify-content: center;
  font: 700 15px/1 var(--font); text-transform: uppercase;
}
.room-info { min-width: 0; flex: 1 1 auto; }
.room-name {
  display: block; font: 600 13.5px/1.4 var(--font); color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.room-preview {
  display: block; font: 400 12.5px/1.5 var(--font); color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.room-meta { text-align: right; flex: none; }
.room-time { display: block; font: 500 11px/1 var(--font); color: var(--muted); margin-bottom: 6px; }
.room-unread {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: var(--r-pill);
  background: var(--red); color: var(--white); font: 700 10.5px/1 var(--font);
}

/*
 * Room header: back to the room list + avatar + name/member-count, replacing
 * the generic breadcrumb + h1 every other page uses — a chat thread reads
 * better as an app bar than a document title.
 */
.chat-header {
  display: flex; align-items: center; gap: 12px;
  color: inherit; padding: 4px 2px;
}
.chat-header__avatar {
  width: 38px; height: 38px; border-radius: 50%; flex: none;
  background: var(--ink); color: var(--white);
  display: flex; align-items: center; justify-content: center;
  font: 700 15px/1 var(--font); text-transform: uppercase;
}
.chat-header__info { min-width: 0; }
.chat-header__name { display: block; font: 600 16px/1.3 var(--font); color: var(--ink); }
.chat-header__meta { display: block; font: 400 12px/1.4 var(--font); color: var(--muted); }

/*
 * Room thread. Fixed viewport height so the message list scrolls inside
 * itself and the composer stays pinned at the bottom — same reasoning as
 * the video player's own internal scroll areas, just for chat.
 */
.chat-room { padding: 0; display: flex; flex-direction: column; height: 64vh; min-height: 360px; }
.chat-room__scroll { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 10px; }

.chat-daydivider { display: flex; justify-content: center; margin: 6px 0; }
.chat-daydivider span {
  background: var(--surface); color: var(--muted);
  font: 500 11px/1 var(--font); padding: 5px 12px; border-radius: var(--r-pill);
}

.chat-msg { display: flex; align-items: flex-end; gap: 10px; max-width: 80%; }
.chat-msg.is-mine { align-self: flex-end; flex-direction: row-reverse; max-width: 80%; }
.chat-msg__bubble {
  background: var(--surface);
  /* One corner stays sharp — the classic "tail" cue for who's speaking,
     without an actual triangle to keep painting. */
  border-radius: var(--r-card) var(--r-card) var(--r-card) 3px;
  padding: 8px 12px; min-width: 0;
}
.chat-msg.is-mine .chat-msg__bubble {
  background: var(--red); color: var(--white);
  border-radius: var(--r-card) var(--r-card) 3px var(--r-card);
}
.chat-msg__name { display: block; font: 600 12px/1.7 var(--font); }
.chat-msg__body { font: 400 14px/1.45 var(--font); margin: 0; word-wrap: break-word; overflow-wrap: anywhere; }
.chat-msg__time {
  display: block; font: 400 10.5px/1 var(--font); color: var(--muted);
  margin-top: 4px; text-align: right;
}
.chat-msg.is-mine .chat-msg__time { color: rgba(255,255,255,.7); }

.chat-room__composer {
  display: flex; gap: 10px; align-items: center;
  padding: 14px 20px; border-top: 1px solid var(--border);
}

@media (max-width: 640px) {
  .chat-room { height: calc(100dvh - 260px); min-height: 320px; }
  .chat-msg, .chat-msg.is-mine { max-width: 88%; }
}

/* Admin > Chat room "Add members" live-search dropdown. */
.autocomplete-menu {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 10;
  background: var(--white); border: 1px solid var(--border); border-radius: var(--r-card);
  box-shadow: 0 10px 24px rgba(18, 33, 48, 0.12);
  max-height: 280px; overflow-y: auto;
  padding: 6px;
}
.autocomplete-menu__row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px; border-radius: var(--r-small);
  cursor: pointer; width: 100%; background: none; border: 0; text-align: left;
}
.autocomplete-menu__row:hover,
.autocomplete-menu__row:focus-visible { background: var(--surface); }
.autocomplete-menu__meta { font: 400 12px/1.4 var(--font); color: var(--muted); }
.autocomplete-menu__empty { padding: 10px 8px; font: 400 13px/1.4 var(--font); color: var(--muted); }
