/* ── Upload progress widget (Google Drive-style) ──────────────── */
.upload-widget {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  width: 22rem;
  max-width: calc(100vw - 2rem);
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
  z-index: 9000;
  overflow: hidden;
  font-family: var(--font-sans);
}
.upload-widget.hidden { display: none; }
.upload-widget-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.7rem 0.85rem;
  background: var(--ink);
  color: var(--white);
}
.upload-widget-title { font-size: 0.8125rem; font-weight: 500; }
.upload-widget-close {
  background: none; border: none; cursor: pointer;
  color: var(--white); padding: 0.2rem; opacity: 0.7;
  display: flex; align-items: center;
}
.upload-widget-close:hover { opacity: 1; }
.upload-widget-list {
  max-height: 18rem;
  overflow-y: auto;
  padding: 0.4rem 0;
}
.upload-row {
  padding: 0.5rem 0.85rem;
  border-bottom: 1px solid var(--border-2);
}
.upload-row:last-child { border-bottom: none; }
.upload-row-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}
.upload-row-name {
  flex: 1; min-width: 0;
  font-size: 0.8125rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.upload-row-size {
  color: var(--muted);
  font-size: 0.7rem;
  margin-left: 0.3rem;
  font-variant-numeric: tabular-nums;
}
.upload-row-status {
  font-size: 0.75rem;
  color: var(--muted);
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}
.upload-row-status.success { color: var(--success); }
.upload-row-status.error { color: var(--danger); }
.upload-bar {
  height: 4px;
  background: var(--border-2);
  border-radius: 2px;
  overflow: hidden;
}
.upload-bar-fill {
  height: 100%;
  background: var(--gold);
  width: 0;
  transition: width 0.2s ease;
}
.upload-bar-fill.success { background: var(--success); width: 100% !important; }
.upload-bar-fill.error { background: var(--danger); }

/* ── Scrollbar ─────────────────────────────────────────────── */
::-webkit-scrollbar { width: 0.3rem; height: 0.3rem; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 9999px; }

/* ── Utilities ─────────────────────────────────────────────── */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }
.hidden  { display: none !important; }
.flex    { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2   { gap: 0.5rem; }
.gap-3   { gap: 0.75rem; }
.gap-4   { gap: 1rem; }
.grow    { flex: 1 1 0%; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.text-muted { color: var(--muted); }
.text-gold  { color: var(--gold); }
.text-sm  { font-size: 0.8125rem; }
.text-xs  { font-size: 0.6875rem; }
.serif    { font-family: var(--font-serif); }
.w-full   { width: 100%; }
.mt-2 { margin-top: 0.5rem; }
.mt-4 { margin-top: 1rem; }

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.55rem 1.1rem;
  font-family: var(--font-sans);
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: var(--r-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--t);
  white-space: nowrap;
  text-decoration: none;
  min-height: 2.5rem; /* 40px touch target */
  -webkit-tap-highlight-color: transparent;
}
.btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.btn-primary { background: var(--ink); color: var(--white); border-color: var(--ink); }
.btn-primary:hover { background: var(--ink-3); }
.btn-gold { background: var(--gold); color: var(--white); border-color: var(--gold); }
.btn-gold:hover { opacity: 0.9; }
.btn-outline { background: transparent; color: var(--ink); border-color: var(--border); }
.btn-outline:hover { border-color: var(--ink); background: var(--border-2); }
.btn-ghost { background: transparent; color: var(--mid); border-color: transparent; }
.btn-ghost:hover { background: var(--border-2); color: var(--ink); }
.btn-danger { background: var(--danger); color: var(--white); border-color: var(--danger); }
.btn-sm { padding: 0.35rem 0.75rem; font-size: 0.8125rem; min-height: 2rem; }
.btn-icon { padding: 0.55rem; border-radius: var(--r-md); min-width: 2.5rem; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; pointer-events: none; }

/* ── Form elements ─────────────────────────────────────────── */
.input, .select, .textarea {
  width: 100%;
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  color: var(--ink);
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 0.6rem 0.85rem;
  transition: border-color var(--t);
  min-height: 2.75rem;
  appearance: none;
}
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(201,168,76,0.12);
}
.input::placeholder, .textarea::placeholder { color: var(--muted); }
.textarea { resize: vertical; min-height: 5rem; line-height: 1.6; }
.select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236B6B5E' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 0.75rem center; background-size: 1rem; padding-right: 2.5rem; }
.label { display: block; font-size: 0.8125rem; font-weight: 500; color: var(--mid); margin-bottom: 0.35rem; letter-spacing: 0.01em; }
.form-row { margin-bottom: 1rem; }
.form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-bottom: 1rem; }
.input-error { border-color: var(--danger) !important; }
.error-msg { font-size: 0.75rem; color: var(--danger); margin-top: 0.25rem; }
.field-hint { font-size: 0.75rem; color: var(--muted); margin-top: 0.25rem; }

