/* =============================================================
   UNIVERSAL CORPORATE PDF STANDARDS INTELLIGENCE WORKBENCH
   ============================================================= */

/* ── 1. Custom properties ─────────────────────────────────── */
:root {
  --bg: #f5f7fb;
  --panel: #ffffff;
  --ink: #172033;
  --muted: #647087;
  --line: #d9e0ec;
  --soft: #eef3f9;
  --accent: #1f6feb;
  --accent-dark: #174ea6;
  --danger: #b42318;
  --good: #16794c;
  --warn: #b7791f;
  --shadow: 0 14px 34px rgba(21, 32, 51, 0.12);
  --quick-results-height: 240px;
  font-family: Inter, Segoe UI, Roboto, Arial, sans-serif;
}

/* ── 2. Reset / base ──────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html, body {
  width: 100%;
  height: 100%;
  max-height: 100%;
  margin: 0;
  overflow: hidden;
}
body { background: var(--bg); color: var(--ink); }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .55; cursor: not-allowed; }
mark { background: #fff3b0; padding: 0 2px; border-radius: 3px; }

/* ── 3. App shell — 3-row grid: topbar / quick-results / main ── */
.app-shell {
  height: 100vh;
  height: 100dvh;
  max-height: 100vh;
  max-height: 100dvh;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  overflow: hidden;
}

/* ── 4. Topbar ────────────────────────────────────────────── */
.topbar {
  grid-row: 1;
  min-height: 58px;
  padding: 7px 12px;
  background: #111827;
  color: #fff;
  display: grid;
  grid-template-columns: minmax(190px, 0.8fr) minmax(300px, 1.35fr) auto;
  gap: 10px;
  align-items: center;
}
.brand-block { min-width: 0; }
.brand-kicker {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .07em;
  line-height: 1.1;
  text-transform: uppercase;
  color: #9fb4d8;
}
#documentTitle {
  margin: 1px 0 0;
  font-size: 14px;
  line-height: 1.15;
  font-weight: 850;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.topbar-actions {
  display: flex;
  gap: 5px;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: nowrap;
  white-space: nowrap;
}
.topbar-actions .header-button {
  min-height: 30px;
  padding: 5px 8px;
  font-size: 11px;
  line-height: 1.05;
  border-radius: 8px;
  font-weight: 850;
}

/* ── 5. Quick Find bar ────────────────────────────────────── */
.quick-find {
  display: flex;
  width: 100%;
  min-height: 34px;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 10px;
  padding: 3px;
}
.quick-find input {
  flex: 1;
  border: 0;
  outline: 0;
  color: #fff;
  background: transparent;
  padding: 7px 10px;
  font-size: 12px;
  min-width: 0;
}
.quick-find input::placeholder { color: #b8c5da; }
.quick-find button {
  border: 0;
  border-radius: 8px;
  background: #fff;
  color: #111827;
  font-weight: 800;
  font-size: 12px;
  padding: 7px 11px;
}

/* ── 6. Quick Find results panel (resizable) ──────────────── */
.quick-results {
  grid-row: 2;
  height: min(var(--quick-results-height), 68dvh);
  min-height: 130px;
  max-height: min(var(--quick-results-height), 68dvh);
  overflow: hidden;
  padding: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) 16px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.quick-results[hidden] { display: none; }

.quick-results-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 14px;
  min-height: 48px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #fff, #f7fbff);
}
.quick-results-title-block { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.quick-results-title-block strong { font-size: 13px; color: var(--ink); }
.quick-results-title-block span {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 58vw;
}
.quick-results-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; flex: 0 0 auto; }
.quick-results-list {
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 10px 18px 14px;
  display: grid;
  gap: 8px;
  scrollbar-gutter: stable;
  overscroll-behavior: contain;
}
.quick-empty { margin: 10px 18px; }

