/* Meeting library: filters on the left, results on the right, detail modal. */

.library-wrap {
  max-width: 1220px;
  margin: 0 auto;
  padding: 0 1.5rem 0.5rem;
  scroll-margin-top: 1rem;
}

.library {
  padding: 1.3rem 1.4rem 1.5rem;
}

.library-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.1rem;
}

.library-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-left: auto;
}

.library-close {
  flex-shrink: 0;
  font-size: 22px;
}

.library-head .eyebrow {
  color: var(--ml-amber);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .14em;
}

.library-head h2 {
  margin: .25rem 0 .2rem;
  font-size: clamp(20px, 2vw, 26px);
  line-height: 1.05;
}

.library-stats {
  margin: 0;
  color: var(--ml-text-dim);
  font-size: 12px;
}

.library-body {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 1.4rem;
  align-items: start;
}

@media (max-width: 1099px) {
  .library-body { grid-template-columns: 1fr; }
}

@media (min-width: 761px) and (max-width: 899px) {
  .library-wrap {
    padding-left: 0.85rem;
    padding-right: 0.85rem;
  }
}

@media (min-width: 1100px) and (max-width: 1279px) {
  .library-wrap {
    padding-left: 1.15rem;
    padding-right: 1.15rem;
  }
}

/* ---- filters column ---- */
.library-filters {
  display: grid;
  gap: 0.55rem;
  align-content: start;
}

.library-filters .field-label { margin-top: 0.6rem; }
.library-filters .field-label:first-child { margin-top: 0; }

.filter-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-top: 0.6rem;
}
.filter-head .field-label { margin-top: 0; }

.link-btn {
  border: 0;
  background: none;
  color: var(--ml-blue);
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  padding: 0;
}
.link-btn:hover { color: var(--ml-amber); }

.search-box {
  position: relative;
  display: flex;
  align-items: center;
}
.search-box svg {
  position: absolute;
  left: 0.85rem;
  width: 16px;
  height: 16px;
  color: var(--ml-text-faint);
  pointer-events: none;
}
.search-box .input {
  width: 100%;
  padding-left: 2.4rem;
}
.search-box .input::-webkit-search-cancel-button { filter: invert(1) opacity(.6); }

/* chips */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.chips-inline { margin-top: 0.45rem; }
.chips-empty {
  color: var(--ml-text-faint);
  font-size: 12px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.32rem 0.7rem;
  border: 1px solid var(--ml-line-strong);
  border-radius: var(--ml-radius-pill);
  background: rgb(10 15 31 / 0.5);
  color: var(--ml-text-dim);
  font-family: var(--ml-font);
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  transition: border-color .15s, color .15s, background .15s;
}
.chip:hover { border-color: var(--ml-blue); color: var(--ml-paper); }
.chip.is-active {
  background: var(--ml-amber);
  border-color: var(--ml-amber);
  color: var(--ml-navy);
}
.chip.chip-static { cursor: default; }
.chip.chip-static:hover { border-color: var(--ml-line-strong); color: var(--ml-text-dim); }
.chip-count {
  font-size: 10px;
  font-weight: 800;
  opacity: .7;
}

/* ---- calendar ---- */
.cal {
  border: 1px solid var(--ml-line);
  border-radius: var(--ml-radius);
  background: rgb(10 15 31 / 0.45);
  padding: 0.75rem 0.8rem 0.6rem;
}

.cal-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.cal-btn {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 1px solid var(--ml-line-strong);
  border-radius: 50%;
  background: transparent;
  color: var(--ml-paper);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}
.cal-btn:hover { border-color: var(--ml-blue); color: var(--ml-blue); }

.cal-month {
  border: 0;
  background: none;
  color: var(--ml-paper);
  font-family: var(--ml-font-display);
  font-weight: 700;
  font-size: 14px;
  letter-spacing: .03em;
  cursor: pointer;
}
.cal-month:hover { color: var(--ml-amber); }

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}

.cal-dow {
  text-align: center;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .06em;
  color: var(--ml-text-faint);
  padding-bottom: 0.25rem;
}

