/* ============================================================
   MediMeet meeting pages (Plesk): room list (index.html) and
   room.html (pre-join + in-meeting).
   UI-5 (READY-TICKETS §6.57): one brand everywhere. Every colour,
   shadow and radius comes from brand/tokens.css, a byte-for-byte
   copy of the dashboard's file; the names below are this sheet's
   aliases onto those tokens and hold no literal of their own
   (test/ui-5-brand.test.js). The typeface is self-hosted Manrope
   from fonts/manrope/ on this origin; no external font or asset.
   ============================================================ */
@import url("brand/tokens.css?v=13");

:root {
  /* ground + ink */
  --page:        var(--bg);
  --surface:     var(--panel);
  --ink-soft:    var(--muted);
  --field:       var(--head);
  --field-line:  var(--line);

  /* the text wordmark, until the logo image replaces it (HTML-SPEC.md §1.3) */
  --wm-a:        var(--accent);
  --wm-b:        var(--ink);
  --wm-ai:       var(--accent);

  /* room tiles: --room-hr … --room-sleep and --room-custom are the shared tokens */
  --room:        var(--room-hr);   /* per-tile override */

  /* actions */
  --btn:         var(--accent);
  --btn-ink:     var(--accent-ink);

  --r-sm: var(--radius-sm);
  --r-md: var(--radius-md);
  --r-lg: var(--radius-lg);

  --sans: var(--font-sans);
  --serif: var(--font-sans);
}

* { box-sizing: border-box; }

/* the pages swap panels with the hidden attribute — it has to beat
   the display values set further down */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--page);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

a { color: var(--accent); }

:where(a, button, input):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

/* ---------- wordmark ---------- */
.wm { display: flex; align-items: baseline; gap: 7px; margin: 0; }
.wm-name {
  font-family: var(--serif);
  font-size: 27px; line-height: 34px; font-weight: 600; letter-spacing: -.015em;
  background: linear-gradient(92deg, var(--wm-a), var(--wm-b));
  -webkit-background-clip: text; background-clip: text;
  color: transparent; -webkit-text-fill-color: transparent;
}
.wm-dash { font-size: 20px; font-weight: 400; color: var(--wm-ai); opacity: .6; }
.wm-ai { font-size: 19px; font-weight: 700; letter-spacing: .08em; color: var(--wm-ai); }
.wm.sm .wm-name { font-size: 19px; line-height: 24px; }
.wm.sm .wm-dash { font-size: 14px; }
.wm.sm .wm-ai { font-size: 13px; }
.wm img { display: block; width: 174px; max-width: 100%; height: auto; }
.wm.sm img { width: 120px; }

/* icons */
.ico { width: 21px; height: 21px; display: block; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.ico.solid { fill: currentColor; stroke: none; }
.ico.lg { width: 44px; height: 44px; }
/* the diagonal bar that appears on a muted mic / camera button */
.ico .slash { display: none; }
.off .ico .slash { display: block; }

/* ============================================================
   index.html — room list
   ============================================================ */
.wrap { max-width: 900px; margin: 0 auto; padding: 44px 24px 64px; }

.page-head {
  padding-bottom: 26px;
  margin-bottom: 28px;
  border-bottom: 1px solid var(--line);
}
.page-head .lede {
  margin: 13px 0 0;
  font-size: 17px; line-height: 24px;
  color: var(--ink-soft);
  max-width: 42ch;
}

.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.tile {
  display: block;
  background: var(--room);
  color: var(--on-dark);
  text-decoration: none;
  border-radius: var(--r-md);
  box-shadow: var(--shadow-tile);
  padding: 22px 20px;
  min-height: 96px;
  transition: transform .12s ease, box-shadow .12s ease;
}
.tile:hover, .tile:focus-visible {
  transform: translateY(-2px);
  box-shadow: var(--shadow-tile-hover);
}
.tile h2 {
  margin: 0 0 5px;
  font-size: 20px; line-height: 24px; font-weight: 700;
  color: var(--on-dark);
}
.tile p {
  margin: 0;
  font-size: 14px; line-height: 20px;
  color: var(--on-dark);
}

.tile[data-room="hr"]      { --room: var(--room-hr); }
.tile[data-room="front"]   { --room: var(--room-front); }
.tile[data-room="back"]    { --room: var(--room-back); }
.tile[data-room="amc"]     { --room: var(--room-amc); }
.tile[data-room="billing"] { --room: var(--room-billing); }
.tile[data-room="sleep"]   { --room: var(--room-sleep); }
.tile[data-room="custom"]  { --room: var(--room-custom); position: relative; }

/* ---------- personal / custom rooms ---------- */
.custom-section { margin-top: 36px; }

.section-label {
  margin: 0 0 14px;
  font-size: 13px; font-weight: 600; letter-spacing: .03em; text-transform: uppercase;
  color: var(--ink-soft);
}
.section-hint { font-weight: 400; text-transform: none; letter-spacing: 0; }

.tile-remove {
  position: absolute; top: 10px; right: 10px;
  width: 24px; height: 24px;
  border: 0; border-radius: 999px;
  background: rgba(0, 0, 0, .18); color: var(--on-dark);
  font-size: 15px; line-height: 1;
  display: grid; place-items: center;
  cursor: pointer;
}
.tile-remove:hover { background: rgba(0, 0, 0, .32); }

.tile.add {
  background: var(--field);
  border: 1.5px dashed var(--field-line);
  box-shadow: none;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  color: var(--ink-soft);
}
.tile.add:hover, .tile.add:focus-visible {
  border-color: var(--room-custom);
  color: var(--ink);
  transform: none;
  box-shadow: none;
}
.add-label { font-size: 15px; font-weight: 600; }

.tile.add.open {
  display: flex; flex-direction: column; align-items: stretch; justify-content: center;
  gap: 8px; cursor: default;
}
.tile.add.open input {
  font: inherit; font-size: 14px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--field-line);
  border-radius: var(--r-sm);
  padding: 8px 10px;
}
.add-confirm {
  min-height: 44px;
  border: 0; border-radius: var(--r-sm);
  background: var(--accent); color: var(--accent-ink);
  font: inherit; font-size: 14px; font-weight: 600;
  padding: 8px 10px; cursor: pointer;
}
.add-confirm:hover { background: var(--accent-hover); }
.add-cancel { background: var(--field); color: var(--ink); border: 1px solid var(--field-line); }
.add-cancel:hover { background: var(--surface); }
.tile.add .add-error {
  margin: 0; font-size: 12.5px; color: var(--danger); min-height: 15px;
}

