:root {
  --ivory: #f5f3ec;
  --paper: #fffefb;
  --sage: #71836e;
  --sage-light: #e8ede3;
  --navy: #293c35;
  --ink: #303b35;
  --muted: #687168;
  --line: #ddded4;
  --danger: #a03d32;
  --shadow: 0 8px 28px rgba(40, 51, 41, .06);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--ivory);
  font-synthesis: none;
}
* { box-sizing: border-box; }
body { margin: 0; font-size: 16px; line-height: 1.55; }
button, input, textarea, select { font: inherit; color: inherit; }
button, a { touch-action: manipulation; }
a { color: var(--navy); text-underline-offset: 3px; }
button { line-height: 1.4; }
button:disabled, select:disabled { cursor: wait; opacity: .6; }
:focus-visible { outline: 3px solid #71836e; outline-offset: 3px; }
::selection { background: #d9e4cd; color: #26382d; }
.topbar {
  min-height: 66px;
  padding: 14px clamp(22px, 4vw, 64px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}
.brand { color: var(--navy); font-family: Georgia, serif; font-size: 1.2rem; font-weight: 600; text-decoration: none; white-space: nowrap; }
.brand::before { content: ""; display: inline-block; width: 10px; height: 10px; margin-right: 12px; border-radius: 2px; background: var(--sage); }
.session { font-size: .76rem; color: var(--muted); overflow-wrap: anywhere; text-align: right; }
.loading, .error-empty { max-width: 540px; margin: 12vh auto; padding: 0 22px; text-align: center; color: var(--muted); }
.error-empty h2 { color: var(--navy); font-family: Georgia, serif; font-weight: 500; }
.retry, .primary, .secondary, .icon-button, .tab, .status-select {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--paper);
  padding: 10px 14px;
  cursor: pointer;
}
.retry:hover, .secondary:hover, .icon-button:hover { border-color: var(--sage); background: #f0f3eb; }
.primary { background: var(--navy); border-color: var(--navy); color: white; }
.primary:hover { background: #3a5143; }
.primary:disabled { opacity: .5; cursor: default; }
.library { max-width: 1440px; margin: auto; padding: 44px clamp(22px, 4vw, 64px) 80px; }
.library-head { display: flex; justify-content: space-between; gap: 24px; align-items: end; margin-bottom: 28px; }
.library h1, .detail-title h1 { font-family: Georgia, serif; color: var(--navy); margin: 0; font-weight: 500; letter-spacing: -.025em; }
.library h1 { font-size: clamp(2rem, 3.3vw, 2.75rem); line-height: 1.2; }
.library-subtitle { margin: 10px 0 0; color: var(--muted); font-size: .93rem; }
.controls { display: flex; gap: 9px; flex-wrap: wrap; justify-content: flex-end; align-items: center; }
.controls input, .controls select { min-height: 44px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 6px; background: var(--paper); font-size: .86rem; }
.controls input { width: 245px; max-width: 100%; }
.controls input::placeholder { color: #777c72; }
.controls .export-link { font-size: .8rem; padding: 11px 12px; }
.count { color: var(--muted); font-size: .8rem; margin: 0 0 18px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.cards > .error-empty { grid-column: 1 / -1; }
.date-group { grid-column: 1 / -1; display: flex; align-items: center; gap: 12px; font-size: .85rem; font-weight: 600; color: var(--navy); margin: 14px 0 0; }
.date-group:first-child { margin-top: 0; }
.date-group span { font-size: .73rem; font-weight: 400; color: var(--muted); }
.job-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 240px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--paper);
  cursor: pointer;
  transition: border-color .16s, box-shadow .16s, background .16s;
}
.job-card:hover { border-color: #9aa78f; background: #fffffc; box-shadow: var(--shadow); }
.job-card h2 { font-family: Georgia, serif; color: var(--navy); font-weight: 500; font-size: 1.32rem; line-height: 1.3; margin: 12px 0 7px; overflow-wrap: anywhere; }
.employer { color: var(--muted); font-size: .85rem; margin: 0; }
.document-availability { display: flex; gap: 5px 8px; flex-wrap: wrap; margin: 18px 0 0; }
.document-badge { color: #56654e; font-size: .7rem; padding: 2px 6px; border: 1px solid #e0e5da; border-radius: 3px; background: #f5f7f0; }
.document-badge.unavailable { color: #7c7064; border-color: #e9e3d9; background: #f7f4ee; }
.card-bottom { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: auto; padding-top: 22px; }
.date { font-size: .74rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.review-pill { padding: 4px 9px; border-radius: 999px; background: var(--sage-light); color: #425b37; font-size: .71rem; white-space: nowrap; }
.review-pill.unreviewed { background: #f0eee7; color: #6e6c60; }
.review-pill.reviewed { background: #e0ebdf; color: #345a32; }
.meta-id { font-size: .69rem; letter-spacing: .075em; text-transform: uppercase; color: var(--muted); }
.detail { display: grid; grid-template-columns: 220px minmax(0, 1fr) 320px; height: calc(100dvh - 66px); min-height: 590px; }
.job-rail, .comments-panel { min-width: 0; background: var(--paper); overflow: auto; scrollbar-width: thin; scrollbar-color: #c9cec1 transparent; }
.job-rail { border-right: 1px solid var(--line); padding: 18px 10px; }
.back { display: block; width: 100%; margin-bottom: 17px; text-align: left; border: 0; background: none; color: var(--navy); font-weight: 600; font-size: .82rem; cursor: pointer; padding: 9px; }
.back:hover { color: #5b7450; }
.rail-job { width: 100%; text-align: left; padding: 13px 12px; border: 1px solid transparent; border-radius: 6px; background: transparent; cursor: pointer; margin-bottom: 3px; }
.rail-job:hover { background: var(--ivory); }
.rail-job.active { background: var(--sage-light); border-color: #dce4d4; }
.rail-job strong, .rail-job span { display: block; overflow-wrap: anywhere; }
.rail-job strong { font-size: .85rem; font-weight: 550; line-height: 1.4; }
.rail-job span { font-size: .72rem; color: var(--muted); margin-top: 4px; }
.workspace { display: flex; flex-direction: column; min-width: 0; overflow: hidden; }
.detail-head { padding: 23px 26px 13px; border-bottom: 1px solid var(--line); background: var(--ivory); }
.detail-title { display: flex; gap: 16px; justify-content: space-between; align-items: start; }
.detail-title > div { min-width: 0; }
.detail-title h1 { font-size: 1.7rem; line-height: 1.2; overflow-wrap: anywhere; }
.detail-title p { margin: 7px 0 0; color: var(--muted); font-size: .82rem; }
.detail-title a { display: inline-block; margin-top: 8px; font-size: .78rem; }
.status-select { font-size: .78rem; max-width: 100%; flex-shrink: 0; padding: 9px; }
.tabs { display: flex; gap: 3px; margin-top: 19px; overflow: auto; padding: 3px 1px; scrollbar-width: thin; }
.tab { white-space: nowrap; background: transparent; border-color: transparent; padding: 8px 10px; font-size: .82rem; color: var(--muted); }
.tab:hover { color: var(--navy); background: #ebece3; }
.tab.active { background: var(--paper); border-color: var(--line); color: var(--navy); font-weight: 600; box-shadow: 0 1px 2px #26382d06; }
.viewer-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; padding: 10px 20px; border-bottom: 1px solid var(--line); background: var(--paper); }
.viewer-tools > a { font-size: .76rem; }
.segmented { display: flex; border: 1px solid var(--line); border-radius: 6px; padding: 2px; }
.segmented button { border: 0; background: none; border-radius: 4px; padding: 6px 10px; cursor: pointer; font-size: .76rem; }
.segmented button.active { background: var(--sage-light); color: var(--navy); }
.viewer { flex: 1; min-height: 0; overflow: auto; background: #e5e7de; padding: 22px; }
.pdf-frame { display: block; width: 100%; height: 100%; min-height: 430px; border: 0; background: white; box-shadow: var(--shadow); }
.text-document { max-width: 820px; margin: auto; background: var(--paper); padding: clamp(24px, 3vw, 54px); box-shadow: var(--shadow); min-height: 100%; font-family: Georgia, "Times New Roman", serif; font-size: 1.075rem; line-height: 1.85; overflow-wrap: anywhere; }
.paragraph { margin: 0 0 1.2em; border-radius: 3px; }
.paragraph:focus, .paragraph.selected { background: #edf1e5; outline: 4px solid #edf1e5; }
.selection-bar { position: sticky; bottom: 8px; display: flex; justify-content: center; pointer-events: none; }
.selection-bar button { pointer-events: auto; box-shadow: var(--shadow); }
.comments-panel { border-left: 1px solid var(--line); padding: 24px 20px; }
.comments-panel h2 { font-family: Georgia, serif; color: var(--navy); font-size: 1.4rem; font-weight: 500; margin: 0; }
.comment-help { font-size: .8rem; color: var(--muted); margin: 7px 0 22px; }
.comment { padding: 18px 0; border-top: 1px solid var(--line); }
.comment:first-child { border-top: 0; padding-top: 0; }
.quote { border-left: 3px solid var(--sage); padding-left: 10px; color: var(--muted); font-size: .81rem; margin: 0 0 12px; overflow-wrap: anywhere; }
.comment textarea { display: block; width: 100%; min-height: 140px; padding: 13px; font-size: .9rem; line-height: 1.65; border: 1px solid #ced4c5; border-radius: 6px; background: #fafbf6; resize: vertical; }
.comment textarea::placeholder { color: #7b8076; }
.comment textarea:focus { background: white; }
.save-state { font-size: .72rem; color: var(--muted); min-height: 1.2em; margin-top: 7px; overflow-wrap: anywhere; }
.save-state.error { color: var(--danger); }
.comment-actions { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; margin-top: 10px; }
.comment-actions .primary { font-size: .78rem; padding: 8px 12px; }
.mic { border: 0; background: none; cursor: pointer; padding: 7px 0; color: var(--navy); font-size: .8rem; }
.mic.listening { color: var(--danger); background: #f7e5e2; border-radius: 4px; padding: 7px; }
.speech-note { font-size: .69rem; color: var(--muted); margin: 8px 0 0; }
.empty-comments { color: var(--muted); font-size: .86rem; background: var(--ivory); border: 1px dashed var(--line); border-radius: 6px; padding: 18px; margin: 0 0 18px; }
.toast { position: fixed; z-index: 10; bottom: 20px; left: 50%; max-width: calc(100vw - 32px); width: max-content; transform: translate(-50%, 20px); opacity: 0; background: var(--navy); color: white; font-size: .85rem; padding: 12px 18px; border-radius: 7px; pointer-events: none; transition: .2s; box-shadow: var(--shadow); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.quote-button { display: block; width: 100%; border: 0; border-left: 3px solid var(--sage); text-align: left; background: none; cursor: pointer; }
.quote-button:hover { color: var(--navy); }
.comment textarea:disabled { color: var(--ink); opacity: 1; }
.comment-byline { font-size: .69rem; color: var(--muted); margin: 0 0 8px; overflow-wrap: anywhere; }
.new-note-actions { display: flex; gap: 8px; flex-wrap: wrap; padding-top: 8px; }
.new-note-actions .secondary { font-size: .78rem; padding: 9px 11px; }
.export-link { display: inline-flex; align-items: center; text-decoration: none; }
.mobile-back { display: none; }
@media (max-width: 1200px) {
  .library-head { align-items: start; flex-direction: column; }
  .controls { justify-content: flex-start; }
  .detail { grid-template-columns: 180px minmax(0, 1fr) 285px; }
  .detail-title { flex-direction: column; gap: 12px; }
  .detail-head { padding: 20px 20px 12px; }
  .comments-panel { padding: 22px 16px; }
  .viewer { padding: 16px; }
}
@media (max-width: 1050px) {
  .detail { grid-template-columns: minmax(0, 1fr) 290px; }
  .job-rail { display: none; }
  .mobile-back { display: inline-block; width: auto; padding: 0; margin-bottom: 16px; }
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 700px) {
  .topbar { padding: 14px 20px; flex-wrap: wrap; gap: 5px; }
  .session { font-size: .69rem; text-align: left; }
  .library { padding: 30px 20px 50px; }
  .library-head { gap: 20px; }
  .controls { width: 100%; }
  .controls input { width: 100%; }
  .cards { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .job-card { min-height: 220px; }
  .detail { display: block; height: auto; min-height: 0; }
  .workspace { min-height: calc(100dvh - 66px); }
  .comments-panel { border-left: 0; border-top: 1px solid var(--line); padding: 26px 22px; }
  .viewer { flex: auto; height: 72vh; min-height: 480px; padding: 12px; }
  .detail-title h1 { font-size: 1.55rem; }
  .viewer-tools { padding: 10px 16px; }
  .text-document { padding: 25px; font-size: 1rem; }
}
@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; }
}

/* Guided review and clear feedback targets. */
.review-progress { display:flex; align-items:center; justify-content:space-between; gap:20px; padding:20px 24px; margin-bottom:24px; border:1px solid var(--line); border-radius:9px; background:var(--sage-light); }
.review-progress p { margin:5px 0 0; max-width:700px; color:var(--muted); font-size:.9rem; }
.review-progress button { flex-shrink:0; }
.note-count { margin-top:10px; font-size:.8rem; color:var(--navy); }
.rail-meta { font-size:.7rem; padding-top:3px; }
.passage-help { flex-basis:100%; font-size:.8rem; color:var(--muted); margin:1px 0 0; }
.paragraph { white-space:pre-line; }
.paragraph-block { margin-bottom:1.8em; }
.paragraph-block .paragraph { margin-bottom:.4em; }
.paragraph-comment { border:1px solid var(--line); border-radius:4px; background:var(--sage-light); color:var(--navy); font: .75rem ui-sans-serif,system-ui,sans-serif; padding:7px 10px; cursor:pointer; }
.comments-panel > select { width:100%; padding:9px 8px; border:1px solid var(--line); border-radius:6px; background:var(--paper); font-size:.8rem; margin-bottom:10px; }
.new-note-actions { margin-bottom:20px; }
.note-scope { font-size:.8rem; font-weight:650; color:var(--navy); margin:0 0 7px; }
.review-next { display:flex; flex-direction:column; gap:9px; padding-top:22px; margin-top:16px; border-top:1px solid var(--line); }
.review-next button { font-size:.83rem; }
.mobile-notes { display:none; }
@media (max-width:700px) {
 .review-progress { align-items:stretch; flex-direction:column; padding:18px; }
 .mobile-notes { display:block; position:fixed; right:16px; bottom:16px; z-index:8; box-shadow:var(--shadow); }
 .comments-panel { padding-bottom:90px; scroll-margin-top:12px; }
 .toast { bottom:76px; }
 .passage-help { font-size:.83rem; }
}

.quote-button { display:-webkit-box; -webkit-line-clamp:4; -webkit-box-orient:vertical; overflow:hidden; max-height:7em; }