.cal-day {
  position: relative;
  aspect-ratio: 1;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ml-paper);
  font-family: var(--ml-font);
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}
.cal-day:hover { background: rgb(55 144 228 / 0.22); }
.cal-day.is-out { color: var(--ml-text-faint); font-weight: 600; }
.cal-day.is-future { color: var(--ml-text-faint); }
.cal-day.is-today { box-shadow: inset 0 0 0 1px var(--ml-blue); }
.cal-day.in-range { background: rgb(255 189 2 / 0.16); border-radius: 0; }
.cal-day.range-start { border-radius: 8px 0 0 8px; }
.cal-day.range-end { border-radius: 0 8px 8px 0; }
.cal-day.range-start.range-end { border-radius: 8px; }
.cal-day.range-start,
.cal-day.range-end {
  background: var(--ml-amber);
  color: var(--ml-navy);
}
.cal-day.range-start .cal-dot,
.cal-day.range-end .cal-dot { background: var(--ml-navy); box-shadow: none; }

.cal-dot {
  position: absolute;
  left: 50%;
  bottom: 4px;
  width: 5px;
  height: 5px;
  margin-left: -2.5px;
  border-radius: 50%;
  background: var(--ml-mint);
  box-shadow: 0 0 6px var(--ml-mint);
}

.cal-range {
  margin: 0.55rem 0 0;
  font-size: 12px;
  font-weight: 700;
  color: var(--ml-amber-soft);
}
.cal-hint {
  margin: 0.15rem 0 0;
  font-size: 11px;
  color: var(--ml-text-faint);
}

/* ---- results ---- */
.library-results { min-width: 0; }

.results-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem 0.75rem;
  margin-bottom: 0.7rem;
  font-size: 13px;
  font-weight: 700;
  color: var(--ml-text-dim);
}

.active-filters { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.active-filter {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.25rem 0.6rem;
  border: 1px solid rgb(255 189 2 / 0.45);
  border-radius: var(--ml-radius-pill);
  background: rgb(255 189 2 / 0.12);
  color: var(--ml-amber-soft);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}
.active-filter .x { opacity: .7; font-size: 14px; line-height: 1; }
.active-filter:hover { border-color: var(--ml-amber); }

.results {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.55rem;
}

.results-empty {
  padding: 1.2rem 1rem;
  border: 1px dashed var(--ml-line);
  border-radius: var(--ml-radius);
  color: var(--ml-text-faint);
  font-size: 13px;
}

.result {
  display: grid;
  grid-template-columns: 58px 1fr;
  gap: 0.9rem;
  padding: 0.8rem 0.95rem;
  border: 1px solid var(--ml-line);
  border-radius: var(--ml-radius);
  background: rgb(10 15 31 / 0.45);
  cursor: pointer;
  transition: border-color .15s, transform .15s, background .15s;
}
.result:hover,
.result:focus-visible {
  border-color: rgb(55 144 228 / 0.55);
  background: rgb(55 144 228 / 0.08);
  outline: none;
}

.result-when {
  display: grid;
  justify-items: center;
  align-content: start;
  gap: 0.05rem;
  padding: 0.35rem 0;
  border-right: 1px solid var(--ml-line);
  line-height: 1.1;
}
.result-day {
  font-family: var(--ml-font-display);
  font-size: 22px;
  font-weight: 700;
  color: var(--ml-paper);
}
.result-mon {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ml-amber);
}
.result-time {
  margin-top: 0.25rem;
  font-size: 10px;
  color: var(--ml-text-faint);
  font-variant-numeric: tabular-nums;
}