.page-foot {
  margin-top: 34px;
  font-size: 14px; line-height: 20px;
  color: var(--ink-soft);
}

/* ============================================================
   room.html — pre-join
   ============================================================ */
.prejoin { display: flex; height: 100%; background: var(--stage); }

.panel {
  width: 390px; flex: none;
  background: var(--surface);
  border-right: 1px solid var(--line);
  padding: 34px 30px;
  display: flex; flex-direction: column; gap: 18px;
  overflow-y: auto;
}
.panel h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: 31px; line-height: 1.15; font-weight: 750; letter-spacing: -.04em;
}

.backlink {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 14px; font-weight: 600;
  color: var(--ink-soft);
  text-decoration: none;
  border: 0; background: none;
  padding: 0; cursor: pointer;
}
.backlink:hover, .backlink:focus-visible { color: var(--ink); }
.backlink .ico { width: 16px; height: 16px; }
.backlink.sm { font-size: 13px; }

.roomchip {
  align-self: flex-start;
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--room); color: var(--on-dark);
  border-radius: 999px;
  padding: 6px 14px 6px 11px;
  font-size: 13px; font-weight: 600; letter-spacing: .02em;
}
.roomchip i { width: 7px; height: 7px; border-radius: 50%; background: var(--on-dark); opacity: .9; display: block; }

.field input {
  width: 100%;
  font: inherit; font-size: 15px;
  color: var(--ink);
  background: var(--field);
  border: 1px solid var(--field-line);
  border-radius: var(--r-md);
  padding: 13px 14px;
}
.field input::placeholder { color: var(--ink-soft); }

.btn-primary {
  width: 100%;
  border: 0; border-radius: 11px;
  background: var(--btn); color: var(--btn-ink);
  font: inherit; font-size: 15.5px; font-weight: 600;
  padding: 15px 16px;
  cursor: pointer;
}
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary[disabled] { opacity: .6; cursor: default; }

