/* Clinical pages: worklist, patients, patient, case review, import. Builds on tokens.css and base.css. */

/* ------------------------------------------------------------------ shared */
.back-link {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: var(--fs-sm); color: var(--text-secondary); font-weight: var(--fw-medium);
}
.back-link:hover { color: var(--text-primary); text-decoration: none; }
.code { font-weight: var(--fw-semibold); color: var(--text-primary); letter-spacing: 0.02em; }
a.code { color: var(--accent-text); }
.section-title { font-size: var(--fs-lg); margin-bottom: var(--sp-3); }
.alert-success { background: var(--success-soft); color: var(--success-text); }
.alert p + p { margin-top: var(--sp-2); }
.load-error { margin-top: var(--sp-4); }
.load-error-actions .btn { margin-top: var(--sp-1); }

.chips { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.chip {
  height: 30px; padding: 0 var(--sp-3);
  background: var(--surface-1); border: 1px solid var(--border-strong); border-radius: var(--radius-pill);
  color: var(--text-secondary); font-size: var(--fs-sm); font-weight: var(--fw-medium);
  transition: background-color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.chip:hover { background: var(--surface-2); color: var(--text-primary); }
.chip[aria-pressed="true"] { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 45%, transparent); color: var(--accent-text); }

/* table cells */
.cell-patient { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cell-visit { color: var(--text-secondary); font-size: var(--fs-sm); }
.cell-summary { color: var(--text-secondary); }
.cell-summary .sep { color: var(--text-muted); }
.cell-danger { color: var(--danger-text); }
.status { display: inline-flex; align-items: center; gap: var(--sp-2); white-space: nowrap; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.status-open { background: var(--accent); }
.status-busy { background: var(--accent); animation: pulse 1.2s ease-in-out infinite; }
.status-wait { background: transparent; box-shadow: inset 0 0 0 1.5px var(--text-muted); }
.status-failed { color: var(--danger-text); }
.status-signed { color: var(--success); }
.status-sub { color: var(--text-muted); font-size: var(--fs-sm); }
.status-sub::before { content: "·"; margin-right: var(--sp-2); }
.table tr.row-failed td:first-child { box-shadow: inset 3px 0 0 var(--danger); }

/* loading rows: same height as real rows, so nothing jumps when data arrives */
.table-skeleton { padding: var(--sp-2) 0; }
.skeleton-row { height: 57px; display: flex; align-items: center; padding: 0 var(--sp-4); border-bottom: 1px solid var(--border); }
.skeleton-row:last-child { border-bottom: 0; }
.skeleton-row .skeleton { width: 100%; }

/* ------------------------------------------------------------------ worklist */
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-4); margin-bottom: var(--sp-3); min-height: 30px; }
.worklist-count { font-size: var(--fs-sm); white-space: nowrap; }
.metrics .metric-button { font: inherit; color: inherit; }

/* ------------------------------------------------------------------ patient */
.patient-code { font-size: var(--fs-2xl); margin-top: var(--sp-2); letter-spacing: 0.02em; }
.page-head .back-link { margin-bottom: 2px; }
.reveal-slot:empty { display: none; }
.reveal-slot { margin-bottom: var(--sp-5); }
.reveal-panel { border-color: color-mix(in srgb, var(--attention) 45%, var(--border)); position: relative; overflow: hidden; }
.reveal-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-4); flex-wrap: wrap; margin-bottom: var(--sp-4); }
.reveal-head .card-title { margin: 0; }
.reveal-head .icon { color: var(--attention); }
.reveal-count { font-size: var(--fs-sm); }
.reveal-bar { position: absolute; left: 0; right: 0; top: 0; height: 3px; background: var(--attention-soft); }
.reveal-bar-fill { display: block; height: 100%; background: var(--attention); transform-origin: left; animation: reveal-drain linear forwards; }
@keyframes reveal-drain { from { transform: scaleX(1); } to { transform: scaleX(0); } }
.reveal-studies { margin-top: var(--sp-5); padding-top: var(--sp-4); border-top: 1px solid var(--border); }
.reveal-sub { font-size: var(--fs-md); margin-bottom: var(--sp-3); }
.reveal-note { display: flex; align-items: center; gap: 6px; margin-top: var(--sp-4); font-size: var(--fs-sm); }
.reveal-panel .dd, .reveal-panel dd { word-break: break-word; }