.result-main { min-width: 0; }
.result-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
}
.result-title {
  margin: 0;
  font-size: 15px;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.result-meta {
  margin-top: 0.15rem;
  font-size: 12px;
  color: var(--ml-text-dim);
}
.result-snippet {
  margin: 0.45rem 0 0;
  font-size: 13px;
  line-height: 1.45;
  color: var(--ml-text-dim);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

mark {
  background: rgb(255 189 2 / 0.32);
  color: var(--ml-paper);
  border-radius: 3px;
  padding: 0 2px;
}

#lib-more { margin-top: 0.8rem; width: 100%; }

/* ---- detail modal ---- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 1.25rem;
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgb(3 8 20 / 0.72);
  backdrop-filter: blur(6px);
}
body.modal-open { overflow: hidden; }

.modal-card {
  position: relative;
  width: min(960px, 100%);
  /* Nearly the full window so the transcript fills the scroll region instead
     of a short box that only shows a few lines under the sticky player. */
  max-height: 96vh;
  height: 96vh;
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
  box-shadow: var(--ml-shadow-lift), var(--ml-shadow-glow);
}

.modal-head {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem 1.4rem 0.9rem;
  border-bottom: 1px solid var(--ml-line);
  background:
    radial-gradient(80% 120% at 0% 0%, rgb(55 144 228 / 0.18), transparent 60%),
    var(--ml-navy-800);
}
.modal-head-main { min-width: 0; }
.modal-head h3 {
  margin: 0.5rem 0 0.25rem;
  font-size: 20px;
  line-height: 1.15;
}
.modal-meta {
  margin: 0 0 0.5rem;
  color: var(--ml-text-dim);
  font-size: 13px;
}
.modal-close { flex-shrink: 0; font-size: 22px; }

.modal-tabs {
  flex: 0 0 auto;
  display: flex;
  gap: 0.25rem;
  padding: 0.6rem 1.4rem 0;
  border-bottom: 1px solid var(--ml-line);
}
.modal-tab {
  border: 0;
  border-bottom: 2px solid transparent;
  background: none;
  color: var(--ml-text-dim);
  font-family: var(--ml-font);
  font-weight: 700;
  font-size: 13px;
  padding: 0.5rem 0.8rem 0.6rem;
  cursor: pointer;
}
.modal-tab.is-active {
  color: var(--ml-paper);
  border-bottom-color: var(--ml-amber);
}

/* ---- scheduled from this call ---- */
.scheduled {
  flex: 0 0 auto;
  margin: 0.7rem 1.4rem 0;
  padding: 0.55rem 0.85rem;
  border-radius: 10px;
  border: 1px solid var(--ml-line);
  border-left: 3px solid var(--ml-mint);
  background: rgb(132 235 180 / 0.06);
  font-size: 13px;
}
.scheduled.is-pending {
  border-left-color: var(--ml-amber);
  background: rgb(255 189 2 / 0.06);
}
.scheduled-head {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  cursor: pointer;
  list-style: none;
  color: var(--ml-text-soft);
}
.scheduled-head::-webkit-details-marker { display: none; }
.scheduled-head::after {
  content: "▾";
  margin-left: auto;
  color: var(--ml-text-faint);
}
.scheduled:not([open]) .scheduled-head::after { content: "▸"; }
.scheduled-sum { font-weight: 700; }
.scheduled-list {
  list-style: none;
  margin: 0.5rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.3rem;
  max-height: 9.5rem;
  overflow-y: auto;
}
.scheduled-item {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  flex-wrap: wrap;
}
.scheduled-kind {
  flex: 0 0 auto;
  min-width: 4.2rem;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ml-text-faint);
}
.scheduled-meeting .scheduled-kind { color: var(--ml-mint); }
.scheduled-title { color: var(--ml-paper); flex: 1 1 14rem; }
.scheduled-when { color: var(--ml-text-dim); font-variant-numeric: tabular-nums; }
.scheduled-link { color: var(--ml-blue); font-weight: 700; text-decoration: none; }
.scheduled-link:hover { text-decoration: underline; }
.scheduled-foot { margin-top: 0.15rem; }

/* Everything below the tabs scrolls. The player sits above this region so a
   tall video can never squeeze the transcript into a couple of lines. */
.modal-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.modal-body {
  padding: 1.1rem 1.4rem 1.3rem;
}

.crm-line {
  margin-bottom: 0.9rem;
  font-size: 13px;
  color: var(--ml-text-dim);
}