.ctlrow { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.ctl {
  width: 42px; height: 42px;
  border-radius: 11px;
  background: var(--field);
  border: 1px solid var(--field-line);
  color: var(--ink);
  display: grid; place-items: center;
  cursor: pointer;
}
.ctl:hover { background: var(--accent-soft); }
.ctl.off { background: var(--danger); border-color: var(--danger); color: var(--on-dark); }
.ctl.danger { background: var(--danger); border-color: var(--danger); color: var(--on-dark); margin-left: auto; }
.ctl.danger:hover { background: var(--danger-hover); }

.status {
  display: flex; align-items: center; gap: 9px;
  margin: 2px 0 0;
  font-size: 13.5px; line-height: 19px;
  color: var(--ink-soft);
}
.status i { width: 10px; height: 10px; border-radius: 50%; background: var(--ok); display: block; flex: none; }
.status[data-state="warn"] i { background: var(--danger); }

.stage { flex: 1; min-width: 0; padding: 26px; display: flex; }
.vid {
  flex: 1;
  position: relative;
  border-radius: var(--r-lg);
  background: var(--stage-tile);
  overflow: hidden;
  display: grid; place-items: center;
}
.vid video {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  transform: scaleX(-1); /* mirror the self view */
}
.vid .placeholder {
  position: relative; z-index: 1;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  color: rgba(255, 255, 255, .78);
  font-size: 14px;
}
.vid .placeholder .ico { opacity: .55; }

.pill {
  position: absolute; z-index: 2;
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--scrim); color: var(--on-dark);
  font-size: 12.5px; font-weight: 500;
  padding: 6px 11px; border-radius: 999px;
}
.pill.tl { top: 14px; left: 14px; }
.pill.bl { bottom: 14px; left: 14px; }
.pill i { width: 8px; height: 8px; border-radius: 50%; background: var(--live); display: block; }

/* ============================================================
   room.html — in meeting
   ============================================================ */
.meeting { display: flex; flex-direction: column; height: 100%; background: var(--stage); }

.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px 22px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.topbar-left { display: flex; align-items: center; gap: 18px; min-width: 0; }
.meta {
  display: flex; align-items: center; gap: 10px;
  background: var(--field);
  border: 1px solid var(--field-line);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 13px; font-weight: 600;
}
.meta .time { font-variant-numeric: tabular-nums; color: var(--ink-soft); font-weight: 500; }
.meta .ico { width: 15px; height: 15px; color: var(--ok); }
.mod-badge {
  font-size: 11px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase;
  color: var(--on-dark); background: var(--ink);
  border-radius: 999px; padding: 3px 8px;
}

.jitsi-stage {
  flex: 1; min-height: 0;
  margin: 18px 18px 0;
  border-radius: var(--r-lg);
  background: var(--stage-tile);
  overflow: hidden;
  position: relative;
  display: flex;               /* video + side panels share the row */
}
/* The video narrows when a side panel opens, so Jitsi re-flows the camera tiles
   instead of hiding them underneath. !important beats the size Jitsi sets inline. */
.jitsi-stage iframe {
  display: block; order: 0;
  flex: 1 1 0 !important; width: auto !important; min-width: 0;
  height: 100%; border: 0;
}

/* ---------- side panels (participants, breakout rooms) ---------- */
.side-panel {
  order: 1; flex: 0 0 300px; width: 300px; min-height: 0;
  position: relative;
  display: flex; flex-direction: column;
  background: var(--surface);
  border-left: 1px solid var(--line);
}
.side-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--line);
}
.side-head p { margin: 0; font-weight: 700; font-size: 15px; }
#peoplePanelCount { font-weight: 500; color: var(--ink-soft); }
.side-close {
  border: 0; background: none; border-radius: var(--r-sm);
  font-size: 20px; line-height: 1; color: var(--ink-soft);
  padding: 2px 7px; cursor: pointer;
}
.side-close:hover { color: var(--ink); background: var(--field); }

.side-tools { padding: 12px 16px 4px; display: grid; gap: 8px; }
.side-btn.invite-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 9px 12px; background: var(--accent);
}
.side-btn.invite-btn:hover { background: var(--accent-hover); }
.invite-btn .ico { width: 17px; height: 17px; }
.side-btn.invite-btn[hidden] { display: none; }
.side-search, .side-add input {
  width: 100%;
  font: inherit; font-size: 13px; color: var(--ink);
  background: var(--field);
  border: 1px solid var(--field-line); border-radius: var(--r-sm);
  padding: 8px 10px;
  -webkit-appearance: none; appearance: none;
}
.side-search:focus, .side-add input:focus { border-color: var(--accent); background: var(--surface); }

.side-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 4px 16px 12px; }
.side-empty { color: var(--ink-soft); font-size: 13px; margin: 12px 0; }