/* ── Cards ─────────────────────────────────────────────────── */
.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 1.25rem;
}
.card-flat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 1rem; }

/* ── Badge ─────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 0.25rem;
  font-size: 0.6875rem; font-weight: 600; letter-spacing: 0.04em;
  text-transform: uppercase; padding: 0.2rem 0.5rem;
  border-radius: 9999px;
}
.badge-gold   { background: var(--gold-bg); color: var(--gold); }
.badge-green  { background: var(--success-bg); color: var(--success); }
.badge-red    { background: var(--danger-bg); color: var(--danger); }
.badge-grey   { background: var(--border-2); color: var(--mid); }
.badge-warn   { background: var(--warn-bg); color: var(--warn); }
.badge-blue   { background: var(--info-bg); color: var(--info); }

/* ── Toast ─────────────────────────────────────────────────── */
#toast-container {
  position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 9999;
  display: flex; flex-direction: column; gap: 0.5rem;
  pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 0.75rem;
  background: var(--ink); color: var(--white);
  padding: 0.75rem 1rem; border-radius: var(--r-lg);
  font-size: 0.875rem; max-width: 22rem;
  box-shadow: 0 4px 20px rgba(0,0,0,0.25);
  animation: toast-in 0.25s ease;
  pointer-events: auto;
}
.toast.toast-error { background: var(--danger); }
.toast.toast-success { background: var(--success); }
@keyframes toast-in { from { opacity: 0; transform: translateX(1rem); } to { opacity: 1; transform: none; } }

/* ── Follow-up status banner ───────────────────────────────── */
/* Persistent pill anchored to the bottom of the viewport. Shown
   while a multi-step flow is in progress (e.g. saving an analysis
   and routing the lawyer to the resulting research session for a
   follow-up). Hides once the destination view's own loading state
   takes over. */
.followup-status {
  position: fixed;
  bottom: 1.25rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1100;
  background: var(--ink);
  color: var(--white);
  padding: 0.7rem 1.1rem 0.7rem 0.9rem;
  border-radius: 999px;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.22);
  font-size: 0.875rem;
  font-weight: 500;
  max-width: calc(100vw - 2rem);
  pointer-events: none;
}
.followup-status.hidden { display: none; }
.followup-status-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.25);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: followup-spin 0.8s linear infinite;
  flex-shrink: 0;
}
@keyframes followup-spin { to { transform: rotate(360deg); } }

/* ── Generation overlay (full-viewport block during heavy AI runs) ── */
/* Soft black backdrop with blur. Sits above modals (z-index 1200)
   because it's "harder" — the lawyer should never be able to
   accidentally click underneath it while a 30-second analysis or
   draft is in flight. Minimisable for the patient lawyer. */