.crm-head {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

/* ---- GoHighLevel detail ----
   Contact, opportunity, appointment and where the note went, each linked so the
   claim can be checked in one click rather than taken on trust. */
.crm-detail {
  margin-top: 0.7rem;
  padding: 0.7rem 0.85rem;
  border-radius: 10px;
  border: 1px solid var(--ml-line);
  border-left: 3px solid var(--ml-mint);
  background: rgb(132 235 180 / 0.06);
  display: grid;
  gap: 0.25rem;
}

.crm-detail.is-warn {
  border-left-color: var(--ml-amber);
  background: rgb(255 189 2 / 0.07);
}

.crm-row {
  margin: 0;
  display: flex;
  gap: 0.5rem;
  align-items: baseline;
  font-size: 12.5px;
  line-height: 1.5;
}

.crm-label {
  flex: none;
  width: 5.5rem;
  color: var(--ml-text-faint);
}

.crm-value { color: var(--ml-text-dim); }

.crm-link {
  color: var(--ml-blue);
  font-weight: 600;
  text-decoration: none;
  border-bottom: 1px solid rgb(55 144 228 / 0.4);
}

.crm-link:hover { border-bottom-color: currentcolor; }

.crm-note-soft {
  margin: 0.35rem 0 0;
  font-size: 11.5px;
  color: var(--ml-text-faint);
}

/* ---- contact picker ----
   Suggestions when the matcher refused to guess, plus a search over the whole
   location for a call it had no way of placing. Choosing here writes the note. */
.crm-picker {
  margin-top: 0.6rem;
  padding-top: 0.6rem;
  border-top: 1px solid var(--ml-line);
  display: grid;
  gap: 0.4rem;
}

.crm-picker-head {
  margin: 0;
  font-size: 11.5px;
  color: var(--ml-text-faint);
}

.crm-picker-error {
  margin: 0;
  font-size: 11.5px;
  color: var(--ml-claw);
}

/* The one line that answers "did the notes get there?" — stated once, up top,
   before the per-record detail. */
.crm-done {
  display: flex;
  align-items: baseline;
  gap: 0.45rem;
  margin: 0 0 0.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--ml-line);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ml-mint);
}

.crm-tick {
  flex: none;
  font-size: 13px;
  line-height: 1;
}

/* Per-record outcome, so each destination carries its own confirmation
   rather than being covered by one blanket claim. */
.crm-flag {
  margin-left: 0.45rem;
  padding: 0.05rem 0.4rem;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 600;
  text-transform: lowercase;
  white-space: nowrap;
}

.crm-flag.is-ok {
  color: var(--ml-mint);
  background: rgba(132, 235, 180, 0.13);
}

.crm-flag.is-warn {
  color: var(--ml-amber);
  background: rgba(255, 189, 2, 0.13);
}

.crm-picker-note {
  margin: 0;
  font-size: 11.5px;
  color: var(--ml-text-faint);
  font-style: italic;
}

.crm-search-input {
  width: 100%;
  padding: 0.45rem 0.65rem;
  font: inherit;
  font-size: 12.5px;
  color: var(--ml-text);
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--ml-line);
  border-radius: 8px;
  outline: none;
}

.crm-search-input::placeholder { color: var(--ml-text-faint); }

.crm-search-input:focus {
  border-color: var(--ml-blue);
  box-shadow: 0 0 0 2px rgba(56, 132, 255, 0.18);
}

/* Enough room for a handful of hits without pushing the note out of view. */
.crm-results {
  display: grid;
  gap: 0.4rem;
  max-height: 15rem;
  overflow-y: auto;
}

.crm-actions {
  margin-top: 0.55rem;
  padding-top: 0.55rem;
  border-top: 1px solid var(--ml-line);
}

.crm-candidate {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 12.5px;
}

.crm-candidate-who {
  flex: 1;
  min-width: 0;
  display: grid;
}