/* one person */
.person { display: flex; align-items: center; gap: 8px; min-height: 40px; padding: 3px 0; }
.av {
  flex: none; width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center;
  color: var(--on-dark); font-size: 11.5px; font-weight: 700; letter-spacing: .02em;
  margin-right: 2px;
}
.person-name {
  flex: 1; min-width: 0;
  font-size: 13.5px; font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.person-name .you { color: var(--ink-soft); font-weight: 400; }

/* camera / mic / screen: teal when on, grey with a slash when off */
.st, .pbtn {
  flex: none; width: 28px; height: 28px;
  display: grid; place-items: center;
  border-radius: var(--r-sm);
}
.st .ico, .pbtn .ico { width: 17px; height: 17px; }
.st.on, .pbtn.on { color: var(--accent); }
.st.off, .pbtn.off { color: var(--muted); }
.st.share { color: var(--accent); }
.pbtn { border: 0; background: none; padding: 0; cursor: pointer; color: var(--ink-soft); }
.pbtn:hover { background: var(--field); }
.pbtn.danger { color: var(--muted); }
.pbtn.danger:hover { color: var(--danger); background: var(--danger-bg); }
.slot { flex: none; width: 28px; }

/* breakout: the room you're in */
.leave-btn {
  width: 100%; margin: 10px 0 2px;
  border: 0; border-radius: var(--r-md);
  background: var(--danger); color: var(--on-dark);
  font: inherit; font-size: 13.5px; font-weight: 600;
  padding: 10px; cursor: pointer;
}
.leave-btn:hover { background: var(--danger-hover); }

/* breakout: every other room */
.rooms { margin-top: 14px; border-top: 1px solid var(--line); }
.rooms[hidden] { display: none; }
.rooms-note { margin: 10px 0 2px; font-size: 12px; line-height: 17px; color: var(--ink-soft); }
.room-sec { border-bottom: 1px solid var(--line); }
.room-head { display: flex; align-items: center; gap: 4px; background: var(--field); margin: 0 -16px; padding: 6px 12px 6px 16px; }
.room-toggle {
  flex: 1; min-width: 0;
  display: flex; align-items: center; gap: 6px;
  border: 0; background: none; padding: 4px 0;
  font: inherit; color: var(--ink); text-align: left; cursor: pointer;
}
.room-toggle .ico { width: 15px; height: 15px; color: var(--ink-soft); transition: transform .15s ease; }
.room-sec.collapsed .room-toggle .ico { transform: rotate(-90deg); }
.room-name { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.room-count { color: var(--ink-soft); font-weight: 500; }
.join-btn {
  flex: none;
  border: 0; border-radius: var(--r-sm);
  background: var(--accent); color: var(--accent-ink);
  font: inherit; font-size: 12.5px; font-weight: 600;
  padding: 6px 13px; cursor: pointer;
}
.join-btn:hover { background: var(--accent-hover); }
.room-list { padding: 4px 0 6px 21px; }
.room-sec.collapsed .room-list { display: none; }
.room-list .person { min-height: 34px; }
.room-list .av { width: 26px; height: 26px; font-size: 10.5px; }
.room-empty { margin: 0; padding: 0 0 10px 21px; font-size: 12.5px; color: var(--ink-soft); }
.room-admin { display: grid; gap: 8px; margin-top: 14px; }
.room-admin[hidden], .side-foot[hidden], .side-hint[hidden] { display: none; }
.side-hint { margin: 14px 0 4px; font-size: 12px; line-height: 17px; color: var(--ink-soft); }

/* "⋯" menu for a person or a room */
.pp-menu {
  position: absolute; z-index: 40; min-width: 190px; max-width: 250px;
  max-height: 60%; overflow-y: auto;
  padding: 6px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r-md);
  box-shadow: var(--shadow-bar);
}
.pp-menu[hidden] { display: none; }
.pm-head { margin: 6px 10px 2px; font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-soft); }
.pm-item {
  display: block; width: 100%; text-align: left;
  border: 0; background: none; border-radius: var(--r-sm);
  font: inherit; font-size: 13px; color: var(--ink);
  padding: 7px 10px; cursor: pointer;
}
.pm-item:hover, .pm-item:focus-visible { background: var(--field); }
.pm-item.indent { padding-left: 20px; }
.pm-item small { display: block; font-size: 11.5px; color: var(--ink-soft); margin-top: 1px; }
.pm-item.danger { color: var(--danger); }
.pm-sep { height: 1px; margin: 5px 4px; background: var(--line); }

.side-foot {
  flex: none;
  display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px;
  padding: 12px 16px 14px;
  border-top: 1px solid var(--line);
}
.side-foot-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.side-add { display: flex; gap: 8px; }
.side-add input { flex: 1 1 0; min-width: 0; width: 0; }
.side-btn {
  border: 0; border-radius: var(--r-sm);
  background: var(--accent); color: var(--accent-ink);
  font: inherit; font-size: 13px; font-weight: 600;
  padding: 8px 12px; cursor: pointer; white-space: nowrap;
}
.side-btn:hover { background: var(--accent-hover); }
.side-btn.quiet { background: var(--surface); color: var(--ink); border: 1px solid var(--field-line); }
.side-btn.quiet:hover { background: var(--field); }