.timeline {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: var(--sp-4);
}
.visit { display: flex; flex-direction: column; gap: var(--sp-2); }
.visit-top { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); }
.visit-no { font-size: var(--fs-xs); font-weight: var(--fw-semibold); text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); }
.visit-name { font-size: var(--fs-lg); font-weight: var(--fw-semibold); }
.visit-date { display: flex; align-items: center; gap: var(--sp-3); font-size: var(--fs-sm); }
.visit-date .muted { width: 36px; }
.input-date { width: auto; height: var(--control-h-sm); font-size: var(--fs-sm); }
.visit-hint { font-size: var(--fs-xs); }
.seq-list { list-style: none; margin: var(--sp-1) 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.seq {
  padding: 2px var(--sp-2); border-radius: var(--radius-sm);
  background: var(--surface-2); color: var(--text-secondary); font-size: var(--fs-xs); font-weight: var(--fw-medium);
}
.seq-key { background: color-mix(in srgb, var(--lesion) 14%, transparent); color: var(--lesion); }
[data-theme="dark"] .seq-key { color: #7fd9b9; }
.visit-meta { font-size: var(--fs-sm); }
.visit-error { display: flex; align-items: flex-start; gap: 6px; font-size: var(--fs-sm); color: var(--danger-text); }
.visit-error .icon { margin-top: 2px; }
.suggest {
  display: flex; align-items: flex-start; gap: var(--sp-2);
  padding: var(--sp-3); border-radius: var(--radius-md);
  background: var(--attention-soft); color: var(--attention-text); font-size: var(--fs-sm);
}
.suggest > .icon { margin-top: 1px; }
.suggest-actions { margin-top: var(--sp-2); flex-wrap: wrap; }
.suggest .btn-ghost { color: var(--attention-text); }
.visit-foot { margin-top: auto; padding-top: var(--sp-2); display: flex; }
.visit-pending { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-sm); }

/* ------------------------------------------------------------------ import */
.import-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: var(--sp-4); align-items: start; }
.import-done:not(:empty) { margin-bottom: var(--sp-5); }
.import-done-actions { margin-top: var(--sp-2); }
.import-form .form-actions { justify-content: flex-start; }
.import-form .field { margin-top: var(--sp-4); }
.dropzone {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--sp-3);
  min-height: 196px; padding: var(--sp-5);
  border: 1.5px dashed var(--border-strong); border-radius: var(--radius-lg);
  background: var(--surface-0); text-align: center;
  transition: border-color var(--dur-fast) var(--ease), background-color var(--dur-fast) var(--ease);
}
.dropzone.is-over { border-color: var(--accent); background: var(--accent-soft); }
.drop-text { display: flex; flex-direction: column; align-items: center; gap: var(--sp-1); }
.drop-icon { display: grid; place-items: center; width: 44px; height: 44px; margin-bottom: var(--sp-2); border-radius: var(--radius-lg); background: var(--accent-soft); color: var(--accent-text); }
.drop-title { font-weight: var(--fw-semibold); }
.drop-file {
  display: flex; align-items: center; gap: var(--sp-3); width: 100%; max-width: 420px;
  padding: var(--sp-3); text-align: left;
  background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius-md);
}
.drop-file > .icon { color: var(--accent-text); }
.drop-file-name { font-weight: var(--fw-medium); word-break: break-all; }
.dropzone + .field-error { margin-top: var(--sp-2); }
.upload-progress { margin-top: var(--sp-4); }
.upload-progress p { margin-top: var(--sp-2); font-size: var(--fs-sm); }
.progress-track { position: relative; height: 4px; border-radius: 2px; background: var(--surface-3); overflow: hidden; }
.progress-indeterminate {
  position: absolute; top: 0; bottom: 0; width: 35%; border-radius: 2px; background: var(--accent);
  animation: indeterminate 1.3s var(--ease) infinite;
}
@keyframes indeterminate { from { left: -35%; } to { left: 100%; } }