.gen-overlay {
  position: fixed;
  inset: 0;
  z-index: 1200;
  background: rgba(15, 15, 13, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  pointer-events: auto;
}
.gen-overlay.hidden { display: none; }
.gen-overlay-inner {
  background: var(--white);
  border-radius: var(--r-xl);
  padding: 2.25rem 2.5rem 1.5rem;
  width: 100%;
  max-width: 24rem;
  text-align: center;
  box-shadow: 0 28px 72px rgba(0, 0, 0, 0.32);
  position: relative;
}
.gen-overlay-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: gen-overlay-spin 0.85s linear infinite;
  margin: 0 auto 1rem;
}
@keyframes gen-overlay-spin { to { transform: rotate(360deg); } }
.gen-overlay-text {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  font-weight: 500;
  color: var(--ink);
  margin-bottom: 0.35rem;
}
.gen-overlay-sub {
  font-size: 0.825rem;
  color: var(--muted);
  line-height: 1.5;
  margin-bottom: 1rem;
}
.gen-overlay-minimize {
  background: none;
  border: none;
  font-size: 0.78rem;
  color: var(--gold);
  cursor: pointer;
  font-family: var(--font-sans);
  padding: 0.35rem 0.5rem;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.gen-overlay-minimize:hover { color: var(--ink); }

/* ── Modal ─────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(15,15,13,0.55);
  backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
}
.modal {
  background: var(--white);
  border-radius: var(--r-xl);
  width: 100%; max-width: 30rem;
  max-height: calc(100dvh - 2rem);
  overflow-y: auto;
  padding: 1.75rem;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}
.modal-lg { max-width: 42rem; }
.modal-xl { max-width: 56rem; }
.modal-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 1.25rem;
}
.modal-title { font-family: var(--font-serif); font-size: 1.35rem; }
.modal-close {
  background: none; border: none; cursor: pointer;
  color: var(--muted); padding: 0.25rem;
  border-radius: var(--r-sm); transition: color var(--t);
  flex-shrink: 0; margin-left: 1rem;
}
.modal-close:hover { color: var(--ink); }
.modal-footer { display: flex; gap: 0.75rem; justify-content: flex-end; margin-top: 1.5rem; padding-top: 1.25rem; border-top: 1px solid var(--border); }

/* ── Divider ───────────────────────────────────────────────── */
.divider { height: 1px; background: var(--border); margin: 1.25rem 0; }
.divider-label { display: flex; align-items: center; gap: 0.75rem; color: var(--muted); font-size: 0.8125rem; margin: 1rem 0; }
.divider-label::before, .divider-label::after { content: ''; flex: 1; height: 1px; background: var(--border); }


/* ── Global search overlay (⌘K) ─────────────────────────────── */
.gsearch-overlay {
  position: fixed; inset: 0; z-index: 1100;
  background: rgba(15, 15, 13, 0.55);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 8vh;
}
.gsearch-modal {
  background: var(--white);
  border-radius: var(--r-lg);
  box-shadow: 0 20px 50px rgba(0,0,0,0.25);
  width: 100%;
  max-width: 38rem;
  max-height: 70vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.gsearch-input-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
}
.gsearch-input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 0.95rem;
  font-family: var(--font-sans);
  color: var(--ink);
  background: transparent;
}
.gsearch-input::placeholder { color: var(--muted); }
.gsearch-hint {
  font-size: 0.7rem;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 0.15rem 0.5rem;
}
.gsearch-results {
  flex: 1;
  overflow-y: auto;
  padding: 0.4rem 0;
}
.gsearch-empty {
  padding: 1.5rem 1rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
}
.gsearch-group-label {
  padding: 0.5rem 1rem 0.25rem;
  font-size: 0.65rem;
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.6px;
  color: var(--muted);
}
.gsearch-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.55rem 1rem;
  cursor: pointer;
  transition: background var(--t);
}
.gsearch-row:hover, .gsearch-row-selected {
  background: var(--surface);
}
.gsearch-row-icon {
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 50%;
  background: var(--gold-bg);
  color: var(--gold);
  font-size: 0.7rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 1px solid var(--gold-dim);
}
.gsearch-row-main { flex: 1; min-width: 0; }
.gsearch-row-title {
  font-size: 0.875rem;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.gsearch-row-sub {
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: 0.1rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.gsearch-row-badge {
  display: inline-block;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--mid);
  font-size: 0.65rem;
  padding: 0.05rem 0.4rem;
  border-radius: 999px;
  margin-left: 0.4rem;
  vertical-align: middle;
}

/* Topbar search trigger */
.topbar-search-btn { margin-right: 0.4rem; }

/* ── Add to calendar picker ─────────────────────────────────── */
.add-cal-grid {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}
.add-cal-card {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.7rem 0.85rem;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  cursor: pointer;
  text-align: left;
  font-family: var(--font-sans);
  transition: all var(--t);
}
.add-cal-card:hover {
  border-color: var(--gold);
  background: var(--gold-bg);
}
.add-cal-icon {
  width: 2.4rem;
  height: 2.4rem;
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.add-cal-body { flex: 1; min-width: 0; }
.add-cal-title {
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--ink);
  font-family: var(--font-serif);
}
.add-cal-sub {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 0.15rem;
}

/* ════════════════════════════════════════════════════════════════
   COMPOSER — universal input primitive (lex-design-system §C)
   One shape: top slots · file chips · textarea · action row · hint.
   Used by analyse-doc upload; designed to be reused by research,
   document drafting, and the recorder kickoff.
══════════════════════════════════════════════════════════════════ */
.composer {
  background: var(--paper-2);
  border: 1px solid var(--paper-edge);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-1);
  padding: 0.5rem;
  display: flex;
  flex-direction: column;
  transition: border-color 0.15s ease, box-shadow 0.2s ease;
}
.composer.is-active,
.composer.composer-drag-over {
  border-color: var(--gold);
  box-shadow: 0 0 0 4px rgba(168, 128, 58, 0.12);
}

/* Top-slots row (Add files, Position, etc.) */
.composer-slots {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0.25rem 0.25rem 0.35rem;
}