.stage-message {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  padding: 24px; text-align: center;
  color: rgba(255, 255, 255, .82); font-size: 14px; line-height: 21px;
}
.stage-message a { color: var(--stage-link); }

.bar { display: flex; justify-content: center; padding: 16px 18px 18px; }
.bar-in {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 9px 12px;
  box-shadow: var(--shadow-bar);
}
.tb {
  width: 44px; height: 44px;
  border: 0; border-radius: 11px;
  background: transparent; color: var(--ink);
  display: grid; place-items: center;
  cursor: pointer; position: relative;
}
.tb:hover { background: var(--accent-soft); }
.tb.off { background: var(--danger); color: var(--on-dark); }
.tb.active { background: var(--field); }
.tb.hangup { background: var(--danger); color: var(--on-dark); width: 60px; }
.tb.hangup:hover { background: var(--danger-hover); }
.tb .badge {
  position: absolute; top: 4px; right: 4px;
  min-width: 17px; height: 17px; padding: 0 4px;
  border-radius: 999px;
  background: var(--accent); color: var(--accent-ink);
  font-size: 10.5px; font-weight: 700;
  display: grid; place-items: center;
}
.sep { width: 1px; height: 26px; background: var(--line); margin: 0 4px; }

/* ---------- split camera button + dropdown (Zoom-style) ---------- */
.tb-group { position: relative; display: inline-flex; align-items: center; }
.tb-caret {
  width: 18px; height: 44px;
  border: 0; background: transparent;
  color: var(--ink-soft);
  display: grid; place-items: center;
  cursor: pointer; border-radius: 0 11px 11px 0;
  padding: 0;
}
.tb-caret svg { width: 12px; height: 12px; display: block; }
.tb-caret:hover, .tb-caret.active { background: var(--accent-soft); color: var(--ink); }

.cam-menu {
  position: absolute; bottom: calc(100% + 10px); left: 50%; transform: translateX(-50%);
  min-width: 230px; max-width: 280px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-bar);
  padding: 8px 0;
  z-index: 60;
  max-height: 320px; overflow-y: auto;
}
.cam-menu-label {
  margin: 4px 0 4px;
  padding: 0 12px;
  font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  color: var(--ink-soft);
}
.cam-menu-item {
  display: block; width: 100%; text-align: left;
  border: 0; background: none;
  font: inherit; font-size: 13.5px; color: var(--ink);
  padding: 8px 12px; cursor: pointer;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cam-menu-item:hover { background: var(--field); }
.cam-menu-item.on { font-weight: 700; }
.cam-menu-item.on::before { content: '\2713\00a0'; color: var(--ok); }
.cam-menu-sep { height: 1px; background: var(--line); margin: 6px 0; }

.bg-thumbs { display: flex; gap: 6px; flex-wrap: wrap; padding: 6px 12px 2px; }
.bg-thumb {
  width: 46px; height: 32px;
  border: 2px solid var(--field-line); border-radius: var(--r-sm);
  background-size: cover; background-position: center;
  cursor: pointer; padding: 0;
}
.bg-thumb.on { border-color: var(--ok); }
.cam-menu-empty { margin: 4px 0; padding: 0 12px; font-size: 13px; color: var(--ink-soft); }

/* mic test meter */
.mic-test-hint {
  margin: 2px 0 6px; padding: 0 12px;
  font-size: 12px; color: var(--ink-soft);
}
.mic-meter {
  height: 8px; margin: 0 12px 8px;
  background: var(--field);
  border: 1px solid var(--field-line);
  border-radius: 999px;
  overflow: hidden;
}
.mic-meter span {
  display: block; height: 100%; width: 0%;
  background: var(--ok);
  transition: width .08s linear;
}

/* ---------- tooltips ---------- */
.tb[data-tip], .tb-caret[data-tip] { position: relative; }
.tb[data-tip]::after, .tb-caret[data-tip]::after {
  content: attr(data-tip);
  position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%);
  background: var(--ink); color: var(--on-dark);
  font-size: 12px; font-weight: 500; line-height: 1.3;
  padding: 6px 10px; border-radius: var(--r-sm);
  white-space: nowrap;
  opacity: 0; pointer-events: none;
  transition: opacity .14s ease;
  z-index: 70;
}
.tb[data-tip]:hover::after, .tb-caret[data-tip]:hover::after,
.tb[data-tip]:focus-visible::after, .tb-caret[data-tip]:focus-visible::after {
  opacity: 1;
}

.toast {
  position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%);
  background: var(--ink); color: var(--on-dark);
  font-size: 13px; padding: 9px 15px; border-radius: 999px;
  box-shadow: var(--shadow-bar);
  opacity: 0; pointer-events: none; transition: opacity .18s ease;
  z-index: 50;
}
.toast.show { opacity: 1; }