.crm-candidate-name,
.crm-candidate-sub {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.crm-candidate-sub {
  font-size: 11px;
  color: var(--ml-text-faint);
}

.crm-pick { flex: none; }

@media (max-width: 570px) {
  .crm-row { flex-direction: column; gap: 0.1rem; }
  .crm-label { width: auto; }
}

.summary-md { font-size: 14px; line-height: 1.55; }
.summary-md p { margin: 0 0 0.6rem; }
.summary-md h4 {
  margin: 1rem 0 0.35rem;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--ml-text-dim);
}
.summary-md ul { margin: 0 0 0.6rem; padding-left: 1.2rem; }
.summary-md li { margin: 0.2rem 0; }
.summary-md strong { color: var(--ml-amber-soft); }
.dim { color: var(--ml-text-faint); font-size: 13px; }

.people { margin-top: 1rem; display: grid; gap: 0.25rem; }

.transcript-find { margin-bottom: 0.8rem; }
.find-count {
  position: absolute;
  right: 0.9rem;
  font-size: 11px;
  font-weight: 700;
  color: var(--ml-text-faint);
}

.transcript {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.35rem;
}
.seg {
  padding: 0.35rem 0.6rem;
  border-radius: 10px;
  border-left: 2px solid transparent;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.seg.is-hit { background: rgb(255 189 2 / 0.08); }
.seg.is-seekable { cursor: pointer; }
.seg.is-seekable:hover { background: rgb(55 144 228 / 0.09); }
/* The line being spoken right now, while the recording plays. */
.seg.is-playing {
  background: rgb(132 235 180 / 0.1);
  border-left-color: var(--ml-mint);
}
.seg.is-playing .seg-text { color: var(--ml-text); }
.seg-head {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  margin-top: 0.4rem;
}
.seg-speaker {
  font-size: 12px;
  font-weight: 800;
  color: var(--ml-blue);
}
.seg-time {
  font-size: 11px;
  color: var(--ml-text-faint);
  font-variant-numeric: tabular-nums;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  font-family: inherit;
}
button.seg-time:hover { color: var(--ml-mint); text-decoration: underline; }
.seg-text {
  margin: 0.1rem 0 0;
  font-size: 14px;
  line-height: 1.5;
}

/* ---------- playback ----------
   The player sits above the tabs (outside the scroll region) so the transcript
   pane always gets the remaining card height. Video spans the modal width;
   full screen still expands via .player:fullscreen .player-video. */
.player {
  flex: 0 0 auto;
  padding: 0.55rem 1.4rem 0.65rem;
  border-bottom: 1px solid var(--ml-line);
  background: var(--ml-navy-800);
}
.player-stage { display: grid; gap: 0.35rem; }
.player-stage .dim { margin: 0.2rem 0; font-size: 13px; }
.player-video {
  width: 100%;
  max-width: 100%;
  /* Cap height so a 16:9 recording fills the card width without eating the
     whole modal — transcript still has room below. */
  max-height: min(48vh, 420px);
  margin-inline: auto;
  border-radius: 10px;
  background: #000;
  display: block;
  object-fit: contain;
}
.player-audio { display: none; }
.player-stage.is-audio { grid-template-columns: 1fr; }
.player-wave {
  height: 34px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.18em;
  color: rgb(250 250 250 / 0.5);
  background:
    repeating-linear-gradient(90deg, rgb(55 144 228 / 0.35) 0 2px, transparent 2px 7px),
    rgb(55 144 228 / 0.07);
}
.player-bar {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin-top: 0.6rem;
  flex-wrap: wrap;
}
.player-btn {
  border: 1px solid var(--ml-line-strong);
  background: rgb(250 250 250 / 0.04);
  color: var(--ml-text-soft);
  border-radius: 8px;
  padding: 0.32rem 0.55rem;
  font-size: 12px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  line-height: 1.4;
}
.player-btn:hover:not(:disabled) { border-color: var(--ml-blue); color: var(--ml-text); }
.player-btn:disabled { opacity: 0.45; cursor: default; }
.player-play {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  padding: 0;
  border-radius: 50%;
  background: var(--ml-blue);
  border-color: transparent;
  color: #fff;
}
.player-play svg { width: 16px; height: 16px; }
.player-follow.is-on { border-color: var(--ml-mint); color: var(--ml-mint); }
.player-scrub {
  flex: 1 1 120px;
  min-width: 90px;
  accent-color: var(--ml-blue);
  cursor: pointer;
}
.player-time {
  font-size: 12px;
  color: var(--ml-text-dim);
  font-variant-numeric: tabular-nums;
  min-width: 84px;
  text-align: right;
}
.player-rate select {
  background: rgb(250 250 250 / 0.04);
  border: 1px solid var(--ml-line-strong);
  color: var(--ml-text-soft);
  border-radius: 8px;
  padding: 0.3rem 0.35rem;
  font-size: 12px;
  font-family: inherit;
}
.player-note { margin: 0.5rem 0 0; font-size: 12px; color: var(--ml-amber); }

/* Full screen is the whole player, not the bare <video>: the controls are ours,
   and a bare video element in full screen has none. */
.player:fullscreen {
  position: static;
  display: flex;
  flex-direction: column;
  justify-content: center;
  background: #000;
}
.player:fullscreen .player-video {
  width: auto;
  max-width: 100%;
  max-height: calc(100vh - 5rem);
  border-radius: 0;
}

@media (max-width: 570px) {
  .player { padding: 0.6rem 1rem 0.7rem; }
  .player-time { min-width: 0; }
  .player-follow { display: none; }
  /* Scrub gets its own full-width row so the controls sit on one line below it. */
  .player-bar { row-gap: 0.6rem; }
  .player-scrub { flex: 1 1 100%; order: -1; }
  .player-rate { margin-left: auto; }
}

.modal-foot {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.8rem 1.4rem;
  border-top: 1px solid var(--ml-line);
  background: rgb(10 15 31 / 0.5);
}
.modal-foot .form-msg { margin-left: auto; color: var(--ml-text-dim); }

.list li.is-clickable { cursor: pointer; }
.list li.is-clickable:hover { border-color: rgb(55 144 228 / 0.55); }

@media (max-width: 570px) {
  .library { padding: 1.1rem 1rem 1.2rem; }
  .library-head { flex-direction: column; }
  .result { grid-template-columns: 48px 1fr; gap: 0.7rem; }
  .result-day { font-size: 18px; }
  .modal { padding: 0; }
  .modal-card { max-height: 100vh; height: 100vh; border-radius: 0; }
}

/* Desktop retains the full filter sidebar; compact app layouts use a drawer. */
.library-filter-toggle {
  display: none;
}

@media (max-width: 1099px) {
  .library-wrap {
    padding: 1rem 1rem 1.25rem;
  }

  .library {
    padding: 1.1rem;
  }

  .library-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.5rem;
  }

  .library-filter-toggle {
    display: inline-flex;
  }

  .library-filters {
    display: none;
    padding: 1rem;
    border: 1px solid var(--ml-line);
    border-radius: var(--ml-radius);
    background: rgb(10 15 31 / 0.55);
  }

  .library-filters.is-open {
    display: grid;
  }

  .library-body {
    gap: 0.9rem;
  }

  .cal {
    max-width: 430px;
  }
}

