/* ============================================================================
   Query — the selected Quiet Query surface.
   Uses the Calm Paper / Lilac tokens from calm_paper.css.
   ========================================================================== */

.query-home,
.query-saved {
  width: min(780px, 100%);
  margin: 0 auto;
  --shadow-lift: 0 2px 4px rgba(60, 30, 70, .04), 0 18px 44px -24px rgba(60, 30, 70, .22);
}

.query-home { padding-top: 22px; }

.query-topline {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 10px;
  min-height: 30px;
}
.query-privacy { position: relative; }
.query-privacy-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 45;
  width: min(320px, calc(100vw - 32px));
  padding: 15px;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: var(--cp-card);
  box-shadow: 0 20px 48px -20px rgba(60, 30, 70, .35);
}
.query-privacy-menu h3 { font-size: 13px; font-weight: 800; }
.query-privacy-menu p { margin-top: 6px; color: var(--muted); font-size: 11.5px; line-height: 1.5; }
.query-privacy-menu a { display: inline-block; margin-top: 10px; color: var(--accent); font-size: 11.5px; font-weight: 800; }
.query-good-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--good); box-shadow: 0 0 0 3px rgba(59, 138, 93, .1); flex: none; }

/* ---- Shared small tags ----------------------------------------------------- */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .01em;
  white-space: nowrap;
}
.tag-good { background: #e8f4ec; color: var(--good); }
.tag-muted { background: var(--paper-2); color: var(--muted); }

/* ---- Composer ------------------------------------------------------------- */
.query-composer {
  background: var(--cp-card);
  border: 1px solid var(--line-strong);
  border-radius: 22px;
  box-shadow: var(--shadow-lift);
  transition: border-color .16s ease, box-shadow .16s ease;
}
.query-composer:focus-within {
  border-color: rgba(122, 62, 134, .38);
  box-shadow: 0 0 0 3px rgba(122, 62, 134, .07), var(--shadow-lift);
}
.query-composer-input {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 18px 16px 8px 19px;
}
.query-composer-input textarea {
  flex: 1;
  width: 100%;
  min-height: 48px;
  max-height: 190px;
  resize: none;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 16px;
  line-height: 1.5;
  font-weight: 600;
}
.query-composer-input textarea::placeholder { color: var(--ink-faint); font-weight: 600; }
.query-send {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  flex: none;
  box-shadow: 0 5px 14px -8px rgba(122, 62, 134, .7);
}
.query-send:hover { background: var(--accent-hover); }
.query-send:disabled { opacity: .55; cursor: wait; }
.query-send svg { width: 18px; height: 18px; }

.query-composer-tools {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  min-height: 36px;
  padding: 3px 14px 12px 16px;
}
.query-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--paper) 72%, white);
  color: var(--ink-soft);
  font-size: 11.5px;
  font-weight: 800;
  white-space: nowrap;
  list-style: none;
  cursor: pointer;
}
.query-pill::-webkit-details-marker { display: none; }
.query-pill:hover { background: var(--cp-card); border-color: var(--line-strong); }
.query-pill svg { width: 14px; height: 14px; color: var(--muted); flex: none; }
.query-pill .query-chev { width: 11px; height: 11px; color: var(--faint); }
.query-tool {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  color: var(--muted);
}
.query-tool:hover { background: var(--paper); color: var(--ink); }
.query-tool svg { width: 16px; height: 16px; }
.query-tool[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); }
.query-status {
  margin-left: 4px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.4;
}