/* ============================================================
   narrow screens
   ============================================================ */
@media (max-width: 860px) {
  .grid { grid-template-columns: repeat(2, 1fr); }
  .prejoin { flex-direction: column; height: auto; min-height: 100%; }
  .panel { width: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .stage { min-height: 260px; padding: 18px; }
  .jitsi-stage { margin: 12px 12px 0; }
  /* too narrow to sit beside the video: the panel slides over it instead */
  .side-panel {
    position: absolute; top: 0; right: 0; bottom: 0; z-index: 30;
    width: min(320px, 100%);
    box-shadow: var(--shadow-bar);
  }
}

@media (max-width: 560px) {
  .wrap { padding: 32px 16px 48px; }
  .grid { grid-template-columns: 1fr; }
  .panel { padding: 26px 18px; }
  .bar { padding: 12px; }
  .topbar { flex-wrap: wrap; padding: 12px 14px; }
  .tb { width: 40px; height: 40px; }
}

/* =========================================================
   Sign-in (MediMeet account) — room list and join screen
   ========================================================= */
.linkbtn {
  border: 0; background: none; padding: 0;
  font: inherit; font-weight: 600; color: var(--btn);
  text-decoration: underline; text-underline-offset: 2px;
  cursor: pointer;
}
.linkbtn:hover { color: var(--accent-hover); }

/* room list */
.page-head .who { margin: 12px 0 0; font-size: 14px; color: var(--ink-soft); }
.page-head .who strong { color: var(--ink); font-weight: 600; }
.page-head .who .linkbtn { margin-left: 8px; }
.load-msg { font-size: 15px; color: var(--ink-soft); margin: 0 0 28px; }

.signin-card {
  max-width: 420px;
  display: flex; flex-direction: column; gap: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 28px 26px;
  margin-bottom: 32px;
}
.signin-card h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: 26px; line-height: 1.2; font-weight: 750; letter-spacing: -.04em;
}
.signin-note { margin: 0; font-size: 14px; line-height: 20px; color: var(--ink-soft); }
.signin-note.small { font-size: 13px; }
.signin-note a { color: var(--ink); }
.si-error { margin: 0; min-height: 0; font-size: 13.5px; line-height: 19px; color: var(--danger); }
.si-error:empty { display: none; }

/* join screen */
.pj-msg { margin: 0; font-size: 14.5px; line-height: 21px; color: var(--ink-soft); }
.pj-signin, .pj-join { display: flex; flex-direction: column; gap: 14px; }
.pj-signin[hidden], .pj-join[hidden], .signin-card[hidden] { display: none; }
.pj-note { margin: 0; font-size: 14px; color: var(--ink-soft); }
.pj-who { margin: 0; font-size: 13.5px; color: var(--ink-soft); }
.pj-who strong { color: var(--ink); font-weight: 600; }
.pj-who .linkbtn { margin-left: 6px; }
.field input[readonly] { color: var(--ink-soft); cursor: default; }
.pj-note a, .signin-note a { color: var(--btn); font-weight: 600; }

/* Codex fix - owner review: Jeremy P-LIVE password visibility only. */
/* Show / hide password: the eye sits inside the right edge of the field */
.pw-wrap { position: relative; display: block; }
.pw-wrap input { padding-right: 50px; }
.pw-eye {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  display: flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; padding: 0;
  border: 0; border-radius: 9px; background: transparent; color: var(--ink-soft); cursor: pointer;
}
.pw-eye:hover { background: var(--accent-soft); color: var(--ink); }
.pw-eye svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* UI-14: approved wordmark starts at 32.5% of the exact transparent logo width. */
.practice-brand { display: inline-flex; flex-direction: column; align-items: stretch; width: var(--practice-logo-width,174px); max-width: 100%; flex-shrink: 0; }
.practice-brand img { display: block; width: 100%; height: auto; }
.practice-subtitle { display: block; margin: var(--practice-subtitle-gap) 0 0; padding-left: var(--practice-wordmark-start); color: var(--muted); font: 500 var(--practice-subtitle-size)/1.25 var(--font-sans); overflow-wrap: anywhere; text-align: left; }
.login-story > .practice-brand { --practice-logo-width: 280px; }
.brand-header .practice-brand { vertical-align: middle; }
.wm:has(> .practice-brand) { display: block; margin: 0; }
.app-header a:has(> .practice-brand) { min-width: 0; max-width: 65%; }

