/* ── Detail view ─────────────────────────────────────────────────── */
#detail { height: calc(100vh - 60px); height: calc(100dvh - 60px); overflow: hidden; }

/* Mobile files drawer scaffolding — inert on desktop, activated via responsive.css */
.files-drawer-overlay {
  display: none;
  position: fixed; inset: 0; z-index: 450;
  background: rgba(12,28,56,0.42);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
}

.mobile-files-btn {
  display: none;
  align-items: center; gap: 0.3rem;
  background: var(--surface);
  border: 1px solid var(--border-md);
  color: var(--text-2);
  padding: 0.35rem 0.55rem;
  border-radius: var(--r-sm);
  font-family: var(--font); font-size: 0.78rem; font-weight: 700;
  cursor: pointer; transition: all 0.14s ease;
  white-space: nowrap;
  box-shadow: var(--sh-xs);
}
.mobile-files-btn:hover { background: #fff; color: var(--text); border-color: var(--border-hi); }
.mobile-files-btn-count {
  font-family: var(--mono); font-size: 0.68rem;
  background: var(--blue-dim); color: var(--blue);
  padding: 0.04rem 0.38rem; border-radius: 999px;
  min-width: 1.2em; text-align: center; line-height: 1.2;
}
.files-panel-close {
  display: none;
  background: none; border: none; cursor: pointer;
  color: var(--text-3); font-size: 1.1rem;
  padding: 0.2rem 0.4rem; border-radius: var(--r-sm); line-height: 1;
}
.files-panel-close:hover { background: var(--hover); color: var(--text); }

.detail-bar {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.75rem 1.5rem;
  background: rgba(237,245,255,0.75);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.back-btn {
  display: inline-flex; align-items: center; gap: 0.35rem;
  background: none; border: none; cursor: pointer;
  color: var(--text-2); font-size: 0.84rem;
  font-family: var(--font); font-weight: 700;
  padding: 0.28rem 0.55rem; border-radius: var(--r-sm);
  transition: all 0.14s;
}
.back-btn:hover { background: var(--hover); color: var(--text); }
.bc-sep { color: var(--text-3); font-size: 0.8rem; }
.detail-title {
  font-size: 0.9rem; font-weight: 800; color: var(--text);
}

.detail-body {
  display: grid;
  grid-template-columns: 298px 1fr;
  flex: 1; overflow: hidden;
  height: calc(100% - 48px);
}

/* ── Files panel ─────────────────────────────────────────────────── */
.files-panel {
  display: flex; flex-direction: column;
  background: rgba(255,255,255,0.55);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-right: 1px solid var(--border);
  overflow: hidden;
}

.files-panel-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.9rem 1rem 0.75rem; border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.files-search-wrap {
  padding: 0.5rem 0.75rem; border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.files-search-input {
  width: 100%; box-sizing: border-box;
  background: var(--input-bg, var(--hover)); border: 1px solid var(--border-md);
  border-radius: var(--r); padding: 0.3rem 0.6rem;
  font-size: 0.8rem; color: var(--text-1); outline: none;
}
.files-search-input:focus { border-color: var(--accent); }
.panel-label {
  font-size: 0.7rem; font-weight: 800; letter-spacing: 0.07em;
  text-transform: uppercase; color: var(--text-3);
}

.files-scroll { flex: 1; overflow-y: auto; padding: 0.35rem 0.4rem; }
.files-scroll::-webkit-scrollbar { width: 3px; }
.files-scroll::-webkit-scrollbar-thumb { background: var(--border-md); border-radius: 2px; }
.file-list { list-style: none; }

/* File rows */
.file-row {
  display: flex; align-items: center; gap: 0.4rem;
  padding: 0.48rem 0.55rem; border-radius: var(--r-sm);
  font-size: 0.82rem; transition: background 0.12s;
}
.file-row:hover { background: var(--hover); }
.file-row.disabled { opacity: 0.38; }
.file-row.pending { opacity: 0.5; }
.file-row.pending .file-name::after {
  content: ' ●';
  color: var(--blue);
  animation: pulse 1.2s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.2; }
}
.file-row.failed .file-name::after {
  content: ' ✕';
  color: var(--red);
  font-size: 0.75em;
}

/* Folder rows */
.folder-row { margin-bottom: 1px; }
.folder-header {
  display: flex; align-items: center; gap: 0.4rem;
  padding: 0.48rem 0.55rem; border-radius: var(--r-sm);
  cursor: pointer; transition: background 0.12s; user-select: none;
}
.folder-header:hover { background: var(--hover); }
.folder-row.disabled > .folder-header { opacity: 0.38; }

.folder-header--nested {
  border-left: 2px solid var(--border-md);
  padding-left: calc(0.55rem - 2px);
}
.folder-header--nested:hover { border-left-color: var(--blue); }
.folder-header[draggable="true"] { cursor: grab; }
.folder-header[draggable="true"]:active { cursor: grabbing; }
.folder-header.dragging { opacity: 0.35; }

.folder-arrow {
  width: 13px; height: 13px;
  background: none; border: none; cursor: pointer;
  color: var(--text-3); font-size: 0.56rem;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: transform 0.18s ease;
}
.folder-arrow.open { transform: rotate(90deg); }

.folder-name-label {
  flex: 1; font-size: 0.82rem; font-weight: 700; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.folder-file-count {
  font-family: var(--mono); font-size: 0.67rem; color: var(--text-3); flex-shrink: 0;
  background: var(--blue-dim); padding: 0.08rem 0.36rem; border-radius: 999px;
}

.folder-files {
  list-style: none; padding-left: 0.9rem;
  max-height: 0; overflow: hidden; transition: max-height 0.25s ease;
}


.file-name {
  flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: var(--text); font-weight: 600; font-size: 0.82rem;
  text-decoration: none;
}
a.file-name:hover { color: var(--blue); text-decoration: underline; }
.file-chunks {
  font-family: var(--mono); font-size: 0.66rem; color: var(--text-3); flex-shrink: 0;
  background: rgba(99,155,230,0.09); padding: 0.08rem 0.34rem; border-radius: 999px;
}

.inline-rename-input {
  font: inherit; font-size: 0.82rem; font-weight: 600;
  flex: 1; min-width: 0;
  background: var(--surface-s); color: var(--text);
  border: 1.5px solid var(--accent); border-radius: 4px;
  padding: 1px 5px; outline: none;
}
.file-row[draggable="true"] { cursor: grab; }
.file-row[draggable="true"]:active { cursor: grabbing; }
.file-row.dragging { opacity: 0.35; }
.drop-over { background: rgba(99,102,241,0.07) !important; outline: 2px dashed var(--accent); outline-offset: -2px; border-radius: var(--r-sm); }
.root-drop-zone {
  padding: 0.32rem 0.55rem; font-size: 0.7rem; font-weight: 700;
  color: var(--text-3); text-transform: uppercase; letter-spacing: 0.06em;
  border-radius: var(--r-sm); transition: background 0.12s;
  border: 1.5px dashed transparent; margin-bottom: 0.2rem;
}
.root-drop-zone.drop-over { border-color: var(--accent); color: var(--accent); }

/* Toggle switch */
.toggle { position: relative; width: 28px; height: 16px; flex-shrink: 0; }
.toggle input { opacity: 0; width: 0; height: 0; position: absolute; }
.toggle-track {
  position: absolute; inset: 0;
  background: #dde8f5; border: 1px solid var(--border-md);
  border-radius: 999px; cursor: pointer; transition: all 0.18s ease;
}
.toggle-track::after {
  content: ''; position: absolute;
  width: 10px; height: 10px;
  background: #fff; border-radius: 50%;
  top: 2px; left: 2px; transition: all 0.18s ease;
  box-shadow: 0 1px 3px rgba(30,90,180,0.18);
}
.toggle input:checked + .toggle-track {
  background: linear-gradient(135deg, var(--blue), var(--blue-2));
  border-color: transparent;
}
.toggle input:checked + .toggle-track::after { left: 14px; }

/* Upload area — minimal, integrated */
.upload-area {
  padding: 0.65rem 0.75rem; flex-shrink: 0;
  border-top: 1px solid var(--border);
  background: rgba(237,245,255,0.5);
}
.upload-folder-select {
  width: 100%; margin-bottom: 0.45rem;
  padding: 0.36rem 0.55rem;
  background: rgba(255,255,255,0.85); border: 1px solid var(--border);
  border-radius: var(--r-sm); color: var(--text-2);
  font-family: var(--font); font-size: 0.78rem; font-weight: 500;
  cursor: pointer; outline: none; appearance: none;
  transition: border-color 0.14s;
}
.upload-folder-select:focus { border-color: var(--blue); }

.drop-zone {
  border: 1.5px dashed rgba(99,155,230,0.28);
  border-radius: var(--r-sm); padding: 0.75rem 0.7rem;
  text-align: center; cursor: pointer;
  transition: all 0.18s ease; background: transparent;
}
.drop-zone:hover, .drop-zone.dragover {
  border-color: var(--blue); background: var(--blue-dim);
}
.dz-icon { font-size: 1rem; margin-bottom: 0.2rem; opacity: 0.4; }
.dz-text { font-size: 0.76rem; color: var(--text-2); font-weight: 600; }
.dz-hint { font-size: 0.67rem; color: var(--text-3); margin-top: 0.15rem; font-weight: 500; }

/* ── Query panel ─────────────────────────────────────────────────── */
.query-panel {
  display: flex; flex-direction: column; overflow: hidden;
  background: rgba(255,255,255,0.50);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.query-top {
  padding: 1.25rem 1.6rem 1.1rem; border-bottom: 1px solid var(--border); flex-shrink: 0;
}

/* Model pills */
.model-picker { display: flex; gap: 0.35rem; margin-bottom: 0.55rem; flex-wrap: wrap; }
.model-btn {
  display: inline-flex; align-items: center; gap: 0.32rem;
  padding: 0.3rem 0.72rem; border-radius: var(--r-pill);
  border: 1px solid var(--border-md);
  background: rgba(255,255,255,0.75); color: var(--text-2);
  font-family: var(--font); font-size: 0.78rem; font-weight: 700;
  cursor: pointer; transition: all 0.14s ease; white-space: nowrap;
  box-shadow: var(--sh-xs);
}
.model-btn:hover { background: #fff; color: var(--text); border-color: var(--border-hi); }
.model-btn.active {
  background: linear-gradient(135deg, var(--blue-dim), rgba(20,217,196,0.08));
  border-color: rgba(59,130,246,0.3);
  color: var(--blue);
  box-shadow: 0 2px 8px rgba(59,130,246,0.12);
}
.model-tag {
  font-family: var(--mono); font-size: 0.63rem;
  padding: 0.08rem 0.3rem; border-radius: 999px; font-weight: 500;
}
.tag-fast   { background: var(--green-dim);  color: var(--green); }
.tag-mid    { background: var(--amber-dim);  color: var(--amber); }
.tag-best   { background: var(--purple-dim); color: var(--purple); }

/* Question input — the main event */
.question-wrap {
  display: flex; gap: 0.6rem; align-items: center;
  background: rgba(255,255,255,0.92);
  border: 1.5px solid var(--border-md);
  border-radius: var(--r-xl);
  padding: 0.4rem 0.4rem 0.4rem 1.15rem;
  box-shadow: var(--sh-sm);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.question-wrap:focus-within {
  border-color: rgba(59,130,246,0.42);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.09), var(--sh-sm);
  background: #fff;
}
.question-input {
  flex: 1; padding: 0.6rem 0;
  background: transparent; border: none;
  color: var(--text);
  font-family: var(--font); font-size: 0.97rem; font-weight: 500;
  outline: none;
}
.question-input::placeholder { color: var(--text-3); font-weight: 500; }

/* Query tips */
.query-tips {
  font-size: 0.78rem; color: var(--text-3);
  border-top: 1px solid var(--border-sm);
  padding: 0.4rem 0 0;
  margin-top: 0.1rem;
}
.query-tips summary {
  cursor: pointer; user-select: none; font-weight: 600;
  list-style: none; display: flex; align-items: center; gap: 0.3rem;
  color: var(--text-3); padding: 0.15rem 0;
  transition: color 0.15s;
}
.query-tips summary::-webkit-details-marker { display: none; }
.query-tips summary::after { content: '▾'; font-size: 0.7rem; transition: transform 0.15s; }
.query-tips[open] summary::after { transform: rotate(-180deg); }
.query-tips summary:hover { color: var(--text-2); }
.query-tips-body {
  display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem 1.25rem;
  padding: 0.6rem 0 0.25rem;
}
.tips-col strong { display: block; font-weight: 700; color: var(--text-2); margin-bottom: 0.35rem; font-size: 0.77rem; }
.tips-col ul { margin: 0; padding: 0 0 0 1rem; display: flex; flex-direction: column; gap: 0.25rem; }
.tips-col li { line-height: 1.45; }

/* Answer area */
.answer-scroll { flex: 1; overflow-y: auto; padding: 1.5rem 1.6rem 1.4rem; }
.answer-scroll::-webkit-scrollbar { width: 3px; }
.answer-scroll::-webkit-scrollbar-thumb { background: var(--border-md); border-radius: 2px; }

.answer-placeholder {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  height: 100%; min-height: 180px;
  gap: 0.55rem; color: var(--text-3); font-size: 0.88rem; font-weight: 500; text-align: center;
}
.ph-icon { font-size: 1.4rem; opacity: 0.25; }
.ph-hint { font-size: 0.8rem; color: var(--text-3); font-weight: 500; }

/* Answer card — wraps rendered content to separate it from the chrome */
.answer-card {
  width: 100%;
  box-sizing: border-box;
  background: rgba(255,255,255,0.72);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 1.5rem 1.75rem;
  box-shadow: var(--sh-xs);
  position: relative;
}
.answer-card::before {
  content: '';
  position: absolute; top: 0; left: 0; bottom: 0; width: 3px;
  background: linear-gradient(180deg, var(--blue), var(--blue-2));
  border-radius: 3px 0 0 3px;
}

.answer-text {
  font-size: 0.97rem; line-height: 1.82; color: var(--text); font-weight: 500;
}
.answer-text.streaming::after {
  content: '▋'; color: var(--blue);
  animation: blink 0.65s step-end infinite;
}
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:0} }

/* Loading dots */
.loading-dots { display: inline-flex; gap: 4px; align-items: center; }
.loading-dots span {
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--blue); animation: ld 1.1s ease infinite;
}
.loading-dots span:nth-child(2) { animation-delay: 0.14s; }
.loading-dots span:nth-child(3) { animation-delay: 0.28s; }
@keyframes ld {
  0%,80%,100% { transform: scale(0.55); opacity: 0.35; }
  40%          { transform: scale(1); opacity: 1; }
}

/* Sources — supporting layer, not competing with the answer */
.sources-section {
  border-top: 1px solid var(--border); padding: 0.85rem 1.6rem 1rem;
  flex-shrink: 0; max-height: 36vh; overflow-y: auto;
  background: rgba(237,245,255,0.30);
}
.sources-section::-webkit-scrollbar { width: 3px; }
.sources-section::-webkit-scrollbar-thumb { background: var(--border-md); border-radius: 2px; }
.sources-label {
  font-size: 0.7rem; font-weight: 800; letter-spacing: 0.07em;
  text-transform: uppercase; color: var(--text-3); margin-bottom: 0.7rem;
}
/* (legacy .source-card styles kept for compatibility but grouped sources are used) */
.score-high    { background: var(--green-dim); color: var(--green); }
.score-mid     { background: var(--amber-dim); color: var(--amber); }
.score-low     { background: var(--red-dim);   color: var(--red); }
.score-keyword { background: var(--blue-dim); color: var(--blue-2); font-size: 0.7rem; letter-spacing: 0.03em; text-transform: uppercase; }
.score-hybrid  { background: var(--green-dim); color: var(--green); }

/* ── Hide destructive actions until hover ────────────────────────── */
.file-row .btn-icon,
.folder-header .btn-icon { opacity: 0; transition: opacity 0.12s ease; }
.file-row:hover .btn-icon,
.folder-header:hover .btn-icon { opacity: 1; }

/* ── Rendered markdown in answer ─────────────────────────────────── */
.answer-text,
.chat-turn-answer { white-space: normal; }
.answer-text p,
.chat-turn-answer p { margin-bottom: 0.8rem; }
.answer-text p:last-child,
.chat-turn-answer p:last-child { margin-bottom: 0; }
.answer-text strong,
.chat-turn-answer strong { font-weight: 800; color: var(--text); }
.answer-text em,
.chat-turn-answer em { font-style: italic; }
.answer-text ul, .answer-text ol,
.chat-turn-answer ul, .chat-turn-answer ol { padding-left: 1.45rem; margin-bottom: 0.8rem; }
.answer-text li,
.chat-turn-answer li { margin-bottom: 0.22rem; }
.answer-text h1, .answer-text h2, .answer-text h3,
.chat-turn-answer h1, .chat-turn-answer h2, .chat-turn-answer h3 {
  font-weight: 800; color: var(--text); letter-spacing: -0.02em;
  margin-top: 1rem; margin-bottom: 0.45rem; line-height: 1.3;
}
.answer-text h1, .chat-turn-answer h1 { font-size: 1.2rem; }
.answer-text h2, .chat-turn-answer h2 { font-size: 1.05rem; }
.answer-text h3, .chat-turn-answer h3 { font-size: 0.95rem; }
.answer-text code,
.chat-turn-answer code {
  font-family: var(--mono); font-size: 0.84em;
  background: var(--blue-dim); border-radius: 4px; padding: 0.1em 0.36em;
  color: #1e5fa8;
}
.answer-text pre,
.chat-turn-answer pre {
  background: rgba(237,245,255,0.85); border: 1px solid var(--border);
  border-radius: var(--r); padding: 0.85rem 1rem;
  overflow-x: auto; margin-bottom: 0.8rem;
}
.answer-text pre code,
.chat-turn-answer pre code { background: none; padding: 0; color: var(--text); }
.answer-text blockquote,
.chat-turn-answer blockquote {
  border-left: 3px solid var(--border-hi); padding-left: 0.85rem;
  color: var(--text-2); margin-bottom: 0.8rem; font-style: italic;
}
.answer-text hr,
.chat-turn-answer hr { border: none; border-top: 1px solid var(--border); margin: 1rem 0; }

/* ── Model description line ──────────────────────────────────────── */
.model-desc {
  font-size: 0.78rem; font-weight: 500; color: var(--text-2);
  margin-bottom: 0.85rem; margin-top: -0.4rem;
  min-height: 1.15em; transition: opacity 0.18s;
}

/* ── Grouped source citations ────────────────────────────────────── */
.source-group {
  border: 1px solid var(--border); border-radius: var(--r);
  overflow: hidden; margin-bottom: 0.5rem;
  background: rgba(255,255,255,0.72); transition: border-color 0.14s;
}
.source-group:hover { border-color: var(--border-md); }
.source-group-header {
  display: flex; align-items: center; gap: 0.55rem;
  padding: 0.55rem 0.75rem; cursor: pointer; user-select: none;
  transition: background 0.12s;
}
.source-group-header:hover { background: var(--hover); }
.source-group-fname {
  flex: 1; font-size: 0.83rem; font-weight: 700; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.source-passage-count {
  font-family: var(--mono); font-size: 0.68rem; color: var(--text-3);
  background: var(--blue-dim); border-radius: 999px;
  padding: 0.1rem 0.42rem; flex-shrink: 0;
}
.source-group-score {
  font-family: var(--mono); font-size: 0.69rem; font-weight: 500;
  padding: 0.12rem 0.42rem; border-radius: 999px; white-space: nowrap; flex-shrink: 0;
}
.source-group-chevron { font-size: 0.68rem; color: var(--text-3); transition: transform 0.18s; flex-shrink: 0; }
.source-group-chevron.open { transform: rotate(180deg); }
.source-chunks-list { border-top: 1px solid var(--border); display: none; }
.source-chunks-list.open { display: block; }
.source-chunk-item {
  display: flex; align-items: flex-start; gap: 0.55rem;
  padding: 0.55rem 0.75rem; border-bottom: 1px solid var(--border);
  font-size: 0.79rem; line-height: 1.6; color: var(--text-2); font-weight: 500;
}
.source-chunk-item:last-child { border-bottom: none; }
.fn-ref {
  color: var(--accent); font-size: 0.75em; vertical-align: super;
  text-decoration: none; cursor: pointer; font-weight: 600;
}
.fn-ref:hover { text-decoration: underline; }
.fn-flash { animation: fn-flash-kf 1.2s ease-out; }
@keyframes fn-flash-kf {
  0%   { background: rgba(99,102,241,0.25); }
  100% { background: transparent; }
}

/* ── Full-doc modal ─────────────────────────────────────────────── */
.doc-modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.55);
  z-index: 1000; display: flex; align-items: center; justify-content: center;
}
.doc-modal-box {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  width: min(780px, 92vw); max-height: 85vh; display: flex; flex-direction: column;
}
.doc-modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 1.25rem; border-bottom: 1px solid var(--border); gap: 1rem; flex-shrink: 0;
}
.doc-modal-title {
  font-weight: 600; font-size: 0.95rem; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; flex: 1;
}
.doc-modal-actions { display: flex; align-items: center; gap: 0.5rem; flex-shrink: 0; }
.doc-modal-dl-btn {
  font-size: 0.8rem; padding: 0.3rem 0.75rem; border-radius: 6px;
  background: var(--accent); color: #fff; cursor: pointer; border: none; font-weight: 500;
}
.doc-modal-dl-btn:hover { opacity: 0.85; }
.doc-modal-close {
  background: none; border: none; font-size: 1.1rem; cursor: pointer;
  color: var(--text-2); padding: 0.25rem 0.5rem; border-radius: 4px;
}
.doc-modal-close:hover { background: var(--hover); }
.doc-modal-body {
  overflow-y: auto; padding: 1.25rem; flex: 1;
  font-size: 0.85rem; line-height: 1.7; color: var(--text-2);
}
.doc-chunk { padding: 0.4rem 0.75rem; border-radius: 6px; margin-bottom: 0.25rem; white-space: pre-wrap; }
.doc-chunk-highlight { background: rgba(99,102,241,0.12); border-left: 3px solid var(--accent); }
.doc-view-btn {
  background: none; border: none; cursor: pointer; font-size: 0.85rem;
  padding: 0 0.3rem; color: var(--text-3); flex-shrink: 0; line-height: 1;
}
.doc-view-btn:hover { color: var(--accent); }