/* ---- Audience menu -------------------------------------------------------- */
.query-audience { position: relative; }
.query-audience-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 40;
  width: 278px;
  padding: 8px;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: var(--cp-card);
  box-shadow: 0 20px 48px -20px rgba(60, 30, 70, .35);
}
.query-pop-title {
  padding: 6px 9px 7px;
  color: var(--ink-faint);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .16em;
  text-transform: uppercase;
}
.query-audience-option,
.query-history-option {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  width: 100%;
  padding: 8px 9px;
  border-radius: 9px;
  text-align: left;
  color: var(--ink-soft);
  font-size: 12.5px;
  font-weight: 700;
}
.query-audience-option:hover,
.query-history-option:hover { background: var(--paper); color: var(--ink); }
.query-audience-option strong,
.query-history-option strong { display: block; font-size: 12.5px; }
.query-audience-option small,
.query-history-option small { display: block; margin-top: 1px; color: var(--ink-faint); font-size: 10.5px; line-height: 1.35; font-weight: 600; }
.query-radio {
  width: 14px;
  height: 14px;
  margin-top: 2px;
  border: 1.5px solid var(--line-strong);
  border-radius: 50%;
  flex: none;
  display: grid;
  place-items: center;
}
.query-audience-option.is-selected .query-radio,
.query-history-option.is-selected .query-radio { border-color: var(--accent); }
.query-audience-option.is-selected .query-radio::after,
.query-history-option.is-selected .query-radio::after {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
}

/* ---- History notice ------------------------------------------------------- */
.query-history-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 13px;
  padding: 0 3px;
}
.query-history-note {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--ink-faint);
  font-size: 10.5px;
  font-weight: 700;
}
.query-history-note svg { width: 13px; height: 13px; flex: none; }
.query-history-settings { position: relative; }
.query-history-settings-summary {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 7px;
  border-radius: 7px;
  color: var(--ink-faint);
  font-size: 10.5px;
  font-weight: 800;
  list-style: none;
  cursor: pointer;
}
.query-history-settings-summary::-webkit-details-marker { display: none; }
.query-history-settings-summary:hover { background: rgba(255, 253, 255, .66); color: var(--muted); }
.query-history-settings-summary svg { width: 13px; height: 13px; }
.query-history-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 40;
  width: 330px;
  padding: 10px;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: var(--cp-card);
  box-shadow: 0 20px 48px -20px rgba(60, 30, 70, .35);
}
.query-history-option + .query-history-option { border-top: 1px solid var(--line-soft); }
.query-history-foot {
  padding: 7px 9px 4px;
  color: var(--ink-faint);
  font-size: 10px;
  font-weight: 700;
  line-height: 1.45;
}

/* ---- Recent queries ------------------------------------------------------- */
.query-recent { margin-top: 38px; }
.query-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}
.query-section-head h2 { font-size: 13px; font-weight: 800; color: var(--ink); }
.query-section-head a { color: var(--accent); font-size: 11.5px; font-weight: 800; }
.query-recent-list {
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: rgba(255, 253, 255, .42);
}
.query-recent-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  border-radius: 11px;
  color: var(--ink-soft);
}
.query-recent-row + .query-recent-row { border-top: 1px solid var(--line-soft); border-radius: 0; }
.query-recent-row:hover { background: rgba(255, 253, 255, .66); }
.query-recent-icon {
  display: grid;
  place-items: center;
  width: 31px;
  height: 31px;
  border-radius: 9px;
  background: var(--paper-2);
  color: var(--accent);
  flex: none;
}
.query-recent-icon svg { width: 15px; height: 15px; }
.query-recent-main { flex: 1; min-width: 0; }
.query-recent-main strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink);
  font-size: 12.5px;
  font-weight: 800;
}
.query-recent-main span { display: block; margin-top: 1px; color: var(--ink-faint); font-size: 10.5px; font-weight: 700; }
.query-recent-arrow { width: 14px; height: 14px; color: var(--ink-faint); flex: none; }
.query-empty { color: var(--ink-faint); font-size: 11.5px; font-weight: 700; padding: 10px 3px; }

/* ---- Ephemeral conversation ----------------------------------------------- */
.query-home [hidden] { display: none !important; }

/* The home starts as a single composer. On the first message it becomes a
   full-height conversation: header, scrolling thread, and a composer pinned
   to the bottom of the card. */