@media (max-width: 760px) {
  .library-wrap {
    padding: 0.9rem 1rem 1.25rem;
  }

  .library {
    padding: 1rem;
  }

  .library-head {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: start;
    gap: 0.75rem;
    margin-bottom: 0.9rem;
  }

  .library-head > div:first-child {
    grid-column: 1;
    grid-row: 1;
  }

  .library-close {
    grid-column: 2;
    grid-row: 1;
  }

  .library-actions {
    grid-column: 1 / -1;
    grid-row: 2;
    display: grid;
    grid-template-columns: 1fr 1fr;
    margin-left: 0;
  }

  .library-actions .btn {
    width: 100%;
    min-height: var(--ml-touch);
  }

  .link-btn {
    min-height: var(--ml-touch);
    padding: 0.45rem;
    margin: -0.45rem;
  }

  .chip,
  .active-filter {
    min-height: 38px;
    padding: 0.5rem 0.75rem;
  }

  .cal-btn {
    width: var(--ml-touch);
    height: var(--ml-touch);
  }

  .cal-day {
    min-height: 38px;
    font-size: 13px;
  }

  .result {
    grid-template-columns: 48px minmax(0, 1fr);
    gap: 0.65rem;
    padding: 0.8rem 0.75rem;
  }

  .result-top {
    align-items: flex-start;
  }

  .result-title {
    white-space: normal;
    line-height: 1.25;
  }

  .modal {
    padding: 0;
  }

  .modal-card {
    width: 100%;
    height: 100vh;
    height: 100dvh;
    max-height: 100dvh;
    border: 0;
    border-radius: 0;
  }

  .modal-head {
    padding: max(1rem, env(safe-area-inset-top)) 1rem 0.8rem;
  }

  .modal-close {
    min-width: var(--ml-touch);
    min-height: var(--ml-touch);
  }

  .modal-tabs {
    overflow-x: auto;
    padding: 0.35rem 0.75rem 0;
    scrollbar-width: none;
  }

  .modal-tabs::-webkit-scrollbar {
    display: none;
  }

  .modal-tab {
    flex: 1 0 auto;
    min-height: var(--ml-touch);
    padding: 0.65rem 0.85rem;
  }

  .modal-body {
    padding: 1rem;
  }

  .modal-foot {
    flex-wrap: wrap;
    padding: 0.7rem 1rem max(0.7rem, env(safe-area-inset-bottom));
  }

  .modal-foot .btn {
    min-height: var(--ml-touch);
    flex: 1 1 140px;
  }

  .modal-foot .form-msg {
    width: 100%;
    margin-left: 0;
  }
}