/* ------------------------------------------------------------------ case: header and status */
.case-page { display: flex; flex-direction: column; height: 100%; min-height: 560px; }
.case-head {
  display: flex; align-items: flex-end; justify-content: space-between; gap: var(--sp-4);
  padding: var(--sp-4) var(--sp-5) var(--sp-3);
  min-height: 92px;
}
.case-status-page .case-head { padding: 0 0 var(--sp-5); }
.case-head-text { display: flex; flex-direction: column; min-width: 0; }
.case-crumbs { display: flex; align-items: center; gap: var(--sp-2); font-size: var(--fs-sm); }
.crumb-sep { color: var(--text-muted); }
.case-title { display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap; font-size: var(--fs-xl); margin-top: var(--sp-2); }
.case-type {
  padding: 2px var(--sp-2); border-radius: var(--radius-sm);
  background: var(--surface-2); color: var(--text-secondary);
  font-size: var(--fs-xs); font-weight: var(--fw-semibold); letter-spacing: 0;
}
.case-sub { margin-top: 2px; color: var(--text-secondary); font-size: var(--fs-sm); }
.case-head-actions { display: flex; gap: var(--sp-2); }

.banner {
  display: flex; align-items: flex-start; gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-5); border-radius: var(--radius-lg);
  border: 1px solid var(--border); background: var(--surface-1); box-shadow: var(--shadow-1);
}
.banner-icon { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; flex: none; }
.banner-info .banner-icon { background: var(--accent-soft); color: var(--accent-text); }
.banner-danger { border-color: color-mix(in srgb, var(--danger) 35%, var(--border)); }
.banner-danger .banner-icon { background: var(--danger-soft); color: var(--danger-text); }
.banner-success .banner-icon { background: var(--success-soft); color: var(--success-text); }
.banner-icon.is-spinning .icon { animation: spin 1.6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.banner-title { font-weight: var(--fw-semibold); padding-top: 7px; }
.banner-body { margin-top: var(--sp-1); color: var(--text-secondary); word-break: break-word; }
.banner-actions { flex: none; padding-top: 2px; }
.case-progress { margin-top: var(--sp-3); }

/* ------------------------------------------------------------------ case: workspace */
.case-ws {
  position: relative;
  flex: 1 1 auto; min-height: 0;
  display: grid; grid-template-columns: clamp(290px, 25%, 340px) minmax(0, 1fr) clamp(280px, 24%, 340px); gap: var(--sp-3);
  padding: 0 var(--sp-5) var(--sp-5);
}
.case-ws.no-assist { grid-template-columns: clamp(300px, 28%, 360px) minmax(0, 1fr); }
.case-queue, .case-assist {
  display: flex; flex-direction: column; min-height: 0;
  background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-1);
  overflow: hidden;
}
.panel-title { font-size: var(--fs-md); }
.assist-toggle { display: none; }

/* queue */
.queue-head { padding: var(--sp-4) var(--sp-4) var(--sp-3); border-bottom: 1px solid var(--border); }
.queue-title-row { display: flex; align-items: baseline; justify-content: space-between; gap: var(--sp-2); margin-bottom: var(--sp-3); }
.case-progress-text { font-size: var(--fs-sm); color: var(--text-muted); white-space: nowrap; }
.case-progress-text.is-done { color: var(--success-text); }
.input-sm { height: 32px; font-size: var(--fs-sm); }
.queue-msg:not(:empty) { padding: var(--sp-3) var(--sp-4) 0; }
.queue-msg .alert { margin: 0; font-size: var(--fs-sm); }
.queue-scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: var(--sp-2) 0 var(--sp-3); scrollbar-gutter: stable; }
.queue-foot {
  display: flex; align-items: center; gap: 6px;
  padding: var(--sp-2) var(--sp-4); border-top: 1px solid var(--border);
  font-size: var(--fs-xs); color: var(--text-muted);
}