.query-chat { min-width: 0; }
.query-home.is-chatting {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 5rem);
  height: calc(100dvh - 5rem);
  min-height: 460px;
}
.query-home.is-chatting .query-topline,
.query-home.is-chatting .query-history-bar,
.query-home.is-chatting .query-recent { display: none; }
.query-home.is-chatting .query-chat {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 22px;
  background: var(--cp-card);
  box-shadow: var(--shadow-lift);
}
.query-chat-head {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: none;
  min-width: 0;
  padding: 11px 16px;
  border-bottom: 1px solid var(--line);
}
.query-chat-head-main {
  display: flex;
  align-items: center;
  gap: 11px;
  flex: 1;
  min-width: 0;
}
.query-chat-new {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: none;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink-soft);
  font-size: 11.5px;
  font-weight: 800;
}
.query-chat-new:hover { background: var(--paper-2); color: var(--accent); }
.query-chat-new svg { width: 14px; height: 14px; }
.query-chat-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink);
  font-size: 12.5px;
  font-weight: 800;
}
.query-chat-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: none;
  color: var(--ink-faint);
  font-size: 10.5px;
  font-weight: 700;
}
.query-home.is-chatting .query-chat-composer {
  flex: none;
  padding: 10px 12px 12px;
  border-top: 1px solid var(--line);
  background: #fbf8fc;
}
.query-home.is-chatting .query-composer { border-radius: 17px; box-shadow: var(--shadow-soft); }
.query-home.is-chatting .query-composer-input { padding: 10px 11px 4px 14px; }
.query-home.is-chatting .query-composer-input textarea { min-height: 38px; font-size: 14px; }
.query-home.is-chatting .query-send { width: 34px; height: 34px; }
.query-home.is-chatting .query-composer-tools { min-height: 30px; padding: 2px 10px 8px 12px; }
.query-home.is-chatting .query-thread {
  flex: 1;
  min-height: 0;
  gap: 20px;
  margin-top: 0;
  padding: 20px 22px 8px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scroll-behavior: smooth;
}
.query-home.is-chatting .query-thread::-webkit-scrollbar { width: 8px; }
.query-home.is-chatting .query-thread::-webkit-scrollbar-thumb {
  border: 2px solid var(--cp-card);
  border-radius: 8px;
  background: var(--paper-2);
}
.query-home.is-chatting .query-user-bubble { max-width: 82%; }

.query-thread {
  display: flex;
  flex-direction: column;
  gap: 24px;
  margin-top: 30px;
  padding: 0 2px;
}
.query-message { min-width: 0; }
.query-message--user { display: flex; justify-content: flex-end; }
.query-user-bubble {
  max-width: 86%;
  padding: 12px 16px;
  border-radius: 16px 16px 4px 16px;
  background: var(--accent-wash, #f8f0f9);
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.query-byline {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 13px;
}
.query-avatar {
  display: grid;
  place-items: center;
  width: 25px;
  height: 25px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  flex: none;
}
.query-avatar svg { width: 13px; height: 13px; }
.query-byline strong { font-size: 11.5px; font-weight: 800; }
.query-byline-meta { display: flex; align-items: center; gap: 6px; color: var(--ink-faint); font-size: 9.5px; font-weight: 700; }
.query-good-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--good); }
.query-prose { color: var(--ink-soft); font-size: 14px; line-height: 1.75; overflow-wrap: anywhere; overflow-x: auto; }
.query-prose p { margin: 0 0 12px; }
.query-prose h2 { margin: 0 0 10px; color: var(--ink); font-size: 19px; line-height: 1.3; letter-spacing: -.02em; font-weight: 800; }
.query-prose h3 { margin: 18px 0 8px; color: var(--ink); font-size: 14px; font-weight: 800; }
.query-prose strong { color: var(--ink); font-weight: 800; }
.query-prose ul, .query-prose ol { margin: 0 0 13px; padding-left: 20px; }
.query-prose li { margin-bottom: 5px; }
.query-prose a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.query-prose table { width: 100%; margin: 12px 0 15px; border-collapse: collapse; font-size: 12px; }
.query-prose th, .query-prose td { padding: 8px 9px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.query-prose th { color: var(--ink-faint); font-size: 9px; letter-spacing: .08em; text-transform: uppercase; font-weight: 800; }
.query-prose blockquote { margin: 14px 0; padding-left: 14px; border-left: 2px solid var(--accent); color: var(--muted); }
.query-prose pre { white-space: pre-wrap; padding: 12px; border-radius: 8px; background: var(--paper); }
.query-answer-actions { display: flex; gap: 10px; margin-top: 9px; }
.query-text-button {
  padding: 3px 0;
  border: 0;
  background: transparent;
  color: var(--ink-faint);
  font-size: 10.5px;
  font-weight: 800;
}
.query-text-button:hover { color: var(--accent); }
.query-chat-head .query-thread-actions-right { margin-left: auto; }
.query-thread-actions-right { display: flex; align-items: center; gap: 12px; flex: none; }
.query-save-button {
  padding: 7px 12px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
}
.query-save-button:hover { background: var(--accent-hover); }
.query-saved-link { color: var(--good); font-size: 10.5px; font-weight: 800; }

/* Assistant placeholder while an ephemeral answer is in flight. */
.query-message--pending { opacity: .9; }
.query-thinking {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--ink-faint);
  font-size: 13px;
  font-weight: 700;
}
.query-thinking-dots { display: inline-flex; gap: 3px; }
.query-thinking-dots i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  opacity: .25;
  animation: query-thinking 1.2s ease-in-out infinite;
}
.query-thinking-dots i:nth-child(2) { animation-delay: .15s; }
.query-thinking-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes query-thinking {
  0%, 60%, 100% { opacity: .22; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-3px); }
}
@media (prefers-reduced-motion: reduce) {
  .query-thinking-dots i { animation: none; opacity: .55; }
  .query-home.is-chatting .query-thread { scroll-behavior: auto; }
}