/* Chip-style trigger inside the slots row. Plain ghost button by
   default; the -select variant overlays a native <select> on top. */
.composer-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.55rem;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  color: var(--ink-3);
  font-size: var(--t-small);
  font-weight: 500;
  font-family: var(--font-sans);
  cursor: pointer;
  line-height: 1.2;
  transition: background 0.12s ease, color 0.12s ease;
}
.composer-chip:hover { background: var(--paper-3); color: var(--ink-2); }
.composer-chip svg { stroke: currentColor; flex-shrink: 0; }

.composer-chip-label { color: var(--ink-4); font-weight: 400; }
.composer-chip-value { color: var(--ink-2); font-weight: 500; }
.composer-chip-chev { opacity: 0.55; }

/* The position-picker chip uses a transparent native <select>
   stretched over the chip. Keeps the OS-native dropdown UX while
   letting us style the visible chip however we like. */
.composer-chip-select { position: relative; }
.composer-chip-control {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  padding: 0;
  margin: 0;
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  color: transparent;
  font: inherit;
  cursor: pointer;
  opacity: 0;
}
/* Focus ring needs to live on the wrapper because the <select> itself
   is opacity:0 — its own outline would never be visible. */
.composer-chip-select:focus-within { background: var(--paper-3); outline: 2px solid var(--gold); outline-offset: 1px; }
/* The native option list still inherits OS chrome — give it
   readable colours when the lawyer opens it. */
.composer-chip-control option,
.composer-chip-control optgroup {
  color: var(--ink-2);
  background: var(--paper-2);
  font: inherit;
}

/* File chips — populated by the host module's render function */
.composer-files {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding: 0 0.25rem 0.4rem;
}
.composer-files[hidden] { display: none; }

.composer-file-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.25rem 0.4rem 0.25rem 0.5rem;
  background: var(--paper);
  border: 1px solid var(--paper-edge);
  border-radius: 999px;
  font-size: 0.78rem;
  max-width: 22rem;
}
.composer-file-chip svg { color: var(--ink-4); flex-shrink: 0; }
.composer-file-chip-name {
  color: var(--ink-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.composer-file-chip-meta { color: var(--ink-4); font-size: 0.72rem; flex-shrink: 0; }
.composer-file-chip-remove {
  background: none;
  border: 0;
  color: var(--ink-4);
  padding: 2px;
  display: inline-flex;
  align-items: center;
  border-radius: 4px;
  cursor: pointer;
}
.composer-file-chip-remove:hover { color: var(--err); background: var(--paper-3); }

/* Main textarea — borderless, transparent so it blends into the
   composer surface. Rows is set on the element. */
.composer-textarea {
  width: 100%;
  background: transparent;
  border: 0;
  outline: 0;
  padding: 0.4rem 0.55rem 0.25rem;
  font-family: var(--font-sans);
  font-size: 0.95rem;
  color: var(--ink-2);
  resize: none;
  line-height: var(--lh-body);
  min-height: 2.6rem;
}
.composer-textarea::placeholder { color: var(--ink-5); }

/* Bottom action row */
.composer-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem 0.25rem 0.25rem 0.35rem;
}
.composer-status {
  font-size: 0.78rem;
  color: var(--ink-4);
  flex: 1;
  min-width: 0;
  line-height: 1.3;
}
.composer-actions .btn[disabled] { opacity: 0.4; cursor: not-allowed; }

/* One muted hint line below the composer */
.composer-hint {
  margin: 0.75rem 0 0;
  text-align: center;
  font-size: 0.78rem;
  color: var(--ink-4);
}
.composer-hint .hint-link {
  background: none;
  border: 0;
  padding: 0;
  color: var(--gold);
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: var(--gold-soft);
  text-underline-offset: 3px;
  font: inherit;
}
.composer-hint .hint-link:hover { color: var(--gold-deep); }
.composer-hint .hint-sep { color: var(--paper-edge); margin: 0 0.35rem; }

/* Collapsed variant — flat single-row strip used as the "restored
   state" pill row above an analysis result. Same surface tokens as
   the full composer; no slots, no textarea. */
.composer-collapsed {
  flex-direction: row;
  align-items: center;
  gap: 0.75rem;
  padding: 0.55rem 0.85rem;
}
.composer-collapsed-summary {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
  flex-wrap: wrap;
  min-width: 0;
}
.composer-collapsed-summary > svg { color: var(--gold); flex-shrink: 0; }
.composer-collapsed-name {
  color: var(--ink-2);
  font-weight: 500;
  font-size: 0.875rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 24rem;
}
.composer-collapsed-sep { color: var(--paper-edge); flex-shrink: 0; }
.composer-collapsed-pos { color: var(--ink-4); font-size: var(--t-small); }
.composer-collapsed-pos strong { color: var(--ink-2); font-weight: 500; }
.composer-collapsed-name[hidden],
.composer-collapsed-pos[hidden],
.composer-collapsed-sep[hidden] { display: none; }

/* ════════════════════════════════════════════════════════════════
   PAGE HEADER — title + optional subtitle + actions
   (lex-design-system §B). Reused by analyse result, ready for
   future module reworks.
══════════════════════════════════════════════════════════════════ */
.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin: 1rem 0 var(--section-gap);
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--paper-edge);
}
.page-header-main { min-width: 0; flex: 1; }
.page-header-title {
  font-family: var(--font-serif);
  font-size: var(--t-h2);
  font-weight: 500;
  color: var(--ink-2);
  line-height: var(--lh-tight);
  letter-spacing: -0.005em;
  margin: 0 0 0.25rem;
}
.page-header-sub {
  font-size: var(--t-small);
  color: var(--ink-4);
  max-width: 48rem;
  margin: 0;
  line-height: var(--lh-snug);
}
.page-header-sub[hidden] { display: none; }
.page-header-actions { display: flex; gap: 0.5rem; flex-shrink: 0; }