.source-chunk-score {
  font-family: var(--mono); font-size: 0.68rem; font-weight: 500;
  padding: 0.1rem 0.36rem; border-radius: 999px; flex-shrink: 0; margin-top: 0.12rem;
}
.source-chunk-text {
  flex: 1; white-space: pre-wrap; word-break: break-word;
  max-height: 4.8em; overflow: hidden; position: relative;
  transition: max-height 0.22s ease;
}
.source-chunk-text.expanded { max-height: 400px; }
.source-chunk-text::after {
  content: '';
  position: absolute; bottom: 0; left: 0; right: 0; height: 1.4em;
  background: linear-gradient(transparent, rgba(255,255,255,0.88));
  pointer-events: none; transition: opacity 0.18s;
}
.source-chunk-text.expanded::after { opacity: 0; }
.source-chunk-text mark {
  background: rgba(245,158,11,0.16); color: #b45309; border-radius: 2px; padding: 0 2px;
}

/* ── Utilities ───────────────────────────────────────────────────── */
.empty-note { color: var(--text-3); font-size: 0.8rem; font-weight: 500; padding: 0.4rem 0.55rem; display: block; }

.upload-empty-hint {
  display: flex; flex-direction: column; align-items: center;
  padding: 1.6rem 1rem 1rem; gap: 0.4rem; text-align: center; list-style: none;
}
.upload-empty-hint svg { opacity: 0.2; margin-bottom: 0.2rem; }
.upload-empty-hint strong { font-size: 0.88rem; font-weight: 700; color: var(--text-2); }
.upload-empty-hint span { font-size: 0.8rem; color: var(--text-3); line-height: 1.5; }
.upload-empty-hint .hint-formats { font-size: 0.75rem; color: var(--text-3); margin-top: 0.2rem; letter-spacing: 0.02em; }

.ph-try { display: flex; flex-wrap: wrap; gap: 0.4rem; justify-content: center; margin-top: 0.35rem; }
.ph-try-chip {
  font-size: 0.75rem; font-weight: 500; color: var(--text-2);
  background: var(--surface-2); border: 1px solid var(--border-md);
  border-radius: var(--r-sm); padding: 0.25rem 0.6rem;
  cursor: pointer; transition: border-color 0.15s, color 0.15s;
}
.ph-try-chip:hover { border-color: var(--blue); color: var(--blue); }