/* ---- Guest ----------------------------------------------------------------- */
.query-guest-card {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--cp-card);
  box-shadow: var(--shadow-soft);
}
.query-guest-mark {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 15px;
  background: var(--accent-soft);
  color: var(--accent);
  flex: none;
}
.query-guest-mark svg { width: 25px; height: 25px; }
.query-guest-card h1 { font-size: 26px; font-weight: 800; letter-spacing: -.03em; }
.query-guest-card p { margin-top: 7px; max-width: 58ch; color: var(--muted); font-size: 13px; line-height: 1.6; }
.query-guest-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }

/* ---- Saved conversation ---------------------------------------------------- */
.query-saved { width: min(860px, 100%); }
.query-saved-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 8px 0 18px;
  border-bottom: 1px solid var(--line);
}
.query-saved-title { min-width: 0; }
.query-back {
  display: inline-block;
  margin-bottom: 12px;
  color: var(--ink-faint);
  font-size: 11px;
  font-weight: 800;
}
.query-back:hover { color: var(--accent); }
.query-saved-title h1 { font-size: 24px; line-height: 1.25; letter-spacing: -.03em; font-weight: 800; overflow-wrap: anywhere; }
.query-saved-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 7px; color: var(--ink-faint); font-size: 10.5px; font-weight: 700; }
.query-saved-actions { display: flex; align-items: center; gap: 5px; flex: none; }
.query-share { min-height: 30px; }
.query-saved-menu { position: relative; }
.query-saved-menu summary {
  display: grid;
  place-items: center;
  width: 31px;
  height: 31px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  list-style: none;
  cursor: pointer;
}
.query-saved-menu summary::-webkit-details-marker { display: none; }
.query-saved-menu summary:hover { background: var(--paper); color: var(--ink); }
.query-saved-menu-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 30;
  width: 236px;
  padding: 14px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--cp-card);
  box-shadow: 0 18px 44px -22px rgba(60, 30, 70, .35);
  display: grid;
  gap: 10px;
}
.query-saved-menu-panel button,
.query-saved-menu-panel a,
.query-saved-menu-panel label,
.query-saved-menu-panel input { font-size: 11px; }
.query-saved-menu-panel input[type="text"] { width: 100%; margin: 5px 0; padding: 6px; border: 1px solid var(--line); border-radius: 5px; }
.query-saved-menu-panel button,
.query-saved-menu-panel input[type="submit"] { padding: 0; border: 0; background: transparent; color: var(--accent); text-align: left; }
.query-saved-menu-panel .query-danger { color: var(--bad) !important; }
.query-saved .query-saved-thread { max-height: none; overflow: visible; padding: 6px 0 0; }
.query-saved-thread .study-chat__message { padding: 18px 2px; }
.query-saved-thread .study-chat__message--user .study-chat__prose { background: var(--accent-wash, #f8f0f9); color: var(--ink); }
.query-saved-thread .study-chat__message--assistant .study-chat__prose { background: transparent; padding: 0; }
.query-saved-compose { margin-top: 18px; padding-top: 4px; }
.query-followup {
  background: var(--cp-card);
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  box-shadow: var(--shadow-soft);
}
.query-followup:focus-within { border-color: rgba(122, 62, 134, .38); box-shadow: 0 0 0 3px rgba(122, 62, 134, .07), var(--shadow-soft); }
.query-followup-input { display: flex; align-items: flex-end; gap: 10px; padding: 10px 12px 4px 16px; }
.query-followup-input textarea {
  flex: 1;
  width: 100%;
  min-height: 38px;
  max-height: 160px;
  resize: none;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.5;
  font-weight: 600;
}
.query-followup-input textarea::placeholder { color: var(--ink-faint); font-weight: 600; }
.query-followup-foot { display: flex; align-items: center; gap: 8px; min-height: 30px; padding: 0 12px 9px 14px; }
.query-saved-compose > form + form { margin-top: 8px; }

/* ---- History page ---------------------------------------------------------- */
.query-history-page { width: min(860px, 100%); }
.query-history-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin-bottom: 20px; }
.query-history-head h1 { margin-top: 4px; font-size: 30px; font-weight: 800; letter-spacing: -.035em; }
.query-history-head p { margin-top: 5px; color: var(--muted); font-size: 12px; }
.query-history-search {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  padding: 6px 6px 6px 13px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--cp-card);
}
.query-history-search svg { width: 14px; height: 14px; color: var(--faint); flex: none; }
.query-history-search input[type="search"] { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font-size: 12px; font-weight: 700; }
.query-history-search input[type="search"]::placeholder { color: var(--ink-faint); }
.query-history-search input[type="submit"] { flex: none; padding: 5px 12px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: 10.5px; font-weight: 800; }