@media (max-width: 390px) {
  .library-wrap {
    padding-left: 0.65rem;
    padding-right: 0.65rem;
  }

  .library {
    padding: 0.9rem 0.75rem 1rem;
    border-radius: var(--ml-radius);
  }

  .library-actions {
    grid-template-columns: 1fr;
  }

  .result {
    grid-template-columns: 42px minmax(0, 1fr);
    gap: 0.55rem;
  }

  .result-when {
    margin-left: -0.25rem;
  }
}

/* ---------- Ask the agent ---------- */

.chat {
  display: grid;
  gap: 0.55rem;
  align-content: start;
  min-height: 180px;
  max-height: 46vh;
  overflow: auto;
  padding-right: 0.2rem;
}

.chat-hint {
  margin: 0;
  font-size: 13px;
  color: var(--ml-text-dim);
}

.chat-msg {
  max-width: 88%;
  padding: 0.55rem 0.75rem;
  border-radius: var(--ml-radius);
  font-size: 14px;
  line-height: 1.5;
  white-space: pre-wrap;
}

.chat-you {
  justify-self: end;
  background: rgb(55 144 228 / 0.18);
  border: 1px solid rgb(55 144 228 / 0.35);
}

.chat-agent {
  justify-self: start;
  background: rgb(250 250 250 / 0.05);
  border: 1px solid var(--ml-line);
}

.chat-msg.is-pending { color: var(--ml-text-dim); font-style: italic; }
.chat-msg.chat-err { border-color: rgb(239 74 60 / 0.5); color: #ffb4ad; }

.chat-form {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.9rem;
}

.chat-form .input { flex: 1; }

/* ---------- Share & recap ---------- */

.share-block {
  padding-bottom: 1rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--ml-line);
}

.share-block:last-child { border-bottom: 0; margin-bottom: 0; padding-bottom: 0; }

.share-note {
  margin: 0.3rem 0 0.7rem;
  font-size: 13px;
}

.share-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.share-row .input {
  flex: 1;
  font-size: 13px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.share-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.6rem;
}

@media (max-width: 560px) {
  .share-row { flex-wrap: wrap; }
  .share-row .input { flex-basis: 100%; }
}