.quick-results-resizer {
  min-height: 16px;
  cursor: ns-resize;
  user-select: none;
  border-top: 1px solid var(--line);
  background: linear-gradient(180deg, #f9fbff, #eef3f9);
  color: #66758e;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.quick-results-resizer::before,
.quick-results-resizer::after {
  content: '';
  width: 34px;
  height: 2px;
  border-radius: 999px;
  background: #b8c4d8;
  margin: 0 8px;
}
.quick-results-resizer:hover,
.quick-results-resizer:focus { background: #eaf2ff; color: var(--accent-dark); outline: none; }
body.resizing-quick-results { cursor: ns-resize; user-select: none; }
body.resizing-quick-results * { cursor: ns-resize; }

.ghost-dark-button {
  border: 1px solid #d0d7e2;
  border-radius: 10px;
  background: #fff;
  color: var(--muted);
  font-weight: 850;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.ghost-dark-button:hover { color: var(--ink); border-color: #aebcd0; }

/* ── 7. Main layout ───────────────────────────────────────── */
.layout {
  grid-row: 3;
  min-height: 0;
  height: auto;
  max-height: 100%;
  overflow: hidden;
  display: grid;
  grid-template-columns: 390px minmax(0, 1fr);
  gap: 12px;
  padding: 12px;
}

/* ── 8. Sidebar — single scroll container ─────────────────── */
.sidebar {
  min-height: 0;
  height: 100%;
  max-height: 100%;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  display: block;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  padding-bottom: 18px;
}

/* ── 9. Status card ───────────────────────────────────────── */
.status-card {
  padding: 14px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #fff, #f4f8ff);
}
.status-title { font-weight: 900; font-size: 15px; }
.status-meta, .status-small { color: var(--muted); font-size: 12px; margin-top: 4px; line-height: 1.35; }
.progress-wrap { height: 8px; background: #e2e8f0; border-radius: 999px; margin: 10px 0 4px; overflow: hidden; }
.progress-bar { height: 100%; width: 0%; background: linear-gradient(90deg, var(--accent), #49c5b6); transition: width .25s ease; }
.quality-row { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.quality-badge {
  font-size: 11px;
  font-weight: 800;
  border-radius: 999px;
  padding: 4px 8px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
}
.quality-badge.good { border-color: #a7f3d0; background: #ecfdf5; color: var(--good); }
.quality-badge.warn { border-color: #fde68a; background: #fffbeb; color: var(--warn); }
.quality-badge.bad  { border-color: #fecaca; background: #fef2f2; color: var(--danger); }

/* ── 10. Tabs — sticky at top of sidebar while scrolling ──── */
.tabs {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px;
  border-bottom: 1px solid var(--line);
  background: #fbfdff;
}
.tab {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  padding: 7px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}
.tab.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ── 11. Panels — natural height, sidebar provides scroll ─── */
.panel {
  display: none;
  min-height: 0;
  height: auto;
  max-height: none;
  overflow: visible;
  padding: 12px;
}
.panel.active-panel {
  display: block;
  min-height: 0;
  height: auto;
  max-height: none;
  overflow: visible;
}
.panel.active-panel > * + * { margin-top: 10px; }

.panel-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.panel-header h2 { margin: 0; font-size: 15px; }
.pill {
  font-size: 11px;
  font-weight: 900;
  color: var(--accent-dark);
  background: #eaf2ff;
  border: 1px solid #c6dbff;
  border-radius: 999px;
  padding: 4px 8px;
}

/* ── 12. Buttons ──────────────────────────────────────────── */
.primary-button, .secondary-button, .ghost-button, .danger-button {
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 9px 12px;
  font-weight: 850;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.primary-button  { background: var(--accent); color: #fff; }
.primary-button:hover { background: var(--accent-dark); }
.secondary-button { background: #fff; color: var(--accent-dark); border-color: #bfd4f7; }
.ghost-button  { background: transparent; color: #d7e6ff; border-color: rgba(255,255,255,.22); }
.danger-button { background: #fff; color: var(--danger); border-color: #fecaca; }
.full  { width: 100%; }
.small { padding: 6px 9px; font-size: 12px; border-radius: 8px; }
.tiny  { padding: 4px 7px; font-size: 10px; line-height: 1; border-radius: 7px; }

.icon-button, .link-button {
  border: 1px solid #cfe0f7;
  background: #f7fbff;
  color: var(--accent-dark);
  border-radius: 8px;
  font-size: 11px;
  font-weight: 850;
  padding: 5px 7px;
}
.icon-button.pinned { border-color: #fde68a; background: #fffbeb; color: #92400e; }

/* ── 13. Inputs and forms ─────────────────────────────────── */
.input, .textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 11px;
  outline: none;
  background: #fff;
  color: var(--ink);
}
.input:focus, .textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(31,111,235,.14);
}
.stacked-form, .assistant-form { display: flex; flex-direction: column; gap: 10px; }
.filter-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px; color: var(--muted); font-size: 12px; }
.filter-grid label { display: flex; align-items: center; gap: 5px; }
.filter-grid .filter-empty { grid-column: 1 / -1; opacity: .7; font-style: italic; }
.history-actions { display: flex; gap: 8px; }
.card-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }

/* ── 14. Lists and cards ──────────────────────────────────── */
.scroll-list,
#standardsList, #sectionsList, #searchResults, #assistantAnswer,
#pinsList, #historyList, #helpContent, #checklistList, #notesList,
.assistant-answer {
  display: block;
  min-height: 0;
  height: auto;
  max-height: none;
  overflow: visible;
  padding-right: 4px;
  padding-bottom: 18px;
}

.scroll-list > * + *,
#standardsList > * + *, #sectionsList > * + *,
#searchResults > * + *, #assistantAnswer > * + *,
#pinsList > * + *, #historyList > * + *,
#helpContent > * + *, #checklistList > * + *,
#notesList > * + * { margin-top: 8px; }

.empty-state {
  color: var(--muted);
  background: var(--soft);
  border: 1px dashed #c9d4e4;
  border-radius: 12px;
  padding: 14px;
  line-height: 1.45;
}

.standard-card, .section-item, .result-item,
.history-item, .pin-card, .quick-card {
  display: block;
  text-align: left;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  padding: 10px;
  color: var(--ink);
  transition: border-color .15s, transform .15s, box-shadow .15s;
}
.standard-card:hover, .section-item:hover, .result-item:hover,
.pin-card:hover, .quick-card:hover {
  border-color: #98bdf6;
  box-shadow: 0 4px 14px rgba(31,111,235,.10);
  transform: translateY(-1px);
}
.standard-code, .result-title, .section-title,
.history-question, .pin-title, .quick-title { font-weight: 900; font-size: 13px; line-height: 1.25; }
.standard-title, .result-snippet, .history-answer,
.pin-meta, .quick-snippet { color: var(--muted); font-size: 12px; line-height: 1.4; margin-top: 5px; }
.standard-meta, .result-meta, .section-meta,
.history-meta, .quick-meta { color: #7b879b; font-size: 11px; margin-top: 5px; }
.section-level-1 { margin-left: 8px; }
.section-level-2 { margin-left: 16px; }
.section-level-3 { margin-left: 24px; }
.topic-heading { margin: 8px 0 2px; color: var(--accent-dark); font-size: 12px; font-weight: 900; text-transform: uppercase; letter-spacing: .05em; }

/* ── 15. Group blocks ─────────────────────────────────────── */
.group-block {
  display: block;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  overflow: hidden;
}
.group-block + .group-block { margin-top: 8px; }
.group-summary {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 0;
  background: #f7faff;
  color: var(--ink);
  font-weight: 900;
  padding: 10px 12px;
  text-align: left;
}
.group-summary span { color: var(--muted); font-size: 11px; font-weight: 800; }
.group-body { display: block; padding: 8px; }
.group-body > * + * { margin-top: 7px; }

/* ── 16. Workbench ────────────────────────────────────────── */
.workflow-button-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.workflow-button {
  display: block;
  text-align: left;
  border: 1px solid #cfe0f7;
  background: linear-gradient(180deg, #fff, #f7fbff);
  color: var(--ink);
  border-radius: 12px;
  padding: 10px;
  min-height: 78px;
}
.workflow-button strong { display: block; font-size: 12px; margin-bottom: 5px; color: var(--accent-dark); }
.workflow-button span  { display: block; font-size: 11px; line-height: 1.35; color: var(--muted); }
.workflow-button small { display: block; margin-top: 6px; color: var(--muted); font-size: 0.75rem; line-height: 1.25; }
.workflow-button:hover {
  border-color: #98bdf6;
  box-shadow: 0 4px 14px rgba(31,111,235,.10);
  transform: translateY(-1px);
}
.workflow-button.selected-workflow { outline: 2px solid rgba(37,99,235,.65); background: rgba(37,99,235,.10); }

.workbench-summary { display: block; }
.workbench-card-accent { border-left: 5px solid var(--accent); background: linear-gradient(180deg,#fff,#f7fbff); }
.summary-card code {
  background: #eef3f9;
  border: 1px solid #d9e0ec;
  border-radius: 7px;
  padding: 2px 6px;
  font-size: 11px;
  display: inline-block;
  margin: 2px;
}
.help-lite { background: rgba(37,99,235,.08); border: 1px solid rgba(37,99,235,.22); color: var(--ink); }
.primary-mini { border-color: rgba(37,99,235,.42); background: rgba(37,99,235,.12); }

#standardSummary > * + *, #revisionIntel > * + * { margin-top: 8px; }

/* ── 17. Checklist and notes ──────────────────────────────── */
.checklist-item, .note-card {
  display: block;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  padding: 10px;
  color: var(--ink);
  width: 100%;
}
.checklist-item.checked { background: #f0fdf4; border-color: #a7f3d0; }
.checklist-item label { display: flex; gap: 8px; align-items: flex-start; font-weight: 800; font-size: 13px; line-height: 1.35; }
.checklist-item input { margin-top: 2px; }
.checklist-progress { border-left: 5px solid var(--good); }
.note-card p { margin: 8px 0 0; font-size: 13px; line-height: 1.45; white-space: pre-wrap; }

/* ── 18. Viewer shell ─────────────────────────────────────── */
.viewer-shell {
  min-height: 0;
  height: 100%;
  max-height: 100%;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.viewer-toolbar {
  flex: 0 0 auto;
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 10px;
  border-bottom: 1px solid var(--line);
  background: #fbfdff;
  overflow: hidden;
}
.page-controls {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
  white-space: nowrap;
}
.page-controls .small, .page-controls .mode-button {
  padding: 4px 7px;
  font-size: 10px;
  line-height: 1.1;
  border-radius: 7px;
}
.zoom-controls { display: inline-flex; align-items: center; gap: 4px; flex: 0 0 auto; }
.compact-zoom-controls { margin-left: 2px; padding-left: 7px; border-left: 1px solid var(--line); }
.zoom-label { color: var(--muted); font-size: 10px; font-weight: 900; letter-spacing: .02em; text-transform: uppercase; }
.zoom-controls #zoomResetButton, .zoom-controls .zoom-percent { min-width: 42px; }
.page-jump { color: var(--muted); font-size: 11px; display: flex; align-items: center; gap: 4px; flex: 0 0 auto; }
.page-jump input { width: 58px; border: 1px solid var(--line); border-radius: 7px; padding: 4px 6px; font-size: 11px; }
.viewer-meta {
  color: var(--muted);
  font-size: 11px;
  text-align: right;
  flex: 0 1 34%;
  min-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.viewer-mode-toggle {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
  background: #eef2f7;
  flex: 0 0 auto;
}
.mode-button {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
  font-size: 12px;
  padding: 7px 10px;
}
.mode-button + .mode-button { border-left: 1px solid var(--line); }
.mode-button.active { background: var(--accent); color: #fff; }
.mode-button:disabled { opacity: .55; cursor: not-allowed; }

/* ── 19. PDF canvas stage and link layer ──────────────────── */
.pdf-frame-wrap {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  background: #e5e7eb;
  padding: 24px;
  display: flex;
  justify-content: center;
  align-items: flex-start;
}
.pdf-frame-wrap.pan-enabled { cursor: grab; }
.pdf-frame-wrap.pan-enabled.is-panning { cursor: grabbing; user-select: none; }
.pdf-frame-wrap.pan-enabled.is-panning canvas { pointer-events: none; }

.pdf-render-status {
  max-width: 520px;
  margin: 80px auto;
  padding: 26px;
  border-radius: 16px;
  background: #fff;
  border: 1px solid var(--line);
  text-align: center;
  box-shadow: var(--shadow);
}
.pdf-render-status div { font-weight: 900; font-size: 18px; }
.pdf-render-status p { color: var(--muted); line-height: 1.5; }

.pdf-page-stage {
  position: relative;
  display: none;
  margin: 0 auto;
  background: #fff;
  border-radius: 4px;
  box-shadow: 0 18px 50px rgba(0,0,0,.24);
}
.pdf-page-stage.has-page { display: block; }
.pdf-page-stage #pdfCanvas { display: block; border-radius: 4px; }
#pdfCanvas { display: none; background: #fff; border-radius: 4px; box-shadow: 0 18px 50px rgba(0,0,0,.24); }

.pdf-text-layer {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 3;
  user-select: text;
  -webkit-user-select: text;
}
.pdf-text-layer span,
.pdf-text-layer br {
  color: transparent;
  position: absolute;
  white-space: pre;
  cursor: text;
  transform-origin: 0% 0%;
  pointer-events: auto;
}
.pdf-text-layer span::selection {
  background: rgba(37, 99, 235, 0.25);
  color: transparent;
}
.pdf-link-layer { position: absolute; inset: 0; overflow: hidden; pointer-events: none; z-index: 5; }
.pdf-link-layer a.pdf-link-annotation {
  position: absolute;
  display: block;
  pointer-events: auto;
  background: rgba(37,99,235,.001);
  border-radius: 2px;
  text-decoration: none;
}
.pdf-link-layer a.pdf-link-annotation:hover,
.pdf-link-layer a.pdf-link-annotation:focus-visible {
  outline: 2px solid rgba(37,99,235,.55);
  background: rgba(37,99,235,.10);
}
.pdf-link-layer-empty { display: none; }

.native-pdf-host {
  width: 100%;
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 8px;
}
.native-pdf-host[hidden] { display: none; }
.native-pdf-host iframe {
  width: 100%;
  height: 100%;
  min-height: 620px;
  border: 0;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 18px 50px rgba(0,0,0,.22);
}
.native-pdf-note {
  max-width: 980px;
  margin: 0 auto;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff7ed;
  color: #7c2d12;
  font-size: 12px;
  line-height: 1.35;
}

/* PDF viewer mode visibility */
body.pdf-native-mode   .pdf-page-stage  { display: none; }
body.pdf-enhanced-mode .native-pdf-host { display: none; }

/* ── 20. Related panel ────────────────────────────────────── */
.related-panel { flex: 0 0 auto; border-bottom: 1px solid var(--line); padding: 9px 12px; background: #fff; }
.related-title { font-size: 12px; font-weight: 900; color: var(--muted); margin-bottom: 7px; text-transform: uppercase; letter-spacing: .04em; }
.related-list { display: flex; gap: 8px; flex-wrap: wrap; }
.related-chip {
  border: 1px solid #cfe0f7;
  background: #f7fbff;
  color: var(--accent-dark);
  border-radius: 999px;
  padding: 6px 9px;
  font-size: 12px;
  font-weight: 800;
}

/* ── 21. Assistant answer cards ───────────────────────────── */
.answer-card {
  display: block;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  padding: 12px;
}
.answer-card h3 { margin: 0 0 8px; font-size: 14px; }
.answer-card p, .answer-card li { font-size: 13px; line-height: 1.45; color: var(--ink); }
.answer-card ol { padding-left: 18px; }
.confidence-high   { color: var(--good);   font-weight: 900; }
.confidence-medium { color: var(--warn);   font-weight: 900; }
.confidence-low    { color: var(--danger); font-weight: 900; }

/* ── 22. Instruction tooltips ─────────────────────────────── */
.instruction-tooltip {
  position: fixed;
  z-index: 5000;
  max-width: 380px;
  min-width: 240px;
  padding: 12px 13px;
  border-radius: 14px;
  border: 1px solid rgba(148,163,184,.55);
  background: rgba(15,23,42,.96);
  color: #fff;
  box-shadow: 0 18px 45px rgba(15,23,42,.32);
  pointer-events: none;
  backdrop-filter: blur(8px);
}
.instruction-tooltip[hidden] { display: none; }
.instruction-tooltip-title { font-size: 13px; font-weight: 950; line-height: 1.25; margin-bottom: 5px; }
.instruction-tooltip-body  { color: #dbeafe; font-size: 12px; line-height: 1.45; }
.instruction-tooltip-example {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(219,234,254,.24);
  color: #bfdbfe;
  font-size: 11px;
  line-height: 1.35;
  font-weight: 750;
}

/* Cursor helpers */
[data-help-title], .tab, [data-action],
.standard-card, .section-item, .result-item, .quick-card,
.pin-card, .history-item, .note-card, .checklist-item,
.workflow-button, .related-chip, .quality-badge,
.status-card, .help-card { cursor: help; }

button[data-action], .quick-card[data-action], .section-item[data-action],
.related-chip[data-action], label[for="pdfFileInput"], .tab,
[data-page] { cursor: pointer; }

/* ── 23. Toast ────────────────────────────────────────────── */
.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  background: #111827;
  color: #fff;
  border-radius: 999px;
  padding: 10px 14px;
  font-size: 13px;
  box-shadow: var(--shadow);
  z-index: 1000;
}

/* ── 24. Help center ──────────────────────────────────────── */
.help-content { display: block; font-size: 13px; line-height: 1.5; }
.help-card {
  display: block;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  padding: 12px;
}
.help-card h3 { margin: 0 0 8px; font-size: 14px; color: var(--ink); }
.help-card p  { margin: 8px 0; color: var(--ink); }
.help-card ul, .help-card ol { margin: 8px 0 8px 18px; padding: 0; }
.help-card li { margin: 5px 0; }
.help-intro { background: linear-gradient(180deg, #fff, #f7fbff); }
.help-note { border-left: 4px solid var(--accent); background: #f7fbff; padding: 8px 10px; border-radius: 8px; color: var(--muted); }
.help-table { width: 100%; border-collapse: collapse; margin-top: 8px; font-size: 12px; }
.help-table th, .help-table td { border: 1px solid var(--line); padding: 7px; vertical-align: top; text-align: left; }
.help-table th { background: #f7faff; color: var(--accent-dark); font-weight: 900; }
.example-grid { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.help-card code, .example-grid code {
  background: #eef3f9;
  border: 1px solid #d9e0ec;
  border-radius: 7px;
  padding: 2px 6px;
  font-size: 12px;
}
.workflow-list { display: grid; gap: 8px; }
.workflow-list div { background: #f8fbff; border: 1px solid #d9e0ec; border-radius: 10px; padding: 9px; }
.help-card details { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; margin-top: 7px; background: #fbfdff; }
.help-card summary { cursor: pointer; font-weight: 900; color: var(--accent-dark); }

/* ── 25. PDF Focus Mode ───────────────────────────────────── */
#toggleFocusButton { white-space: nowrap; }
#toggleFocusButton.active-focus { background: #111827; color: #fff; border-color: #111827; }

body.pdf-focus-mode .quick-results { display: none; }
body.pdf-focus-mode .app-shell     { grid-template-rows: auto minmax(0, 1fr); }
body.pdf-focus-mode .topbar        { min-height: 56px; padding: 8px 12px; }
body.pdf-focus-mode .brand-kicker  { display: none; }
body.pdf-focus-mode #documentTitle { font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
body.pdf-focus-mode .layout        { grid-row: 2; grid-template-columns: minmax(0,1fr); gap: 0; padding: 8px; }
body.pdf-focus-mode .sidebar       { display: none; }
body.pdf-focus-mode .viewer-shell  { grid-column: 1 / -1; width: 100%; min-width: 0; height: 100%; }
body.pdf-focus-mode .pdf-frame-wrap { padding: 16px; }
body.pdf-focus-mode .viewer-toolbar { min-height: 46px; padding: 8px 10px; }
body.pdf-focus-mode .related-panel { max-height: 96px; overflow-y: auto; }
body.pdf-focus-mode .native-pdf-host iframe { min-height: 720px; }

/* ── 26. Sidebar collapse ─────────────────────────────────── */
#toggleSidebarButton.active-sidebar-toggle { background: #111827; color: #fff; border-color: #111827; }
body.sidebar-collapsed .layout       { grid-template-columns: minmax(0,1fr); }
body.sidebar-collapsed .sidebar      { display: none; }
body.sidebar-collapsed .viewer-shell { grid-column: 1 / -1; width: 100%; min-width: 0; }
body.sidebar-collapsed .pdf-frame-wrap { padding-left: 16px; padding-right: 16px; }

/* ── 27. Responsive — narrow screens (≤1080px) ───────────── */
@media (max-width: 1080px) {
  html, body { height: auto; max-height: none; overflow: auto; }

  .app-shell {
    height: auto;
    min-height: 100vh;
    max-height: none;
    display: block;
    overflow: visible;
  }

  .topbar { grid-template-columns: 1fr; min-height: auto; gap: 8px; }
  .topbar-actions { flex-wrap: wrap; justify-content: flex-start; }

  .layout { grid-template-columns: 1fr; height: auto; max-height: none; overflow: visible; }

  .sidebar { height: auto; max-height: none; min-height: 0; overflow: visible; }

  .viewer-shell  { height: 75vh; max-height: none; }

  .quick-results {
    height: min(var(--quick-results-height), 55dvh);
    max-height: min(var(--quick-results-height), 55dvh);
  }
  .quick-results-toolbar { align-items: flex-start; flex-direction: column; }
  .quick-results-title-block span { max-width: 88vw; }

  .viewer-mode-toggle { order: 5; }
  .native-pdf-host iframe { min-height: 540px; }

  body.pdf-focus-mode .layout { grid-template-columns: 1fr; }
  body.pdf-focus-mode .topbar { grid-template-columns: 1fr; }
  body.sidebar-collapsed .layout { grid-template-columns: 1fr; }
}

/* ── 28. Responsive — short screens (≤760px height) ─────── */
@media (max-height: 760px) {
  .topbar     { min-height: 64px; padding: 8px 12px; }
  .status-card { padding: 10px; }
  .tabs       { padding: 8px; gap: 5px; }
  .tab        { padding: 6px 8px; font-size: 11px; }
  .panel      { padding: 9px; }
  .filter-grid { grid-template-columns: 1fr; }
}

/* ── 29. Responsive — very narrow (≤520px) ──────────────── */
@media (max-width: 520px) {
  .workflow-button-grid { grid-template-columns: 1fr; }
}

/* ── 30. Help trigger button (topbar) ─────────────────────── */
.help-trigger-button {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,.45);
  background: rgba(255,255,255,.10);
  color: #fff;
  font-size: 15px;
  font-weight: 900;
  line-height: 1;
  padding: 0;
  flex: 0 0 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, border-color .15s;
}
.help-trigger-button:hover,
.help-trigger-button:focus-visible {
  background: rgba(255,255,255,.22);
  border-color: #fff;
  outline: none;
}

/* ── 31. Help modal ───────────────────────────────────────── */
.help-modal {
  position: fixed;
  inset: 0;
  margin: auto;
  width: min(92vw, 900px);
  max-height: min(90dvh, 860px);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 0;
  background: #fff;
  box-shadow: 0 24px 70px rgba(15,23,42,.28);
  overflow: hidden;
}
.help-modal[open] {
  display: flex;
  flex-direction: column;
}
.help-modal::backdrop {
  background: rgba(15,23,42,.60);
  backdrop-filter: blur(4px);
}

.help-modal-inner { display: contents; }
.help-modal-header { flex: 0 0 auto; }
.help-modal-nav    { flex: 0 0 auto; }
.help-modal-body   { flex: 1 1 auto; min-height: 0; }

.help-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  background: #111827;
  color: #fff;
  border-radius: 18px 18px 0 0;
}
.help-modal-title-block {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.help-modal-icon {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,.45);
  background: rgba(255,255,255,.12);
  font-size: 14px;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 30px;
}
.help-modal-title {
  font-size: 15px;
  font-weight: 850;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.help-modal-close {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,.30);
  background: rgba(255,255,255,.10);
  color: #fff;
  font-size: 16px;
  line-height: 1;
  padding: 0;
  flex: 0 0 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.help-modal-close:hover { background: rgba(255,255,255,.22); border-color: #fff; }

.help-modal-nav {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  padding: 10px 20px;
  border-bottom: 1px solid var(--line);
  background: #f8faff;
}
.help-modal-jump {
  display: inline-block;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid #cfe0f7;
  background: #fff;
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
}
.help-modal-jump:hover { background: var(--accent); color: #fff; border-color: var(--accent); }

.help-modal-body {
  overflow-y: auto;
  padding: 24px 28px;
  display: flex;
  flex-direction: column;
  gap: 0;
  scroll-behavior: smooth;
  overscroll-behavior: contain;
}

/* ── Help modal content ───────────────────────────────────── */
.hm-section { padding-bottom: 28px; border-bottom: 1px solid var(--line); margin-bottom: 28px; }
.hm-section:last-child { border-bottom: 0; margin-bottom: 0; padding-bottom: 8px; }

.hm-heading {
  font-size: 18px;
  font-weight: 900;
  color: var(--ink);
  margin: 0 0 10px;
  padding-bottom: 8px;
  border-bottom: 3px solid var(--accent);
  display: inline-block;
}
.hm-subheading {
  font-size: 14px;
  font-weight: 900;
  color: var(--ink);
  margin: 16px 0 8px;
}

.hm-lead {
  font-size: 14px;
  line-height: 1.6;
  color: var(--ink);
  margin: 0 0 14px;
}
.hm-sub {
  font-size: 13px;
  color: var(--muted);
  margin: 0 0 12px;
  line-height: 1.5;
}

.hm-steps {
  margin: 0 0 14px 0;
  padding-left: 20px;
  font-size: 14px;
  line-height: 1.6;
  color: var(--ink);
}
.hm-steps li { margin-bottom: 6px; }
.hm-steps li strong { color: var(--accent-dark); }

.hm-list {
  margin: 0;
  padding-left: 20px;
  font-size: 14px;
  line-height: 1.6;
  color: var(--ink);
}
.hm-list li { margin-bottom: 7px; }

.hm-tip {
  background: #eef6ff;
  border-left: 4px solid var(--accent);
  border-radius: 0 10px 10px 0;
  padding: 10px 14px;
  font-size: 13px;
  color: var(--ink);
  line-height: 1.5;
  margin-top: 12px;
}
.hm-tip strong { color: var(--accent-dark); }

.hm-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin-top: 4px;
}
.hm-table th {
  background: #f0f6ff;
  color: var(--accent-dark);
  font-weight: 900;
  text-align: left;
  padding: 9px 12px;
  border: 1px solid #d5e6ff;
}
.hm-table td {
  padding: 9px 12px;
  border: 1px solid var(--line);
  vertical-align: top;
  line-height: 1.45;
  color: var(--ink);
}
.hm-table tr:nth-child(even) td { background: #fafcff; }
.hm-table code {
  background: #eef3f9;
  border: 1px solid #d9e0ec;
  border-radius: 5px;
  padding: 1px 5px;
  font-size: 12px;
}
kbd {
  display: inline-block;
  background: #f0f2f5;
  border: 1px solid #c8cfd8;
  border-bottom-width: 2px;
  border-radius: 5px;
  padding: 2px 6px;
  font-size: 11px;
  font-family: inherit;
  font-weight: 800;
  line-height: 1.4;
  color: var(--ink);
  white-space: nowrap;
}

.hm-faq { margin: 0; }
.hm-faq dt {
  font-size: 14px;
  font-weight: 900;
  color: var(--ink);
  margin-top: 16px;
  padding-left: 12px;
  border-left: 3px solid var(--accent);
}
.hm-faq dt:first-child { margin-top: 0; }
.hm-faq dd {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.55;
  margin: 5px 0 0 15px;
}
.hm-faq dd code {
  background: #eef3f9;
  border: 1px solid #d9e0ec;
  border-radius: 5px;
  padding: 1px 5px;
  font-size: 12px;
  color: var(--ink);
}

/* ── 32. AI assistant settings ────────────────────────────── */
.ai-settings-details {
  border: 1px solid #cfe0f7;
  border-radius: 12px;
  background: #f7fbff;
  overflow: hidden;
}
.ai-settings-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 850;
  color: var(--accent-dark);
  list-style: none;
  user-select: none;
}
.ai-settings-summary::-webkit-details-marker { display: none; }
.ai-settings-summary::before {
  content: '▸';
  font-size: 10px;
  transition: transform .15s;
  flex: 0 0 auto;
  order: -1;
}
details[open] > .ai-settings-summary::before { transform: rotate(90deg); }

.ai-status-badge {
  font-size: 11px;
  font-weight: 900;
  border-radius: 999px;
  padding: 3px 8px;
}
.ai-status-off { background: #f1f3f5; color: var(--muted); border: 1px solid #d8dee8; }
.ai-status-on  { background: #ecfdf5; color: var(--good); border: 1px solid #a7f3d0; }

.ai-settings-body {
  padding: 12px;
  border-top: 1px solid #cfe0f7;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.ai-field { display: flex; flex-direction: column; gap: 4px; }
.ai-field label { font-size: 12px; font-weight: 850; color: var(--muted); }
.ai-button-row { display: flex; gap: 8px; flex-wrap: wrap; }
.ai-key-note {
  font-size: 11px;
  color: #92400e;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 8px;
  padding: 8px 10px;
  line-height: 1.4;
  margin: 0;
}

.ai-active-pill { background: #ecfdf5; color: var(--good); border-color: #a7f3d0; }

/* ── 33. AI assistant answer states ───────────────────────── */
.ai-streaming-card {
  border-color: #98bdf6;
  background: linear-gradient(180deg, #f7fbff, #fff);
}
.ai-streaming-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 850;
  color: var(--accent-dark);
  margin-bottom: 10px;
}
.ai-pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  flex: 0 0 8px;
  animation: ai-pulse 1s ease-in-out infinite;
}
@keyframes ai-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: .4; transform: scale(.75); }
}
.ai-streaming-text { font-size: 13px; line-height: 1.6; color: var(--ink); min-height: 20px; }
.ai-cursor {
  display: inline-block;
  color: var(--accent);
  font-weight: 900;
  animation: ai-blink .9s step-end infinite;
}
@keyframes ai-blink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }

.ai-answer-card { border-color: #98bdf6; }
.ai-answer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.ai-answer-header h3 { margin: 0; }
.ai-model-badge {
  font-size: 11px;
  font-weight: 900;
  background: #eef6ff;
  color: var(--accent-dark);
  border: 1px solid #cfe0f7;
  border-radius: 999px;
  padding: 3px 8px;
  white-space: nowrap;
}
.ai-answer-text { font-size: 13px; line-height: 1.65; color: var(--ink); }
.ai-answer-text p  { margin: 0 0 8px; }
.ai-answer-text p:last-child { margin-bottom: 0; }
.ai-answer-text h4.ai-h4 { font-size: 13px; font-weight: 900; color: var(--ink); margin: 10px 0 4px; }
.ai-answer-text ul.ai-list { margin: 6px 0 8px 18px; padding: 0; }
.ai-answer-text ul.ai-list li { margin-bottom: 4px; }
.ai-answer-text code { background: #eef3f9; border: 1px solid #d9e0ec; border-radius: 5px; padding: 1px 5px; font-size: 12px; }

.ai-disclaimer {
  font-size: 11px;
  color: var(--muted);
  border-top: 1px solid var(--line);
  margin: 10px 0 0;
  padding-top: 8px;
  line-height: 1.4;
}
.ai-sub { font-size: 12px; color: var(--muted); margin: 0; }

.ai-error-card { border-color: #fecaca; background: #fef2f2; }
.ai-error-message { color: var(--danger); font-weight: 850; font-size: 13px; margin: 0 0 6px; }

/* Responsive modal */
@media (max-width: 600px) {
  .help-modal { width: 100%; max-height: 100dvh; border-radius: 0; inset: 0; }
  .help-modal-header { border-radius: 0; }
  .help-modal-body { padding: 16px; }
  .help-modal-title { font-size: 13px; }
  .hm-table { font-size: 12px; }
  .hm-table th, .hm-table td { padding: 7px 8px; }
}

/* === 34. PRO BADGE ======================================================= */
.pro-badge {
  display: inline-flex;
  align-items: center;
  background: linear-gradient(135deg, #7c3aed, #4f46e5);
  color: #fff;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: .08em;
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
  vertical-align: middle;
  line-height: 1.4;
  pointer-events: none;
}

/* === 35. DOCUMENT LIBRARY ================================================ */
.doc-library-list { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.doc-card {
  display: grid;
  grid-template-columns: 52px 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.doc-card:hover { border-color: var(--accent); background: #f5f8ff; }
.doc-card.doc-card-active { border-color: var(--accent); background: #eef4ff; }
.doc-thumb {
  width: 52px;
  height: 68px;
  object-fit: contain;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: #f8f9fb;
  display: block;
}
.doc-thumb-placeholder {
  width: 52px;
  height: 68px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: #f0f2f7;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
}
.doc-card-body { min-width: 0; }
.doc-card-name {
  font-size: 12px;
  font-weight: 850;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.doc-card-meta { font-size: 11px; color: var(--muted); margin-top: 2px; }
.doc-card-remove {
  width: 24px;
  height: 24px;
  border: none;
  background: none;
  color: var(--muted);
  font-size: 14px;
  cursor: pointer;
  line-height: 1;
  border-radius: 4px;
  padding: 0;
  flex: 0 0 24px;
  align-self: start;
}
.doc-card-remove:hover { color: var(--danger); background: #fef2f2; }
.cross-search-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  font-size: 12px;
  color: var(--ink);
  padding: 7px 10px;
  background: #f7f9fc;
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
}
.cross-search-row input[type="checkbox"] { width: 14px; height: 14px; cursor: pointer; flex: 0 0 14px; }
.cross-result-doc {
  display: inline-block;
  background: #eef4ff;
  color: var(--accent-dark);
  border: 1px solid #c7d7f7;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 850;
  padding: 0 4px;
  margin-right: 4px;
  vertical-align: middle;
}

/* === 36. OCR BAR ========================================================= */
.ocr-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  background: #fffbeb;
  border-bottom: 1px solid #fde68a;
  font-size: 12px;
  flex-wrap: wrap;
  flex: 0 0 auto;
}
.ocr-bar-msg { flex: 1 1 auto; color: #92400e; font-weight: 700; min-width: 0; }
.ocr-progress {
  font-size: 11px;
  color: var(--accent-dark);
  padding: 2px 8px;
  background: #eef4ff;
  border: 1px solid #c7d7f7;
  border-radius: 4px;
  white-space: nowrap;
}

/* === 37. ANNOTATION LAYER & TOOLBAR ===================================== */

/* SVG overlay: sits between text layer (z3) and link layer (z5) */
.pdf-annot-layer {
  position: absolute;
  inset: 0;
  overflow: visible;
  pointer-events: none;
  z-index: 4;
}
/* Draw / Note / Eraser modes: capture events above link layer */
body.annot-draw-mode   .pdf-annot-layer,
body.annot-note-mode   .pdf-annot-layer,
body.annot-eraser-mode .pdf-annot-layer { pointer-events: all; z-index: 6; }
body.annot-draw-mode   .pdf-frame-wrap { cursor: crosshair; }
body.annot-note-mode   .pdf-frame-wrap { cursor: cell; }
body.annot-eraser-mode .pdf-annot-layer { cursor: not-allowed; }

/* Annotation toolbar */
.anno-toolbar {
  flex: 0 0 auto;
  padding: 5px 10px;
  border-bottom: 1px solid var(--line);
  background: #f0f4ff;
}
.anno-toolbar-inner {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  min-height: 28px;
}
.anno-section-label {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
  flex: 0 0 auto;
}
.anno-tool-group,
.anno-color-group,
.anno-width-group,
.anno-actions-group {
  display: flex;
  align-items: center;
  gap: 3px;
  flex: 0 0 auto;
}
.anno-color-group,
.anno-width-group { padding-left: 7px; border-left: 1px solid var(--line); }
.anno-width-group { display: none; } /* visible only in draw mode */
body.annot-draw-mode .anno-width-group { display: flex; }
.anno-actions-group { margin-left: auto; }

/* Tool & action buttons */
.anno-btn {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 6px;
  padding: 3px 7px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  color: var(--fg);
  transition: background .12s, color .12s, border-color .12s;
  line-height: 1.3;
}
.anno-btn:hover { background: #e0e7ff; border-color: var(--accent); }
.anno-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.anno-btn-save { background: #ecfdf5; border-color: #34d399; color: #065f46; }
.anno-btn-save:hover { background: #34d399; color: #fff; }

/* Separator between tool groups */
.anno-sep { width: 1px; height: 16px; background: var(--line); margin: 0 2px; flex: 0 0 auto; }

/* Color swatches */
.anno-swatch {
  width: 16px; height: 16px;
  border-radius: 50%;
  border: 2px solid transparent;
  background: var(--sw, #ccc);
  cursor: pointer;
  padding: 0;
  transition: border-color .1s, transform .1s;
  flex: 0 0 16px;
}
.anno-swatch:hover { transform: scale(1.2); }
.anno-swatch.active { border-color: #111827; transform: scale(1.15); }

/* Draw width buttons */
.anno-width-btn {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 5px;
  padding: 3px 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
}
.anno-width-btn.active { background: #e0e7ff; border-color: var(--accent); }
.anno-width-line {
  display: inline-block;
  width: 18px;
  background: var(--fg);
  border-radius: 2px;
}
.anno-w-thin  { height: 1.5px; }
.anno-w-med   { height: 3px; }
.anno-w-thick { height: 6px; }

/* Hint text */
.anno-hint {
  font-size: 10px;
  color: var(--muted);
  font-style: italic;
  flex: 1 1 0;
  min-width: 80px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Sticky note popup */
.anno-note-popup {
  position: fixed;
  z-index: 2000;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 8px 30px rgba(0,0,0,.2);
  padding: 10px 12px;
  width: 220px;
}
.anno-note-popup-header {
  font-size: 12px;
  font-weight: 800;
  color: var(--fg);
  margin-bottom: 6px;
}
.anno-note-textarea {
  width: 100%;
  box-sizing: border-box;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 5px 7px;
  font-size: 12px;
  font-family: inherit;
  color: var(--fg);
  min-height: 70px;
}
.anno-note-popup-btns {
  display: flex;
  gap: 6px;
  margin-top: 8px;
  justify-content: flex-end;
}