/* UI-13: compact full-height meeting workspace and labelled, colourful controls. */
.meeting { height: 100dvh; }
.topbar { min-height: 54px; padding: 8px 16px; gap: 16px; flex-wrap: wrap; }
.topbar-left { flex: 0 0 auto; gap: 16px; }
.topbar-left .wm.sm .practice-brand { --practice-logo-width: 168px; }
.topbar-left .wm.sm img { width: 100%; }
.meta { background: transparent; border: 0; border-radius: 0; padding: 0; flex: 1; min-width: 0; }
#metaRoom { font-size: 17px; font-weight: 800; overflow-wrap: anywhere; }
.meta .time { margin-left: auto; }
.mod-badge { background: var(--violet); padding: 5px 10px; }
.meta .ico { width: 24px; height: 24px; }
.jitsi-stage { margin: 6px 8px 0; border-radius: var(--radius-md); }
.bar { padding: 8px 12px 6px; background: var(--surface); border-top: 1px solid var(--line); }
.bar-in { border: 0; border-radius: 0; box-shadow: none; background: transparent; padding: 0; gap: 14px; }
.tb { width: 52px; height: 52px; margin-bottom: 19px; border-radius: var(--radius-lg); background: var(--head); }
.tb .ico { width: 27px; height: 27px; }
.tb[data-label]::after { content: attr(data-label); position: absolute; top: 56px; bottom: auto; left: 50%; transform: translateX(-50%); font: 700 12px/16px var(--sans); white-space: nowrap; color: var(--ink); background: none; opacity: 1; padding: 0; border-radius: 0; transition: none; }
.tb[data-tip]::before { content: attr(data-tip); position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--on-dark); padding: 6px 10px; border-radius: var(--radius-sm); font: 600 12px/1.3 var(--sans); white-space: nowrap; opacity: 0; pointer-events: none; z-index: 70; }
.tb[data-tip]:hover::before, .tb[data-tip]:focus-visible::before { opacity: 1; }
.tb:hover { filter: brightness(.95); }
.tb.active { box-shadow: inset 0 0 0 2px currentColor; }
#tbMic { color: var(--teal); background: var(--teal-soft); }
#tbCam, #tbChat, #tbPeople, #tbInvite { color: var(--accent); background: var(--accent-soft); }
#tbShare, #tbWhiteboard, #tbRequests { color: var(--violet); background: var(--violet-soft); }
#tbHand { color: var(--amber); background: var(--amber-soft); }
#tbBoard { color: var(--cyan); background: var(--cyan-soft); }
.tb.off, #tbMic.off, #tbCam.off { color: var(--on-dark); background: var(--danger); }
.tb.hangup { width: 52px; color: var(--on-dark); background: var(--leave); }
.tb.hangup:hover { background: var(--leave-hover); }
.tb.hangup .ico { transform: rotate(35deg); }
.tb-group { padding-right: 0; }
.tb-caret { position: absolute; right: -5px; top: 0; width: 24px; height: 44px; border-radius: var(--radius-sm); color: var(--ink); }
.tb-group .tb { padding-right: 10px; }
.sep { align-self: flex-start; margin-top: 12px; }
.side-close { width: 44px; height: 44px; padding: 0; }
.side-head { min-height: 58px; padding: 6px 14px; }
.side-head p { font-size: 16px; }
.side-panel { flex-basis: 310px; width: 310px; }
.side-btn, .side-search, .side-add input { min-height: 44px; border-radius: var(--radius-sm); }
.meeting-chat { order: -1; width: 310px; flex-basis: 310px; border-left: 0; border-right: 1px solid var(--line); background: var(--chat-surface); }
.chat-tabs { display: flex; padding: 6px 10px; gap: 8px; border-bottom: 1px solid var(--line); }
.chat-tabs button { flex: 1; min-height: 44px; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--ink-soft); display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: 700 14px var(--sans); }
.chat-tabs button[aria-selected=true] { color: var(--accent); background: var(--accent-soft); }
.chat-tabs .ico { width: 24px; height: 24px; }
.chat-tools { display: flex; gap: 6px; }
.chat-icon { width: 44px; height: 44px; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--accent); display: grid; place-items: center; cursor: pointer; }
.chat-icon .ico { width: 26px; height: 26px; }
.chat-search { padding: 6px 12px; }
.chat-search input { width: 100%; min-height: 44px; }
.chat-body { flex: 1; min-height: 0; overflow-y: auto; padding: 16px; }
.chat-empty { color: var(--ink-soft); text-align: center; padding: 60px 12px; }
.chat-empty strong { color: var(--ink); display: block; }
.chat-message { padding: 10px 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; white-space: pre-wrap; }
.chat-message strong { display: block; color: var(--ink); }
.chat-message small { color: var(--ink-soft); }
.chat-compose { padding: 12px; margin-top: auto; border-top: 1px solid var(--line); }
.chat-recipient-row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.chat-recipient-row label { flex: none; font: 700 14px var(--sans); color: var(--ink-soft); }
.chat-compose .chat-recipient-row select { width: auto; flex: 1; min-width: 0; max-width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid var(--accent); border-radius: var(--radius-lg); background: var(--accent-soft); color: var(--accent); font-weight: 700; cursor: pointer; text-overflow: ellipsis; }
.chat-compose .chat-recipient-row select[data-private=true] { background: var(--violet-soft); color: var(--violet); border-color: var(--violet); }
.chat-compose .chat-recipient-row select:disabled { opacity: .65; cursor: default; }
.chat-recipient-context { margin: 4px 0 8px; color: var(--ink-soft); font: 600 12px/1.4 var(--sans); overflow-wrap: anywhere; }
.chat-compose select, .chat-input-row input, .chat-search input { font: 500 14px/1.4 var(--sans); padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink); }
.chat-empty .ico { display: block; width: 44px; height: 44px; margin: 0 auto 16px; color: var(--violet); }
.chat-input-row { display: flex; align-items: center; gap: 6px; }
.chat-input-row input { width: 0; flex: 1; min-height: 44px; }
.emoji-wrap { position: relative; }
.emoji-tray { position: absolute; bottom: calc(100% + 4px); left: 0; z-index: 12; display: flex; gap: 4px; padding: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-bar); }
.emoji-tray button { flex: none; width: 40px; height: 44px; padding: 0; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--ink); font-size: 28px; cursor: pointer; }
.emoji-tray button:hover, .chat-icon:hover { background: var(--accent-soft); }
.chat-send { background: var(--accent); color: var(--on-dark); }
.chat-notice { font-size: 13px; color: var(--ink-soft); margin: 6px 0 0; overflow-wrap: anywhere; }
.chat-error { color: var(--danger); }
@media (max-width: 1100px) {
  .bar-in { gap: 8px; }
  .tb { width: 44px; height: 44px; }
  .tb[data-label]::after { top: 48px; font-size: 11px; }
  .tb.hangup { width: 44px; }
  .side-panel { flex-basis: 280px; width: 280px; }
}
@media (max-width: 700px) {
  .topbar { padding: 6px 10px; }
  .topbar-left { gap: 10px; }
  .meta { flex-basis: 100%; }
  .jitsi-stage { margin: 4px 4px 0; flex-direction: column; overflow-y: auto; }
  /* Keep the call visible above People, Board and Requests on phones. The stage
     scrolls when a short viewport cannot fit the video and the open panel. */
  .jitsi-stage iframe { flex: 1 0 220px !important; width: 100% !important; height: auto; min-height: 220px; }
  .side-panel:not(.meeting-chat) {
    position: relative; inset: auto; flex: 0 0 280px; width: 100%; min-height: 180px;
    border-left: 0; border-top: 1px solid var(--line); box-shadow: none;
  }
  .meeting-chat { position: absolute; inset: 0; width: 100%; z-index: 8; border: 0; }
  .bar { padding: 6px 4px; }
  .bar-in { gap: 4px; row-gap: 4px; }
  .tb { width: 44px; height: 44px; margin-bottom: 15px; }
  .tb[data-label]::after { top: 46px; font-size: 10px; line-height: 14px; }
  .tb-group { padding-right: 24px; }
  .tb-group .tb { padding-right: 0; }
  .tb-caret { right: 0; width: 24px; }
  .sep { display: none; }
  /* Labels below controls replace hover tooltips on narrow screens; prevent off-screen bubbles. */
  .tb[data-tip]::before, .tb-caret[data-tip]::after { display: none; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; } }

/* Keep each brand lockup and header control aligned; wrap whole groups on narrow phones. */
.topbar { align-items: center; }
.topbar-left { align-items: center; }
@media (max-width: 560px) {
  .topbar { gap: 8px; }
  .topbar-left { gap: 8px; flex-wrap: wrap; max-width: 100%; }
}

/* Incoming messages stay inside the video stage, above the separate call toolbar. */
.chat-popup { position:absolute; bottom:12px; right:12px; z-index:12; max-width:min(360px,calc(100% - 24px)); padding:12px 16px; border:1px solid var(--line); border-radius:var(--radius-sm); background:var(--surface); color:var(--ink); box-shadow:var(--shadow-bar); font:inherit; font-size:14px; line-height:1.4; text-align:left; overflow-wrap:anywhere; cursor:pointer; }
.chat-popup:focus-visible { outline:3px solid var(--accent); outline-offset:2px; }