.fgroup + .fgroup { margin-top: var(--sp-1); }
.fgroup-head {
  display: flex; align-items: center; gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-4); cursor: pointer; list-style: none; user-select: none;
}
.fgroup-head::-webkit-details-marker { display: none; }
.fgroup-head:hover { background: var(--surface-2); }
.fgroup-chevron { color: var(--text-muted); transition: transform var(--dur-fast) var(--ease); }
.fgroup[open] > .fgroup-head .fgroup-chevron { transform: rotate(90deg); }
.fgroup-count { color: var(--text-muted); font-size: var(--fs-sm); }
.fgroup-list { list-style: none; margin: 0; padding: 0 var(--sp-2); }

.fnd {
  position: relative; display: flex; align-items: flex-start; gap: var(--sp-1);
  border-radius: var(--radius-md);
  transition: background-color var(--dur-fast) var(--ease);
}
.fnd:hover { background: var(--surface-2); }
.fnd.is-selected { background: var(--accent-soft); }
.fnd.is-selected::before { content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px; border-radius: 2px; background: var(--accent); }
.fnd-main {
  flex: 1 1 auto; min-width: 0;
  display: flex; flex-direction: column; gap: 2px;
  padding: var(--sp-2) var(--sp-1) var(--sp-2) var(--sp-3);
  background: none; border: 0; border-radius: var(--radius-md); text-align: left; color: inherit;
}
.fnd-title { font-size: var(--fs-md); font-weight: var(--fw-medium); line-height: 1.35; }
.fnd-id { color: var(--text-muted); font-weight: var(--fw-regular); margin-right: 6px; font-size: var(--fs-xs); }
.fnd-sub, .fnd-reason { font-size: var(--fs-xs); color: var(--text-muted); line-height: 1.4; }
.fnd-reason { color: var(--text-secondary); }
.fnd-side { flex: none; padding: 6px var(--sp-1) 0 0; }
.fnd-actions { display: flex; gap: 2px; }
.dec { color: var(--text-muted); }
.dec-confirm[aria-pressed="true"] { background: var(--success-soft); color: var(--success-text); }
.dec-reject[aria-pressed="true"] { background: var(--danger-soft); color: var(--danger-text); }
.dec-confirm:hover:not(:disabled) { color: var(--success-text); }
.dec-reject:hover:not(:disabled) { color: var(--danger-text); }
.fnd-rejected .fnd-title { color: var(--text-muted); text-decoration: line-through; text-decoration-color: var(--text-muted); }
.fnd-confirmed .fnd-id { color: var(--success-text); }

.notchecked { margin: var(--sp-1) var(--sp-3) var(--sp-3); border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface-0); }
.notchecked > summary {
  display: flex; align-items: center; gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-3); cursor: pointer; list-style: none;
  font-size: var(--fs-sm); font-weight: var(--fw-medium); color: var(--text-secondary);
}
.notchecked > summary::-webkit-details-marker { display: none; }
.notchecked-chevron { color: var(--text-muted); transition: transform var(--dur-fast) var(--ease); }
.notchecked[open] .notchecked-chevron { transform: rotate(180deg); }
.notchecked.has-failed { border-color: color-mix(in srgb, var(--danger) 35%, var(--border)); }
.notchecked.has-failed > summary > .icon:first-child { color: var(--danger); }
.notchecked ul { list-style: none; margin: 0; padding: 0 var(--sp-3) var(--sp-3); display: flex; flex-direction: column; gap: var(--sp-2); }
.notchecked li { display: flex; flex-direction: column; font-size: var(--fs-sm); }
.nc-label { font-weight: var(--fw-medium); }
.nc-detail { color: var(--text-muted); font-size: var(--fs-xs); word-break: break-word; }
.notchecked li.is-failed .nc-detail { color: var(--danger-text); }

