/* Cipher, the assistant at the top right: a launcher in the header next to Account, and a panel docked to the right
   side. It uses the page's own colour tokens (the workspace or the clinical pages), so it looks at home on both. */
.cipher-launch, body:not(.auth-page) .cipher-launch {
  display: flex; align-items: center; gap: 8px; width: 100%; min-height: 0; padding: 8px 12px; text-align: left;
  border: 0; border-radius: 4px; background: transparent; color: var(--text); cursor: pointer; font: inherit; font-size: 14px; }
.cipher-launch:hover, body:not(.auth-page) .cipher-launch:hover:not(:disabled) { background: var(--accent-soft); }
.cipher-launch:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.cipher-launch-name { font-weight: 600; }
.cipher-mark { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 50%;
  background: var(--accent); color: #fff; font-weight: 700; font-size: 14px; line-height: 1; letter-spacing: 0; }
.cipher-head .cipher-mark { width: 32px; height: 32px; font-size: 16px; }
@media (max-width: 600px) {
  .cipher-launch, body:not(.auth-page) .cipher-launch { padding: 0 8px 0 6px; }
}

.cipher-panel { position: fixed; top: 0; right: 0; bottom: 0; z-index: 70; width: 360px; max-width: 100vw; display: flex; flex-direction: column;
  background: var(--card); color: var(--text); border-left: 1px solid var(--line); box-shadow: -10px 0 30px rgba(0, 0, 0, 0.12); }
.cipher-panel[hidden] { display: none; }
.cipher-head { display: flex; align-items: center; gap: 10px; padding: 14px 12px 12px 16px; border-bottom: 1px solid var(--line); }
.cipher-title { display: flex; flex-direction: column; line-height: 1.2; flex: 1; min-width: 0; }
.cipher-title strong { font-size: 16px; }
.cipher-title span { font-size: 12px; color: var(--muted); }
.cipher-min, body:not(.auth-page) .cipher-min { width: 34px; height: 34px; min-height: 0; padding: 0; border-radius: 50%; border: 1px solid var(--line);
  background: transparent; color: var(--text); font-size: 20px; line-height: 1; cursor: pointer; }
.cipher-min:hover { background: var(--accent-soft); }
.cipher-log { flex: 1 1 auto; overflow-y: auto; padding: 14px 14px 6px; display: flex; flex-direction: column; gap: 8px; }
.cipher-msg { max-width: 88%; padding: 8px 12px; border-radius: 14px; font-size: 14.5px; line-height: 1.45; white-space: normal; }
.cipher-msg .who { display: block; font-size: 11px; font-weight: 600; color: var(--muted); margin-bottom: 2px; }
.cipher-msg.from-cipher { align-self: flex-start; background: var(--accent-soft); border-bottom-left-radius: 4px; }
.cipher-msg.from-you { align-self: flex-end; background: var(--card); border: 1px solid var(--line); border-bottom-right-radius: 4px; }
.cipher-msg.thinking { color: var(--muted); }
.cipher-go { display: inline-block; margin-top: 6px; font-weight: 600; color: var(--accent); text-decoration: none; }
.cipher-go:hover { text-decoration: underline; }
.cipher-quick { display: flex; flex-wrap: wrap; gap: 6px; padding: 6px 14px 4px; }
.cipher-chip, body:not(.auth-page) .cipher-chip { min-height: 0; padding: 5px 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--card);
  color: var(--text); font-size: 12.5px; cursor: pointer; }
.cipher-chip:hover { border-color: var(--accent); color: var(--accent); }
.cipher-form { display: flex; align-items: flex-end; gap: 8px; padding: 8px 14px 6px; border-top: 1px solid var(--line); }
.cipher-input, body:not(.auth-page) .cipher-input { flex: 1; resize: none; min-height: 40px; max-height: 120px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 14px;
  background: var(--card); color: var(--text); font: inherit; font-size: 15px; line-height: 1.4; box-shadow: none; margin: 0; }
.cipher-input:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
.cipher-send, body:not(.auth-page) .cipher-send { width: 40px; height: 40px; min-height: 0; padding: 0; border-radius: 50%; border: 0; background: var(--accent); color: #fff;
  font-size: 18px; font-weight: 700; cursor: pointer; flex: 0 0 auto; }
.cipher-send:disabled { opacity: 0.5; cursor: default; }
.cipher-note { margin: 0; padding: 0 16px 10px; font-size: 11px; color: var(--muted); line-height: 1.4; }
@media (max-width: 680px) {
  .cipher-panel { width: 100vw; border-left: 0; }
}
@media (prefers-reduced-motion: no-preference) {
  .cipher-panel { animation: cipher-in 0.18s ease-out; }
  @keyframes cipher-in { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }
}