/* ---- Practice header ------------------------------------------------------- */
.practice-page { width: min(1040px, 100%); margin: 0 auto; }
.practice-page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 4px;
}
.practice-page-head h1 { margin-top: 4px; font-size: 30px; font-weight: 800; letter-spacing: -.035em; }
.practice-page-head p { margin-top: 5px; max-width: 60ch; color: var(--muted); font-size: 12px; line-height: 1.5; }
.practice-page-space { flex: none; padding: 4px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: 10.5px; font-weight: 800; }
.practice-library {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 18px;
  padding: 16px 2px 4px;
  border-top: 1px solid var(--line);
}
.practice-library__label { color: var(--ink-faint); font-size: 9.5px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.practice-library a { color: var(--ink-muted, var(--ink-soft)); font-size: 11.5px; font-weight: 800; }
.practice-library a:hover { color: var(--accent); }

/* ---- Placeholder pages ----------------------------------------------------- */
.suggestions-page, .cpd-page { width: min(860px, 100%); margin: 0 auto; }
.simple-page-head { margin: 6px 0 22px; }
.simple-page-head h1 { margin-top: 4px; font-size: 30px; font-weight: 800; letter-spacing: -.035em; }
.simple-page-head p { margin-top: 7px; max-width: 64ch; color: var(--muted); font-size: 13px; line-height: 1.6; }
.query-placeholder-card {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--cp-card);
  box-shadow: var(--shadow-soft);
}
.query-placeholder-icon {
  display: grid;
  place-items: center;
  width: 50px;
  height: 50px;
  border-radius: 14px;
  background: var(--accent-soft);
  color: var(--accent);
  flex: none;
}
.query-placeholder-icon svg { width: 24px; height: 24px; }
.query-placeholder-card h2 { margin-top: 8px; font-size: 19px; font-weight: 800; letter-spacing: -.02em; }
.query-placeholder-card p { margin-top: 6px; max-width: 60ch; color: var(--muted); font-size: 12.5px; line-height: 1.6; }
.query-placeholder-card .cp-btn { margin-top: 14px; }
.query-placeholder-card .cp-btn:disabled { opacity: .55; cursor: not-allowed; }
.query-placeholder-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 12px; }
.query-placeholder-mini { padding: 15px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255, 253, 255, .58); }
.query-placeholder-mini h3 { margin-top: 8px; font-size: 12.5px; font-weight: 800; }
.query-placeholder-mini p { margin-top: 3px; color: var(--muted); font-size: 10.5px; line-height: 1.5; font-weight: 700; }