/* ------------------------------------------------------------------ case: viewer (always black) */
.viewer {
  --v-text: #d9d8e4; --v-muted: #8c8aa0; --v-line: #2a2a33; --v-fill: #17171d; --v-fill-2: #24242c;
  display: flex; flex-direction: column; min-width: 0; min-height: 0;
  background: var(--viewer-bg); color: var(--v-text);
  border-radius: var(--radius-lg); overflow: hidden;
  color-scheme: dark;
}
.viewer-bar {
  display: flex; align-items: center; flex-wrap: wrap; gap: var(--sp-2) var(--sp-3);
  min-height: 48px; padding: var(--sp-2) var(--sp-3);
  border-bottom: 1px solid var(--v-line);
}
.seg { display: inline-flex; padding: 2px; border-radius: var(--radius-md); background: var(--v-fill); border: 1px solid var(--v-line); }
.seg button {
  height: 26px; padding: 0 var(--sp-3);
  background: none; border: 0; border-radius: var(--radius-sm);
  color: var(--v-muted); font-size: var(--fs-sm); font-weight: var(--fw-medium); white-space: nowrap;
}
.seg button:hover:not(:disabled) { color: var(--v-text); }
.seg button[aria-pressed="true"] { background: var(--v-fill-2); color: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.5); }
.seg button:disabled { opacity: 0.45; }
.viewer-note { font-size: var(--fs-sm); color: var(--v-muted); }
.viewer-toggle { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-sm); color: var(--v-text); cursor: pointer; }
.viewer-toggle input { accent-color: var(--lesion); width: 15px; height: 15px; margin: 0; }
.viewer-legend { display: flex; gap: var(--sp-3); margin-left: auto; font-size: var(--fs-xs); color: var(--v-muted); flex-wrap: wrap; }
.viewer-legend span { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.swatch { width: 10px; height: 10px; border-radius: 2px; }
.swatch-new { background: #ff4d3d; }
.swatch-enlarging { background: #ffb020; }
.swatch-stable { background: #5ab8e0; }
.swatch-shrinking { background: #3ccf7a; }

.panes { flex: 1 1 auto; min-height: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 2px; background: var(--v-line); overscroll-behavior: contain; }
.panes-one { grid-template-columns: 1fr; }
.pane { position: relative; min-width: 0; min-height: 0; background: #000; overflow: hidden; }
.pane img { width: 100%; height: 100%; object-fit: contain; user-select: none; }
.pane-label {
  position: absolute; left: var(--sp-3); top: var(--sp-2);
  padding: 2px 6px; border-radius: var(--radius-sm); background: rgba(0, 0, 0, 0.55);
  font-size: var(--fs-xs); font-weight: var(--fw-semibold); letter-spacing: 0.04em; text-transform: uppercase; color: var(--v-text);
}
.orient { position: absolute; top: 50%; transform: translateY(-50%); font-size: var(--fs-xs); font-weight: var(--fw-semibold); color: var(--v-muted); }
.orient-l { left: var(--sp-2); }
.orient-r { right: var(--sp-2); }
.pane-error { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 6px; font-size: var(--fs-sm); color: var(--v-muted); }
.pane.is-error img { visibility: hidden; }
.pane.is-error .pane-error { display: flex !important; }

.viewer-empty {
  flex: 1 1 auto; min-height: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--sp-2);
  padding: var(--sp-6); text-align: center; color: var(--v-muted); font-size: var(--fs-sm);
}
.viewer-empty-icon { display: grid; place-items: center; width: 56px; height: 56px; margin-bottom: var(--sp-2); border-radius: 50%; background: var(--v-fill); border: 1px solid var(--v-line); color: var(--v-muted); }
.viewer-empty-title { font-size: var(--fs-lg); font-weight: var(--fw-semibold); color: var(--v-text); }
.viewer-empty p { max-width: 40ch; }
.viewer-empty .btn { margin-top: var(--sp-3); }

.slice-bar { display: flex; align-items: center; gap: var(--sp-2); padding: var(--sp-2) var(--sp-3); border-top: 1px solid var(--v-line); min-height: 48px; }
.viewer .viewer-btn { color: var(--v-text); }
.viewer .viewer-btn:hover:not(:disabled) { background: var(--v-fill-2); color: #fff; }
.viewer :focus-visible { box-shadow: 0 0 0 2px #000, 0 0 0 4px rgba(141, 134, 232, 0.85); }
.slice-range { flex: 1 1 auto; min-width: 80px; accent-color: #8d86e8; }
.slice-label { min-width: 64px; font-size: var(--fs-sm); color: var(--v-text); text-align: right; }
.viewer-keys { display: inline-flex; align-items: center; gap: 3px; margin-left: var(--sp-2); font-size: var(--fs-xs); color: var(--v-muted); white-space: nowrap; }
.viewer-keys kbd {
  min-width: 18px; height: 18px; padding: 0 4px; display: inline-grid; place-items: center;
  border: 1px solid var(--v-line); border-radius: 4px; background: var(--v-fill);
  font-family: var(--font-mono); font-size: 11px; color: var(--v-text);
}

/* ------------------------------------------------------------------ case: assistant */
.assist-head { display: flex; align-items: center; gap: var(--sp-2); min-height: 52px; padding: var(--sp-2) var(--sp-3) var(--sp-2) var(--sp-4); border-bottom: 1px solid var(--border); }
.assist-head > .icon { color: var(--accent-text); }
.chat { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.chat-msgs { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: var(--sp-4); display: flex; flex-direction: column; gap: var(--sp-3); }
.msg { max-width: 92%; padding: var(--sp-2) var(--sp-3); border-radius: var(--radius-lg); font-size: var(--fs-md); line-height: 1.45; }
.msg p { white-space: pre-wrap; word-break: break-word; }
.msg-a { align-self: flex-start; background: var(--surface-2); border-top-left-radius: var(--radius-sm); }
.msg-u { align-self: flex-end; background: var(--accent); color: var(--text-on-accent); border-top-right-radius: var(--radius-sm); }
.msg-meta { display: block; margin-bottom: 2px; font-size: var(--fs-xs); font-weight: var(--fw-semibold); color: var(--text-muted); }
.msg-error { background: var(--danger-soft); color: var(--danger-text); }
.typing { display: inline-flex; gap: 4px; padding: 4px 0; }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--text-muted); animation: typing 1.2s ease-in-out infinite; }
.typing i:nth-child(2) { animation-delay: 0.15s; }
.typing i:nth-child(3) { animation-delay: 0.3s; }
@keyframes typing { 0%, 60%, 100% { opacity: 0.3; transform: none; } 30% { opacity: 1; transform: translateY(-2px); } }
.finding-ref {
  display: inline; padding: 0 3px; border: 0; border-radius: var(--radius-sm);
  background: var(--accent-soft); color: var(--accent-text); font-size: 0.92em; cursor: pointer;
}
.finding-ref:hover { text-decoration: underline; }
.chat-hints { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 var(--sp-4) var(--sp-3); }
.chat-hints .chip { height: 26px; font-size: var(--fs-xs); }
.chat-compose { display: flex; align-items: flex-end; gap: var(--sp-2); padding: var(--sp-3) var(--sp-4) var(--sp-4); border-top: 1px solid var(--border); }
.chat-input { min-height: 40px; max-height: 140px; resize: none; padding: var(--sp-2) var(--sp-3); line-height: 1.4; }
.chat-send { flex: none; }
.case-assist .empty { flex: 1 1 auto; justify-content: center; }

/* ------------------------------------------------------------------ narrow screens (1024–1279 px) */
@media (max-width: 1279px) {
  .case-ws, .case-ws.no-assist { grid-template-columns: 300px minmax(0, 1fr); padding: 0 var(--sp-4) var(--sp-4); }
  .case-head { padding-left: var(--sp-4); padding-right: var(--sp-4); }
  .assist-toggle { display: inline-flex; }
  .case-assist {
    display: none;
    position: absolute; right: var(--sp-4); top: 0; bottom: var(--sp-4); z-index: 20;
    width: min(360px, calc(100% - 2 * var(--sp-4)));
    box-shadow: var(--shadow-3);
  }
  .case-ws.assist-open .case-assist { display: flex; }
  .viewer-keys { display: none; }
  .viewer-legend { margin-left: 0; }
  .import-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 1100px) {
  .case-ws, .case-ws.no-assist { grid-template-columns: 280px minmax(0, 1fr); }
  .seg button { padding: 0 var(--sp-2); }
}