/* ════════════════════════════════════════════════════════════════
   BACK LINK — minimal "← {label}" affordance above a page header
══════════════════════════════════════════════════════════════════ */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: none;
  border: 0;
  padding: 0.3rem 0.5rem 0.3rem 0.35rem;
  margin-bottom: 0.4rem;
  color: var(--ink-4);
  font-size: var(--t-small);
  font-weight: 500;
  font-family: var(--font-sans);
  cursor: pointer;
  border-radius: var(--r-sm);
  transition: background 0.12s ease, color 0.12s ease;
}
.back-link:hover { color: var(--ink-2); background: var(--paper-3); }
.back-link svg { stroke: currentColor; flex-shrink: 0; }

/* ════════════════════════════════════════════════════════════════
   STATUS PILL — flat white + colored dot + colored text
   (lex-design-system §H). White surface, never a fill — the dot
   carries the colour. Variants by status keyword.
══════════════════════════════════════════════════════════════════ */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  background: var(--paper-2);
  color: var(--ink-3);
  font-size: var(--t-mini);
  font-weight: 500;
  border: 1px solid var(--paper-edge);
  white-space: nowrap;
}
.status-pill::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: currentColor;
  flex-shrink: 0;
}
.status-pill-ok   { color: var(--ok);   }
.status-pill-warn { color: var(--warn); }
.status-pill-err  { color: var(--err);  }
.status-pill-info { color: var(--info); }
.status-pill-ai   { color: var(--ai-ink); }
.status-pill-ai::before { background: var(--gold); }
.status-pill[hidden] { display: none; }

/* ============================================================
   MODULE CHROME RULE — title and CTAs in topbar, not content
   See memory: feedback_module_chrome_rule.md
============================================================ */

/* Topbar slot for module-level CTAs (mirrors .topbar-editor-controls
   but module-scoped). Populated per module by setModuleActions(). */
.topbar-module-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.topbar-module-actions.hidden { display: none; }

/* Tighten any buttons that land in the topbar so they don't bloat the bar. */
.topbar-module-actions .btn {
  padding: 0.3rem 0.7rem;
  font-size: 0.75rem;
  min-height: 1.65rem;
  white-space: nowrap;
}
.topbar-module-actions .btn-sm {
  padding: 0.25rem 0.6rem;
  font-size: 0.72rem;
}
.topbar-module-actions .input,
.topbar-module-actions .select {
  font-size: 0.75rem;
  padding: 0.25rem 0.6rem;
  height: 1.75rem;
  min-height: 1.75rem;
}

/* Mobile: drop the labels, keep icon-only. Buttons should declare
   their accessible label via aria-label/title. */
@media (max-width: 768px) {
  .topbar-module-actions .btn {
    padding: 0.3rem 0.45rem;
    gap: 0;
  }
  .topbar-module-actions .btn-label,
  .topbar-module-actions .btn > span:not(.sr-only) {
    display: none;
  }
  .topbar-module-actions .input { max-width: 8rem; }
}

/* Small count line above filters in the content area. Replaces the
   old .module-sub when its only purpose was a count or one-liner. */
.module-count {
  font-size: 0.78rem;
  color: var(--muted);
  margin: 0 0 0.85rem;
  letter-spacing: 0.01em;
}