/* ---- CPD preview ----------------------------------------------------------- */
.cpd-preview-card { margin-top: 12px; padding: 20px; border: 1px solid var(--line); border-radius: 18px; background: var(--cp-card); box-shadow: var(--shadow-soft); }
.cpd-preview-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.cpd-preview-head h3 { margin-top: 5px; font-size: 16px; font-weight: 800; }
.cpd-preview-card .bar { height: 7px; border-radius: 999px; background: var(--paper-2); overflow: hidden; }
.cpd-preview-card .bar > span { display: block; height: 100%; border-radius: inherit; background: var(--accent); }
.cpd-preview-meta { display: flex; justify-content: space-between; gap: 12px; margin-top: 6px; color: var(--ink-faint); font-size: 10.5px; font-weight: 700; }
.cpd-preview-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 20px; margin-top: 18px; }
.cpd-preview-grid div { display: flex; justify-content: space-between; gap: 12px; padding-top: 8px; border-top: 1px solid var(--line); color: var(--muted); font-size: 10.5px; font-weight: 700; }
.cpd-preview-grid b { color: var(--accent); }

/* ---- Mobile tab bar -------------------------------------------------------- */
.app-tabbar { display: none; }

@media (max-width: 820px) {
  .app-shell { padding-bottom: 92px; }
  .app-shell > .app-sidebar.is-drawer-open { z-index: 80; }
  body:has(.app-sidebar.is-drawer-open) .app-tabbar { display: none; }
  .app-tabbar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 70;
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 2px;
    padding: 7px 8px calc(7px + env(safe-area-inset-bottom));
    background: rgba(255, 253, 255, .95);
    border-top: 1px solid var(--line-strong);
    backdrop-filter: blur(14px);
  }
  .app-tabbar__item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-height: 48px;
    border-radius: 10px;
    color: var(--ink-faint);
    font-size: 9.5px;
    font-weight: 800;
  }
  .app-tabbar__item .dashboard-icon { width: 18px; height: 18px; }
  .app-tabbar__item.is-active { background: var(--accent-wash, #f8f0f9); color: var(--accent); }
  .query-home { padding-top: 4px; }
  .query-home.is-chatting {
    height: calc(100vh - 9rem);
    height: calc(100dvh - 9rem);
    min-height: 420px;
  }
  .query-chat-head { padding: 10px 12px; }
  .query-chat-badge { display: none; }
  .query-home.is-chatting .query-thread { padding: 16px 14px 6px; }
  .query-home.is-chatting .query-chat-composer { padding: 8px; }
  .query-composer-input textarea { font-size: 16px; }
  .query-guest-card { flex-direction: column; padding: 22px; }
  .query-saved-head { flex-direction: column; gap: 12px; }
  .query-saved-actions { width: 100%; }
  .query-placeholder-card { flex-direction: column; gap: 14px; padding: 20px; }
  .query-placeholder-grid { grid-template-columns: 1fr; }
  .query-history-head { align-items: flex-start; flex-direction: column; }
}

@media (max-width: 600px) {
  .query-home { width: 100%; }
  .query-home.is-chatting { height: calc(100vh - 8rem); height: calc(100dvh - 8rem); }
  .query-chat-title { display: none; }
  .query-chat-head-main { flex: 0 0 auto; }
  .query-chat-head .query-thread-actions-right { gap: 8px; }
  .query-composer { border-radius: 19px; }
  .query-composer-input { padding: 15px 12px 6px 15px; }
  .query-composer-tools { padding: 2px 10px 10px 12px; }
  .query-history-bar { align-items: flex-start; }
  .query-history-note { line-height: 1.4; }
  .query-history-settings-summary { white-space: nowrap; }
  .query-history-menu { width: min(330px, calc(100vw - 32px)); }
  .query-audience-menu { width: min(278px, calc(100vw - 32px)); }
  .query-user-bubble { max-width: 92%; }
  .query-section-head h2 { font-size: 13px; }
  .cpd-preview-grid { grid-template-columns: 1fr; }
  .query-saved-title h1 { font-size: 21px; }
}
