.filters-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
}

.pagination-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0 0 12px;
}

.docs-summary {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.pagination-controls {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.docs-total-label {
  color: var(--ink-soft);
  font-size: 0.84rem;
  font-family: var(--mono);
}

.page-indicator {
  min-width: 70px;
  text-align: center;
  font-size: 0.84rem;
  color: var(--ink-soft);
}

.filter-chip {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--stroke);
  border-radius: 10px;
  padding: 6px 8px 6px 12px;
  background: rgba(247, 248, 246, 0.9);
  min-height: 48px;
}

.filter-chip-search {
  min-width: 280px;
  flex: 1 1 340px;
}

.filter-chip-search input[type="text"] {
  border: 0;
  background: transparent;
  padding: 0;
  font-size: 0.92rem;
}

.filter-chip-search input[type="text"]:focus-visible {
  outline: none;
  border: 0;
}

.chip-prefix {
  font-weight: 700;
  font-size: 0.9rem;
  color: #2a3a35;
  white-space: nowrap;
}

.filter-select {
  border: 0;
  background: transparent;
  color: #25342f;
  font-family: var(--sans);
  font-size: 0.95rem;
  padding: 0 28px 0 0;
  min-width: 130px;
  appearance: none;
  -webkit-appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, #4e5d58 50%),
    linear-gradient(135deg, #4e5d58 50%, transparent 50%);
  background-position: calc(100% - 14px) calc(50% - 3px), calc(100% - 8px) calc(50% - 3px);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  cursor: pointer;
}

.filter-select:focus {
  outline: none;
}

.filter-select-native {
  display: none;
}

.filter-dropdown {
  position: static;
}

.filter-dropdown-trigger {
  border: 1px solid var(--stroke);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  color: #1f2f2a;
  min-height: 34px;
  min-width: 170px;
  padding: 6px 30px 6px 10px;
  text-align: left;
  font-family: var(--sans);
  font-size: 0.9rem;
  cursor: pointer;
  position: relative;
}

.filter-dropdown-value {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 190px;
}

.filter-dropdown-caret {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: #45615a;
}

.filter-chip.is-open .filter-dropdown-trigger {
  border-color: #6f8f85;
  background: #f4f8f6;
}

.filter-chip.is-open {
  z-index: 35;
}

.filter-dropdown-panel {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  width: min(340px, calc(100vw - 32px));
  min-width: 100%;
  border: 1px solid var(--stroke);
  border-radius: 10px;
  background: #eff2ef;
  box-shadow: 0 12px 24px rgba(36, 47, 42, 0.18);
  padding: 10px;
  z-index: 30;
}

.filter-dropdown-search {
  width: 100%;
  border: 1px solid #a6b7af;
  border-radius: 8px;
  background: #f8faf8;
  padding: 9px 10px;
  font-size: 0.9rem;
  margin-bottom: 8px;
}

.filter-dropdown-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  padding-bottom: 8px;
}

.filter-dropdown-actions button {
  border: 1px solid #c2cec9;
  border-radius: 999px;
  background: #f8faf8;
  color: #2b463e;
  cursor: pointer;
  font-size: 0.74rem;
  font-weight: 700;
  padding: 5px 8px;
}

.filter-dropdown-actions button:hover {
  background: rgba(130, 157, 148, 0.14);
}

.filter-dropdown-options {
  max-height: 280px;
  overflow-y: auto;
  border-top: 1px solid #d3dbd7;
}

.filter-dropdown-option {
  width: 100%;
  border: 0;
  border-bottom: 1px solid #d3dbd7;
  background: transparent;
  text-align: left;
  padding: 10px 4px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  color: #21302b;
}

.filter-dropdown-option:hover {
  background: rgba(130, 157, 148, 0.14);
}

.filter-dropdown-check {
  width: 18px;
  height: 18px;
  border: 1px solid #9fb0a9;
  border-radius: 4px;
  display: grid;
  place-items: center;
  color: #1f5f4c;
  font-size: 0.74rem;
  font-weight: 700;
  flex: 0 0 18px;
}

.filter-dropdown-option.is-selected .filter-dropdown-check {
  background: #d7e9e1;
  border-color: #6f8f85;
}

.filter-dropdown-option-label {
  line-height: 1.25;
}

.filter-dropdown-empty {
  padding: 10px 4px;
  color: #5a6662;
  font-size: 0.9rem;
}

#metaDate {
  width: min(220px, 100%);
  justify-self: start;
}

.document-actions {
  align-items: center;
  justify-content: space-between;
}

.document-actions-left,
.document-actions-right {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.app-shell:has(.document-detail-workbench) {
  width: min(1980px, 98vw);
  min-height: calc(100vh - 24px);
  margin: 8px auto 18px;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
}

.app-shell:has(.document-detail-workbench) > .sidebar {
  display: none;
}

.app-shell:has(.document-detail-workbench) .content-pane {
  min-height: 0;
}

.document-detail-workbench {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: calc(100vh - 106px);
}

.doc-detail-header,
.doc-preview-panel,
.detail-card {
  background: var(--bg-panel);
  border: 1px solid var(--stroke);
  box-shadow: var(--shadow);
  backdrop-filter: blur(4px);
}

.doc-detail-header {
  border-radius: 16px;
  padding: 14px 22px 16px;
}

.doc-detail-header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding-bottom: 12px;
}

.doc-breadcrumb {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  color: var(--ink-soft);
  font-size: 0.82rem;
}

.doc-breadcrumb a {
  color: var(--ink-soft);
  text-decoration: none;
  padding: 3px 6px;
  border-radius: 5px;
}

.doc-breadcrumb a:hover {
  color: var(--ink);
  background: var(--row-hover);
}

.doc-breadcrumb span {
  color: var(--ink);
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.doc-detail-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.doc-detail-actions .btn,
.detail-save-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.doc-detail-header-body {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
}

.doc-detail-titleblock {
  display: grid;
  gap: 9px;
  min-width: 0;
  flex: 1;
}

.doc-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  color: var(--ink-soft);
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.doc-eyebrow .dot,
.doc-meta-row .dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--ink-mute);
}

.doc-detail-title {
  margin: 0;
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.85rem;
  font-weight: 600;
  letter-spacing: 0;
  line-height: 1.15;
}

.detail-processing-stage-wrap:empty {
  display: none;
}

.detail-processing-stage {
  display: grid;
  gap: 5px;
  width: min(230px, 100%);
  margin-top: 2px;
}

.detail-processing-stage-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--ink-soft);
  font-family: var(--mono);
  font-size: 0.84rem;
  font-weight: 700;
  line-height: 1;
}

.detail-processing-track {
  display: block;
  height: 7px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--stroke) 64%, transparent);
  overflow: hidden;
}

.detail-processing-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.detail-processing-track[data-stage="failed"] span {
  background: #8f2f2f;
}

.detail-processing-track[data-stage="queued"] span {
  background: var(--ink-mute);
}

.doc-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.meta-pill {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  padding: 4px 10px;
  background: var(--paper);
  border: 1px solid var(--stroke-soft);
  border-radius: 999px;
  font-size: 0.78rem;
}

.meta-key {
  color: var(--ink-mute);
  font-family: var(--mono);
  font-size: 0.66rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.meta-val {
  color: var(--ink);
  font-weight: 700;
}

.doc-detail-tags {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 8px;
}

.doc-detail-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
  gap: 14px;
  min-height: 0;
}

.doc-preview-panel {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
  min-height: 640px;
  border-radius: 16px;
}

.doc-preview-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--stroke-soft);
}

.preview-pager,
.preview-tools {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
}

.icon-btn:hover {
  background: var(--row-hover);
  color: var(--ink);
}

.pager-text,
.zoom-text {
  color: var(--ink-soft);
  font-family: var(--mono);
  font-size: 0.78rem;
  padding: 0 6px;
}

.preview-divider {
  width: 1px;
  height: 16px;
  margin: 0 4px;
  background: var(--stroke-soft);
}

.doc-preview-stage {
  flex: 1;
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  min-height: 0;
  background: color-mix(in srgb, var(--ink) 4%, transparent);
}

.page-strip {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  padding: 12px 10px;
  border-right: 1px solid var(--stroke-soft);
}

.strip-thumb {
  display: grid;
  justify-items: center;
  gap: 4px;
  padding: 5px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--ink-mute);
  cursor: pointer;
  font-family: var(--mono);
  font-size: 0.66rem;
}

.strip-thumb:hover {
  background: var(--table-row-hover);
  color: var(--ink);
}

.strip-thumb.active {
  background: var(--paper);
  border-color: var(--accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 20%, transparent);
  color: var(--ink);
}

.strip-thumb-page {
  display: flex;
  flex-direction: column;
  gap: 3px;
  width: 44px;
  height: 56px;
  padding: 6px 5px;
  background: #fff;
  border: 1px solid var(--stroke-soft);
  border-radius: 3px;
}

.strip-line {
  display: block;
  height: 2px;
  border-radius: 1px;
  background: color-mix(in srgb, var(--ink) 18%, transparent);
}

.strip-num {
  font-weight: 600;
}

.page-canvas {
  display: block;
  overflow: auto;
  padding: 28px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.32), rgba(255, 255, 255, 0)),
    color-mix(in srgb, var(--ink) 5%, #eef2ef);
}

.document-preview-frame {
  width: min(100%, 920px);
  margin: 0 auto;
  overflow: hidden;
  background: #fff;
  border: 0;
  border-radius: 6px;
  box-shadow:
    0 22px 45px rgba(31, 43, 39, 0.18),
    0 2px 6px rgba(31, 43, 39, 0.12);
}

.document-preview-frame-pdf {
  width: max-content;
  max-width: none;
  overflow: visible;
}

.document-file-preview {
  display: block;
  border: 0;
  background: #fff;
  border-radius: 6px;
}

.document-embed-preview {
  width: 100%;
  height: min(78vh, 960px);
  min-height: 620px;
}

.document-text-preview {
  width: 100%;
  min-height: 620px;
  max-height: min(78vh, 960px);
  margin: 0;
  overflow: auto;
  padding: 28px;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 0.82rem;
  line-height: 1.65;
  white-space: pre-wrap;
}

.document-markdown-preview {
  width: 100%;
  min-height: 620px;
  max-height: min(78vh, 960px);
  margin: 0;
  overflow: auto;
  padding: 34px;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 0.94rem;
  line-height: 1.58;
  white-space: normal;
}

.document-markdown-preview h1,
.document-markdown-preview h2,
.document-markdown-preview h3 {
  margin: 0 0 12px 0;
  line-height: 1.25;
  letter-spacing: 0;
}

.document-markdown-preview h1 {
  font-family: var(--serif);
  font-size: 1.55rem;
}

.document-markdown-preview h2 {
  font-family: var(--serif);
  font-size: 1.3rem;
}

.document-markdown-preview h3 {
  font-size: 1.05rem;
  font-weight: 700;
}

.document-markdown-preview p,
.document-markdown-preview ul,
.document-markdown-preview ol,
.document-markdown-preview blockquote,
.document-markdown-preview pre {
  margin: 0 0 14px 0;
}

.document-markdown-preview ul,
.document-markdown-preview ol {
  padding-left: 24px;
}

.document-markdown-preview code {
  font-family: var(--mono);
  font-size: 0.88em;
  background: color-mix(in srgb, var(--accent-soft) 38%, white);
  border-radius: 5px;
  padding: 1px 5px;
}

.document-markdown-preview pre {
  overflow: auto;
  padding: 14px;
  background: color-mix(in srgb, var(--accent-soft) 30%, white);
  border: 1px solid var(--stroke-soft);
  border-radius: 6px;
}

.document-markdown-preview pre code {
  padding: 0;
  background: transparent;
}

.document-markdown-preview blockquote {
  border-left: 3px solid var(--stroke);
  padding-left: 12px;
  color: var(--ink-soft);
}

.document-markdown-preview a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.document-pdf-preview {
  width: auto;
  min-height: 0;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 0;
  background: transparent;
}

.document-pdf-preview[hidden],
.document-file-preview[hidden] {
  display: none;
}

.document-pdf-canvas {
  display: block;
  max-width: none;
  height: auto;
  background: #fff;
  border-radius: 6px;
}

.document-pdf-status {
  margin: 18px;
  color: var(--ink-mute);
  font-size: 0.85rem;
}

.document-image-preview {
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: none;
  margin: 0 auto;
}

.doc-detail-rail {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  overflow-y: auto;
  padding-right: 2px;
}

.detail-card {
  min-width: 0;
  border-radius: 12px;
  padding: 14px 16px;
}

#systemInformation {
  padding-bottom: 2px;
}

#systemInformation:has(.card-collapse[aria-expanded="true"]) {
  padding-bottom: 14px;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.card-eyebrow {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--ink-soft);
  font-family: var(--mono);
  font-size: 0.66rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 12px;
}

.card-eyebrow-aside {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
  padding: 2px 7px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  color: var(--accent);
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.summary-card {
  background: linear-gradient(140deg, color-mix(in srgb, var(--accent) 7%, var(--bg-panel)), var(--bg-panel) 70%);
  border-color: color-mix(in srgb, var(--accent) 24%, var(--stroke));
}

.summary-text {
  margin: 0;
  color: var(--ink);
  font-family: var(--serif);
  font-size: 0.96rem;
  line-height: 1.55;
}

.rail-tabs {
  display: flex;
  gap: 2px;
  flex-shrink: 0;
  overflow-x: auto;
  padding: 4px;
  background: color-mix(in srgb, var(--ink) 8%, #fff);
  border: 1px solid var(--stroke);
  border-radius: 10px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65);
}

.rail-tab {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 7px 8px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.rail-tab:hover {
  background: color-mix(in srgb, var(--ink) 6%, #fff);
  color: var(--ink);
}

.rail-tab.active {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 2px 8px rgba(38, 53, 46, 0.12);
}

.rail-tab-count {
  padding: 1px 6px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--ink) 8%, transparent);
  color: var(--ink-mute);
  font-family: var(--mono);
  font-size: 0.66rem;
  font-weight: 600;
}

.rail-tab.active .rail-tab-count {
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--accent);
}

.detail-tab-pane {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.detail-tab-pane[hidden] {
  display: none;
}

.detail-form-card {
  position: relative;
  display: grid;
  gap: 12px;
  overflow: visible;
}

.detail-form-card:has(.tag-editor.is-open) {
  z-index: 40;
}

.detail-form {
  display: grid;
  gap: 12px;
}

.detail-field {
  position: relative;
  display: grid;
  gap: 5px;
}

.detail-field:has(.tag-editor.is-open) {
  z-index: 15;
}

.field-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
}

.field-label {
  color: var(--ink-soft);
  font-family: var(--mono);
  font-size: 0.66rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.field-input {
  width: 100%;
  padding: 8px 10px;
  background: var(--paper);
  border: 1px solid var(--stroke-soft);
  border-radius: 8px;
  color: var(--ink);
  font: inherit;
  font-size: 0.88rem;
}

.field-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}

.field-with-avatar {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  padding: 0 10px;
  background: var(--paper);
  border: 1px solid var(--stroke-soft);
  border-radius: 8px;
}

.field-with-avatar .field-input {
  padding-left: 0;
  background: transparent;
  border: 0;
}

.field-with-avatar .field-input:focus {
  box-shadow: none;
}

.corr-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: linear-gradient(135deg, #2c6488, #1d6a55);
  color: white;
  font-size: 0.62rem;
  font-weight: 800;
}

.detail-save-btn {
  justify-self: start;
}

.tag-editor {
  position: relative;
}

.tag-editor.is-open {
  z-index: 45;
}

.tag-editor-wrap {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  align-items: center;
  gap: 8px;
  min-height: 70px;
  padding: 8px 10px 10px;
  background: var(--paper);
  border: 1px solid var(--stroke-soft);
  border-radius: 8px;
}

.tag-editor-wrap:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}

.tag-editor-chips {
  display: contents;
}

.tag-pill-removable {
  min-height: 29px;
  padding: 4px 7px 4px 9px;
  background: color-mix(in srgb, var(--accent) 8%, var(--paper));
  border-color: color-mix(in srgb, var(--accent) 22%, var(--stroke-soft));
}

.tag-pill-x {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--ink-mute);
  cursor: pointer;
}

.tag-pill-x:hover {
  background: color-mix(in srgb, var(--ink) 8%, transparent);
  color: var(--ink);
}

.tag-editor-input {
  flex: 1 1 140px;
  min-width: 120px;
  height: 29px;
  min-height: 29px;
  padding: 3px 4px;
  border: 0;
  background: transparent;
  box-sizing: border-box;
  color: var(--ink);
  font: inherit;
  font-size: 0.84rem;
}

.tag-editor-input:focus {
  outline: none;
}

.tag-suggest {
  position: absolute;
  z-index: 50;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  max-height: 430px;
  overflow-y: auto;
  margin: 0;
  padding: 8px 0;
  list-style: none;
  background: #fff;
  border: 1px solid var(--stroke);
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
}

.tag-suggest button {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 52px;
  padding: 10px 28px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  font-size: 0.84rem;
  text-align: left;
}

.tag-suggest button:hover,
.tag-suggest button:focus-visible {
  background: var(--table-row-hover);
  color: var(--ink);
  outline: none;
}

.ocr-tab-card {
  gap: 12px;
}

.ocr-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--stroke-soft);
}

.ocr-search {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1;
  gap: 5px;
  min-width: 0;
  padding: 4px 8px 4px 28px;
  background: var(--paper);
  border: 1px solid var(--stroke-soft);
  border-radius: 7px;
}

.ocr-search svg {
  position: absolute;
  left: 9px;
  color: var(--ink-soft);
}

.ocr-search input {
  min-width: 0;
  width: 100%;
  padding: 3px 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 0.82rem;
}

.ocr-search input:focus {
  outline: none;
}

.ocr-meta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--ink-mute);
  font-family: var(--mono);
  font-size: 0.7rem;
  white-space: nowrap;
}

.ocr-meta .dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--ink-mute);
}

.card-link {
  display: inline-flex;
  align-items: center;
  padding: 3px 7px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
}

.card-link:hover {
  background: var(--row-hover);
  color: var(--accent);
}

.ocr-pre {
  max-height: 620px;
  overflow: auto;
  margin: 0;
  padding: 12px;
  background: var(--paper);
  border: 1px solid var(--stroke-soft);
  border-radius: 8px;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 0.78rem;
  line-height: 1.6;
}

.ocr-line {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 12px;
  padding: 0 4px;
  border-radius: 3px;
}

.ocr-line.hit {
  background: color-mix(in srgb, var(--accent-2) 10%, transparent);
}

.ocr-num {
  color: var(--ink-mute);
  user-select: none;
}

.ocr-content {
  min-width: 0;
  overflow: hidden;
  white-space: pre;
}

.ocr-pre mark {
  padding: 0 2px;
  border-radius: 2px;
  background: color-mix(in srgb, var(--accent-2) 30%, transparent);
  color: var(--ink);
}

.card-collapse {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: calc(100% + 32px);
  min-height: 46px;
  margin: -14px -16px 0;
  padding: 0 16px;
  background: transparent;
  border: 0;
  border-radius: 12px 12px 0 0;
  color: var(--ink-soft);
  cursor: pointer;
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.card-collapse:hover {
  color: var(--ink);
}

.card-collapse[aria-expanded="true"] .system-toggle-icon {
  transform: rotate(180deg);
}

.sys-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px 16px;
  margin: 12px 0 0;
  padding: 0;
}

.sys-grid[hidden] {
  display: none;
}

.sys-item {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.sys-item-full {
  grid-column: 1 / -1;
}

.sys-item dt {
  color: var(--ink-mute);
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.sys-item dd {
  min-width: 0;
  margin: 0;
  color: var(--ink);
  font-size: 0.82rem;
  word-break: break-word;
}

.sys-item code {
  font-family: var(--mono);
  font-size: 0.76rem;
}

.sys-item .trunc {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.action-grid {
  display: grid;
  gap: 6px;
}

.action-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  background: var(--paper);
  border: 1px solid var(--stroke-soft);
  border-radius: 8px;
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  font-size: 0.82rem;
  text-align: left;
}

.action-btn:hover {
  background: var(--row-hover);
  border-color: var(--stroke);
}

.action-btn > .icon-sm {
  color: var(--ink-soft);
}

.action-btn.danger > .icon-sm {
  color: #b54a36;
}

.app-shell:has(.documents-workbench) {
  width: min(1980px, 98vw);
  min-height: calc(100vh - 24px);
  margin: 8px auto 18px;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
}

.app-shell:has(.documents-workbench) > .sidebar {
  display: none;
}

.app-shell:has(.documents-workbench) .content-pane {
  min-height: 0;
}

.documents-workbench {
  display: grid;
  grid-template-columns: var(--app-side-panel-width) minmax(0, 1fr);
  gap: var(--app-workbench-gap);
  min-height: calc(100vh - 106px);
}

.documents-workbench h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.42rem;
  line-height: 1.05;
}

.docs-nav-panel,
.docs-main-panel {
  min-height: 0;
  background: var(--bg-panel);
  border: 1px solid var(--stroke);
  box-shadow: var(--shadow);
  backdrop-filter: blur(4px);
  border-radius: var(--app-panel-radius);
}

.docs-nav-panel {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 14px;
}

.docs-upload-primary {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  padding: 10px 13px;
  border-radius: 10px;
  color: white;
  background: var(--accent);
  box-shadow: 0 5px 14px color-mix(in srgb, var(--accent) 28%, transparent);
  font-weight: 700;
  font-size: 0.86rem;
  text-decoration: none;
}

.docs-upload-primary kbd {
  margin-left: auto;
  color: white;
  border-color: rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.16);
}

.docs-side-section {
  display: grid;
  gap: 2px;
  padding: 10px 2px 12px;
  border-bottom: 1px solid var(--stroke-soft);
}

.docs-side-section-last {
  border-top: 1px solid var(--stroke-soft);
  border-bottom: 0;
}

.docs-side-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 6px 7px;
  color: var(--ink-soft);
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.docs-side-head a {
  color: var(--ink-soft);
  text-decoration: none;
  font-family: var(--sans);
  font-size: 1.05rem;
  line-height: 1;
}

.docs-side-row {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) auto;
  gap: 9px;
  align-items: center;
  min-height: 31px;
  padding: 6px 8px;
  border-radius: 8px;
  color: var(--ink);
  text-decoration: none;
  font-size: 0.84rem;
}

.docs-side-row:hover {
  background: var(--row-hover);
}

.docs-side-row.active {
  background: var(--accent-soft);
  color: var(--ink);
  font-weight: 700;
}

.docs-side-row[hidden] {
  display: none;
}

.row-star-indicator {
  display: inline-grid;
  place-items: center;
  appearance: none;
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--accent-2);
  cursor: pointer;
  font-size: 0.78rem;
  line-height: 16px;
  padding: 0;
  text-align: center;
}

.row-star-indicator:hover,
.row-star-indicator:focus-visible {
  border-color: color-mix(in srgb, var(--accent-2) 28%, transparent);
  background: color-mix(in srgb, var(--accent-2) 8%, transparent);
}

.row-star-indicator:disabled {
  cursor: progress;
  opacity: 0.62;
}

.docs-side-row > span:nth-child(2) {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.docs-side-count {
  color: var(--ink-mute);
  font-family: var(--mono);
  font-size: 0.66rem;
}

.docs-side-count.accent {
  padding: 1px 7px;
  border-radius: 999px;
  color: white;
  background: var(--accent);
  font-weight: 700;
}

.docs-side-toggle {
  width: 100%;
  min-height: 30px;
  margin: 4px 0 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--accent);
  cursor: pointer;
  font: 700 0.76rem var(--sans);
  text-align: left;
  padding: 6px 10px;
}

.docs-side-toggle:hover {
  background: var(--row-hover);
}

.docs-tag-row {
  grid-template-columns: 20px minmax(0, 1fr) auto;
  padding-left: 10px;
  padding-right: 10px;
}

.docs-type-row {
  grid-template-columns: 20px minmax(0, 1fr) auto;
  padding-left: 10px;
  padding-right: 10px;
}

.doc-type-dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  background: color-mix(in srgb, var(--accent) 64%, var(--panel));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 70%, transparent);
}

.docs-corr-row {
  grid-template-columns: 22px minmax(0, 1fr) auto;
}

.docs-side-empty {
  padding: 7px 8px 9px;
  color: var(--ink-mute);
  font-size: 0.78rem;
}

.docs-main-panel {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.docs-page-head {
  padding: var(--app-page-head-padding);
}

.docs-head-actions {
  flex-wrap: wrap;
  gap: 9px;
}

.docs-head-actions .btn {
  padding: 7px 10px;
  font-size: 0.78rem;
  text-decoration: none;
}

.docs-filter-bar {
  margin: 0;
  padding: 12px 26px;
  border-bottom: 1px solid var(--stroke-soft);
  gap: 8px;
}

.docs-filter-bar .filter-chip {
  min-height: 32px;
  padding: 3px 6px 3px 10px;
  border-radius: 999px;
  background: var(--paper);
}

.docs-filter-bar .filter-chip-search {
  min-width: 260px;
  flex: 1 1 320px;
  border-radius: 10px;
}

.docs-filter-bar .filter-chip-search input[type="text"] {
  flex: 1 1 auto;
  min-width: 0;
  height: 24px;
  line-height: 24px;
}

.docs-filter-bar input,
.docs-filter-bar .filter-dropdown-trigger {
  font-size: 0.78rem;
}

.docs-filter-bar .chip-prefix {
  font-size: 0.62rem;
  font-family: var(--mono);
  letter-spacing: 0.12em;
  color: var(--ink-mute);
  text-transform: uppercase;
}

.docs-filter-bar .filter-dropdown-trigger {
  min-height: 24px;
  min-width: 132px;
  border: 0;
  background: transparent;
  padding-top: 3px;
  padding-bottom: 3px;
}

.docs-filter-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 26px 11px;
  border-bottom: 1px solid var(--stroke-soft);
  background: color-mix(in srgb, var(--paper) 82%, var(--panel));
}

.docs-filter-star,
.docs-filter-count,
.docs-filter-clear {
  min-height: 28px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 700;
  padding: 5px 11px;
}

.docs-filter-star {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--stroke);
  background: var(--paper);
  color: var(--ink-soft);
  cursor: pointer;
}

.docs-filter-star.is-active,
.docs-filter-star[aria-pressed="true"] {
  border-color: color-mix(in srgb, var(--accent) 48%, var(--stroke));
  background: var(--accent-soft);
  color: var(--accent);
}

.docs-filter-star:hover {
  background: var(--row-hover);
}

.doc-star-button {
  border-color: color-mix(in srgb, var(--accent) 28%, var(--stroke));
}

.doc-star-button.is-starred,
.doc-star-button[aria-pressed="true"] {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 54%, var(--stroke));
}

.docs-filter-count {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--stroke);
  background: var(--panel);
  color: var(--ink-soft);
}

.docs-filter-clear {
  border: 1px solid color-mix(in srgb, var(--accent) 34%, var(--stroke));
  background: var(--paper);
  color: var(--accent);
  cursor: pointer;
}

.docs-filter-clear:disabled {
  border-color: var(--stroke-soft);
  color: var(--ink-mute);
  cursor: default;
  opacity: 0.68;
}

.docs-filter-clear:not(:disabled):hover {
  background: var(--accent-soft);
}

.inflight-strip {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 360px) 28px;
  align-items: center;
  gap: 22px;
  margin: 16px 26px 0;
  padding: 18px 18px 16px 20px;
  border: 1px dashed color-mix(in srgb, var(--accent) 46%, var(--stroke));
  border-radius: 14px;
  background: color-mix(in srgb, var(--accent) 4%, var(--paper));
}

.inflight-head {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 0.88rem;
  font-weight: 700;
}

.inflight-title {
  color: var(--ink);
  text-decoration: none;
}

.inflight-title:hover {
  color: var(--accent);
}

.inflight-spin span {
  display: block;
  width: 13px;
  height: 13px;
  border: 2px solid color-mix(in srgb, var(--accent) 22%, transparent);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: docs-spin 1s linear infinite;
}

.inflight-files {
  display: grid;
  gap: 5px;
  margin-top: 12px;
  color: var(--ink);
  font-size: 0.82rem;
  line-height: 1.25;
}

.inflight-files span {
  min-height: 18px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.inflight-progress {
  display: grid;
  gap: 5px;
  padding-top: 31px;
}

.inflight-progress-row {
  display: grid;
  grid-template-columns: 88px minmax(110px, 1fr);
  align-items: center;
  gap: 12px;
  min-height: 18px;
  color: var(--ink-soft);
  font-family: var(--mono);
  font-size: 0.74rem;
}

.inflight-progress-track {
  display: block;
  height: 4px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--stroke) 60%, transparent);
  overflow: hidden;
}

.inflight-progress-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.inflight-progress-track[data-stage="failed"] span {
  background: #8f2f2f;
}

.inflight-progress-track[data-stage="queued"] span {
  background: var(--ink-mute);
}

.inflight-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 7px;
  color: var(--ink-soft);
  text-decoration: none;
}

.inflight-close:hover {
  background: rgba(0, 0, 0, 0.06);
  color: var(--ink);
}

@keyframes docs-spin {
  to {
    transform: rotate(360deg);
  }
}

.doc-pagination {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 26px;
  border-top: 1px solid var(--stroke-soft);
  background: color-mix(in srgb, var(--bg-panel) 72%, transparent);
}

.pg-left {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  min-width: 0;
}

.pg-range,
.pg-processing {
  font-family: var(--mono);
  font-size: 0.76rem;
  color: var(--ink-mute);
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.pg-range b {
  color: var(--ink);
  font-weight: 600;
}

.pg-pill {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 4px;
  border: 1px solid var(--stroke);
  border-radius: 11px;
  background: var(--paper-solid);
  box-shadow: var(--shadow-sm);
}

.pg-pbtn {
  width: 30px;
  height: 28px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  background: transparent;
  border-radius: 7px;
  color: var(--ink-soft);
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease;
}

.pg-pbtn:hover:not(:disabled) {
  background: var(--row-hover);
  color: var(--ink);
}

.pg-pbtn:disabled {
  opacity: 0.3;
  cursor: default;
}

.pg-pbtn .icon {
  width: 15px;
  height: 15px;
}

.pg-pcount {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  padding: 0 12px;
  font-family: var(--mono);
  font-size: 0.82rem;
  color: var(--ink-mute);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.pg-pcount b {
  color: var(--accent);
  font-size: 0.9rem;
  font-weight: 600;
}

.pg-pdiv {
  color: var(--stroke);
}

.docs-total-label,
.page-indicator {
  font-size: 0.76rem;
}

.docs-list-toolbar {
  margin: 0;
  padding: 10px 26px;
  border-bottom: 1px solid var(--stroke-soft);
}

.docs-list-toolbar .docs-summary {
  margin-left: auto;
  order: 2;
}

.docs-list-toolbar .pagination-controls {
  order: 1;
}

.docs-list-toolbar .btn {
  padding: 4px 8px;
  font-size: 0.7rem;
}

.docs-table-wrap.doc-table {
  flex: 1;
  min-height: 0;
  margin: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  overflow: auto;
}

.docs-table-bottom-spacer {
  display: block;
  height: 0;
}

.documents-workbench:has(.docs-bulk-bar:not([hidden])) .docs-table-bottom-spacer {
  height: 112px;
}

.docs-design-table {
  display: block;
  width: 100%;
  min-width: 1080px;
  border-collapse: separate;
  border-spacing: 0;
}

.docs-design-table thead,
.docs-design-table tbody {
  display: block;
  width: 100%;
}

.docs-design-table .doc-thead,
.docs-design-table .doc-row {
  display: grid;
  width: 100%;
  box-sizing: border-box;
  grid-template-columns: 36px minmax(500px, 1fr) minmax(126px, 154px) minmax(132px, 168px) 112px;
  align-items: center;
  column-gap: 18px;
  padding: 0 26px;
}

.docs-design-table .doc-thead {
  position: sticky;
  top: 0;
  z-index: 2;
  min-height: 34px;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--stroke-soft);
}

.docs-design-table .doc-thead th {
  display: flex;
  align-items: center;
  height: 34px;
  padding: 0;
  border-bottom: 0;
  background: transparent;
  color: var(--ink-mute);
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.docs-design-table .doc-thead th[aria-label="Actions"] {
  display: none;
}

.docs-design-table .doc-row {
  position: relative;
  min-height: 82px;
  background: color-mix(in srgb, var(--paper) 28%, transparent);
  border-bottom: 1px solid var(--stroke-soft);
  transition: background 120ms ease;
}

.docs-design-table .doc-row:hover {
  background: var(--row-hover);
}

.docs-design-table .doc-row.is-inline-updated {
  animation: doc-row-inline-update 1050ms ease-out;
}

@keyframes doc-row-inline-update {
  0% {
    background: color-mix(in srgb, var(--accent) 18%, white);
    box-shadow: inset 3px 0 0 var(--accent);
  }
  65% {
    background: color-mix(in srgb, var(--accent) 8%, white);
    box-shadow: inset 3px 0 0 color-mix(in srgb, var(--accent) 40%, transparent);
  }
  100% {
    background: color-mix(in srgb, var(--paper) 28%, transparent);
    box-shadow: inset 3px 0 0 transparent;
  }
}

.docs-design-table .doc-row.is-selected {
  background: var(--row-selected);
}

.docs-design-table .doc-row.is-selected::before {
  content: "";
  position: absolute;
  left: 0;
  top: 13px;
  bottom: 13px;
  width: 3px;
  border-radius: 0 999px 999px 0;
  background: var(--accent);
}

.pending-design-table {
  min-width: 980px;
}

.pending-design-table .doc-thead,
.pending-design-table .doc-row {
  grid-template-columns: minmax(380px, 1fr) minmax(210px, 240px) minmax(116px, 140px) minmax(126px, 160px) 40px;
}

.pending-design-table .td-status {
  display: grid !important;
  grid-template-columns: max-content minmax(92px, 1fr);
  align-items: center;
  gap: 12px;
}

.pending-design-table .td-file {
  display: grid !important;
  gap: 2px;
  align-content: center;
}

.pending-stage {
  display: grid;
  gap: 4px;
  min-width: 0;
  width: 100%;
}

.pending-stage-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--ink-soft);
  font-family: var(--mono);
  font-size: 0.66rem;
  line-height: 1;
}

.pending-stage-track {
  display: block;
  height: 4px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--stroke) 64%, transparent);
  overflow: hidden;
}

.pending-stage-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.pending-stage-track[data-stage="failed"] span {
  background: #8f2f2f;
}

.pending-stage-track[data-stage="queued"] span {
  background: var(--ink-mute);
}

.pending-list-toolbar {
  padding: 12px 26px;
  margin: 0;
  border-bottom: 1px solid var(--stroke-soft);
}

.date-size-sort-group {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.date-size-sort-button {
  min-width: 0;
  padding-right: 0;
}

.docs-design-table td {
  display: flex;
  align-items: center;
  min-width: 0;
  padding: 0;
  border-bottom: 0;
  background: transparent;
  font-size: 0.8rem;
}

.td-check input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
}

.td-title {
  display: grid !important;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 14px;
  align-items: start !important;
  padding-right: 4px !important;
}

.type-icon {
  width: 31px;
  height: 38px;
  border-radius: 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--paper);
  border: 1px solid var(--stroke-soft);
  color: var(--ink-soft);
  position: relative;
  flex: 0 0 auto;
}

.type-icon::after {
  content: "";
  position: absolute;
  top: -1px;
  right: -1px;
  width: 10px;
  height: 10px;
  border-left: 1px solid var(--stroke-soft);
  border-bottom: 1px solid var(--stroke-soft);
  border-radius: 0 6px 0 4px;
  background: var(--bg-panel-solid);
}

.type-icon.type-pdf {
  color: #b0552f;
  background: color-mix(in srgb, #b0552f 7%, var(--paper));
  border-color: color-mix(in srgb, #b0552f 25%, var(--stroke));
}

.type-icon.type-image {
  color: #2c6488;
  background: color-mix(in srgb, #2c6488 7%, var(--paper));
  border-color: color-mix(in srgb, #2c6488 25%, var(--stroke));
}

.type-icon.type-email {
  color: #5b6f6a;
}

.type-icon.type-spreadsheet {
  color: var(--accent);
}

.title-stack {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.title-link {
  display: block;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  color: var(--ink);
  font-size: 0.86rem;
  font-weight: 700;
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.title-link:hover {
  color: var(--accent);
}

.title-meta {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  color: var(--ink-mute);
  font-family: var(--mono);
  font-size: 0.68rem;
}

.title-meta .filename {
  min-width: 0;
  max-width: 38ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.title-meta .dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: currentColor;
  flex: 0 0 auto;
}

.row-summary {
  max-width: 100%;
  margin-top: 3px;
  overflow: hidden;
  color: var(--ink-soft);
  font-size: 0.76rem;
  font-style: italic;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row-summary::before {
  content: "✦ ";
  color: var(--accent);
  font-style: normal;
}

.corr-cell {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  max-width: 100%;
}

.corr-cell > span:last-child,
.corr-link {
  min-width: 0;
  overflow: hidden;
  color: inherit;
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.corr-link:hover {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.corr-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 7px;
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 70%, black));
  color: white;
  font-size: 0.6rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  flex: 0 0 auto;
}

.td-tags {
  display: flex !important;
  flex-wrap: wrap;
  align-content: center;
  align-self: stretch;
  gap: 4px;
  padding-left: 2px !important;
  padding-right: 8px !important;
  padding-top: 8px !important;
  padding-bottom: 8px !important;
}

.tag-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 20px;
  padding: 2px 7px;
  border: 1px solid color-mix(in srgb, var(--tag-color, var(--stroke)) 28%, var(--stroke-soft));
  border-radius: 5px;
  background: color-mix(in srgb, var(--tag-color, var(--paper)) 8%, var(--paper));
  color: color-mix(in srgb, var(--tag-color, var(--ink)) 72%, var(--ink));
  font-size: 0.64rem;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
}

.td-tags .tag-pill {
  position: relative;
  max-width: 9rem;
  min-width: 0;
}

.td-tags .tag-pill:hover,
.td-tags .tag-pill:focus-visible {
  z-index: 5;
}

.td-tags .tag-pill[data-tag-clipped="true"]:hover::after,
.td-tags .tag-pill[data-tag-clipped="true"]:focus-visible::after {
  content: attr(data-full-tag);
  position: absolute;
  left: 0;
  bottom: calc(100% + 6px);
  max-width: min(28rem, 62vw);
  width: max-content;
  padding: 6px 9px;
  border: 1px solid color-mix(in srgb, var(--accent) 42%, #2f3a35);
  border-radius: 6px;
  background: #ffffff;
  box-shadow: 0 14px 32px rgba(31, 43, 39, 0.28), 0 0 0 1px rgba(255, 255, 255, 0.95) inset;
  color: var(--ink);
  font-size: 0.74rem;
  font-weight: 600;
  line-height: 1.25;
  white-space: normal;
  overflow-wrap: anywhere;
  pointer-events: none;
}

.tag-pill-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tag-pill:hover {
  border-color: color-mix(in srgb, var(--tag-color, var(--accent)) 46%, var(--stroke));
  background: color-mix(in srgb, var(--tag-color, var(--paper)) 14%, var(--paper));
}

.tag-more {
  color: var(--ink-mute);
}

.tag-more-button {
  cursor: pointer;
  font-family: inherit;
}

.tag-more-button:hover {
  color: var(--ink);
}

.tag-swatch {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: var(--tag-color, var(--ink-mute));
}

.tag-swatch-xs {
  width: 7px;
  height: 7px;
}

.tag-list-label {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: color-mix(in srgb, var(--tag-color, var(--ink)) 72%, var(--ink));
  font-weight: 700;
}

.td-date-size {
  display: grid !important;
  gap: 2px;
  align-content: center;
  padding-left: 2px !important;
}

.td-size-line {
  margin-top: 3px;
  font-family: var(--mono);
  color: var(--ink-soft);
  font-size: 0.74rem;
}

.td-meta {
  color: var(--ink-mute);
  font-family: var(--mono);
  font-size: 0.66rem;
}

.td-actions .table-actions {
  display: inline-flex;
  justify-content: flex-end;
  width: 100%;
  gap: 4px;
}

.docs-design-table .td-actions {
  position: absolute;
  top: 0;
  right: 18px;
  bottom: 0;
  width: 30px;
  padding: 0;
  border-bottom: 0;
}

.row-act {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--ink-mute);
  cursor: pointer;
  opacity: 0;
  text-decoration: none;
  transition: opacity 120ms ease, background 120ms ease, color 120ms ease;
}

.doc-row:hover .row-act,
.row-act:focus-visible {
  opacity: 1;
}

.row-act:hover {
  background: rgba(0, 0, 0, 0.06);
  color: var(--ink);
}

.doc-empty {
  display: grid;
  place-items: center;
  gap: 10px;
  padding: 64px 24px;
  color: var(--ink-soft);
  text-align: center;
}

.doc-empty-mark {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent);
}

.docs-empty-row td {
  display: block;
  width: 100%;
  border-bottom: 0 !important;
  padding: 0 !important;
}

.docs-design-table .docs-empty-row {
  display: block;
  width: 100%;
  min-height: 304px;
  border-bottom: 1px solid var(--stroke-soft);
}

.docs-design-table .docs-empty-row .doc-empty {
  min-height: 304px;
  padding: 0 24px;
}

.muted {
  color: var(--ink-mute);
}

.docs-bulk-bar {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 20;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  max-width: min(calc(100vw - 28px), 840px);
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 14px;
  background: color-mix(in srgb, var(--ink) 96%, black);
  box-shadow: 0 18px 42px rgba(17, 28, 24, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.12);
  color: white;
  transform: translateX(-50%);
  animation: docs-bulk-in 200ms cubic-bezier(.2, .9, .4, 1.2);
}

.docs-bulk-bar:has(.docs-bulk-editor:not([hidden])) {
  border-color: rgba(255, 255, 255, 0.24);
  box-shadow: 0 22px 54px rgba(17, 28, 24, 0.34), inset 0 1px 0 rgba(255, 255, 255, 0.14);
}

.docs-bulk-bar[hidden] {
  display: none;
}

@keyframes docs-bulk-in {
  from {
    opacity: 0;
    transform: translate(-50%, 24px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

.bulk-count {
  padding: 0 8px 0 3px;
  color: rgba(255, 255, 255, 0.82);
  font-size: 0.78rem;
  white-space: nowrap;
}

.bulk-count strong {
  color: white;
  font-family: var(--mono);
  font-size: 0.76rem;
}

.bulk-divider {
  width: 1px;
  align-self: stretch;
  margin: 4px 2px;
  background: rgba(255, 255, 255, 0.14);
}

.bulk-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 30px;
  padding: 0 10px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: rgba(255, 255, 255, 0.84);
  cursor: pointer;
  font: inherit;
  font-size: 0.76rem;
  font-weight: 700;
  white-space: nowrap;
}

.bulk-action:hover {
  background: rgba(255, 255, 255, 0.1);
  color: white;
}

.bulk-action.is-active {
  background: rgba(255, 255, 255, 0.16);
  color: white;
}

.bulk-action-danger {
  color: #ffd6d0;
}

.bulk-action-danger:hover {
  background: rgba(255, 92, 74, 0.18);
  color: white;
}

.bulk-action-icon {
  width: 30px;
  padding: 0;
}

.docs-bulk-editor {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 10px);
  width: min(420px, calc(100vw - 32px));
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 14px;
  background: color-mix(in srgb, var(--ink) 92%, black);
  box-shadow: 0 18px 44px rgba(17, 28, 24, 0.3);
  color: white;
  transform: translateX(-50%);
}

.docs-bulk-editor[hidden] {
  display: none;
}

.docs-bulk-editor::after {
  position: absolute;
  left: 50%;
  bottom: -6px;
  width: 12px;
  height: 12px;
  background: color-mix(in srgb, var(--ink) 92%, black);
  border-right: 1px solid rgba(255, 255, 255, 0.14);
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
  content: "";
  transform: translateX(-50%) rotate(45deg);
}

.bulk-editor-head,
.bulk-editor-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.bulk-editor-head {
  margin-bottom: 10px;
  color: rgba(255, 255, 255, 0.94);
  font-size: 0.82rem;
  font-weight: 800;
}

.bulk-editor-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
}

.bulk-editor-close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: white;
}

.bulk-editor-field {
  display: grid;
  gap: 6px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.72rem;
  font-weight: 700;
}

.bulk-editor-field input {
  width: 100%;
  min-height: 38px;
  padding: 0 11px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
  color: white;
  font: inherit;
  font-size: 0.83rem;
  outline: none;
}

.bulk-editor-field input:focus {
  border-color: rgba(255, 255, 255, 0.38);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.08);
}

.bulk-editor-field input::placeholder {
  color: rgba(255, 255, 255, 0.38);
}

.bulk-editor-hint {
  min-height: 18px;
  margin: 8px 0 12px;
  color: rgba(255, 255, 255, 0.58);
  font-size: 0.72rem;
  line-height: 1.35;
}

.bulk-editor-actions {
  justify-content: flex-end;
}

.bulk-editor-button {
  min-height: 30px;
  padding: 0 11px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.82);
  cursor: pointer;
  font: inherit;
  font-size: 0.75rem;
  font-weight: 800;
}

.bulk-editor-button:hover {
  background: rgba(255, 255, 255, 0.1);
  color: white;
}

.bulk-editor-primary {
  border-color: transparent;
  background: white;
  color: var(--ink);
}

.bulk-editor-primary:hover {
  background: rgba(255, 255, 255, 0.9);
  color: var(--ink);
}

@media (max-width: 1180px) {
  .documents-workbench {
    grid-template-columns: minmax(0, 1fr);
  }

  .docs-nav-panel {
    display: none;
  }
}

@media (max-width: 760px) {
  .app-shell:has(.documents-workbench) {
    width: min(100vw - 16px, 100%);
    margin-top: 8px;
  }

  .documents-workbench {
    min-height: auto;
  }

  .docs-page-head,
  .docs-filter-bar,
  .docs-list-toolbar,
  .doc-pagination {
    padding-left: 16px;
    padding-right: 16px;
  }

  .doc-pagination {
    padding-top: 10px;
    padding-bottom: 10px;
  }

  .docs-page-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .inflight-strip {
    grid-template-columns: minmax(0, 1fr) 28px;
    align-items: start;
    margin-left: 16px;
    margin-right: 16px;
  }

  .inflight-progress {
    grid-column: 1 / -1;
    padding-top: 0;
  }

  .docs-design-table .doc-thead,
  .docs-design-table .doc-row {
    grid-template-columns: 30px minmax(230px, 1fr) 100px 82px;
  }

  .docs-design-table .th-corr,
  .docs-design-table .td-corr,
  .docs-design-table .th-tags,
  .docs-design-table .td-tags,
  .docs-design-table .td-actions {
    display: none !important;
  }

  .pending-design-table .doc-thead,
  .pending-design-table .doc-row {
    grid-template-columns: minmax(230px, 1fr) 112px 92px;
  }

  .pending-design-table .td-status {
    display: flex !important;
    gap: 0;
  }

  .pending-stage {
    display: none;
  }

  .pending-design-table .td-file {
    display: none !important;
  }

  .docs-bulk-bar {
    overflow-x: auto;
    justify-content: flex-start;
  }

  .documents-workbench:has(.docs-bulk-bar:not([hidden])) .docs-table-bottom-spacer {
    height: 136px;
  }
}

.document-detail-label {
  color: var(--ink-soft);
  font-size: 0.78rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.document-detail-value {
  color: var(--ink);
  font-size: 0.88rem;
  line-height: 1.35;
  word-break: break-word;
}

.document-detail-path {
  display: block;
  border: 1px solid var(--stroke-soft);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  padding: 8px 10px;
  font-family: var(--mono);
  font-size: 0.76rem;
  white-space: pre-wrap;
}

.document-ocr-preview {
  margin: 0;
  display: block;
  border: 1px solid var(--stroke-soft);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  padding: 8px 10px;
  font-family: var(--mono);
  font-size: 0.76rem;
  line-height: 1.35;
  white-space: pre-wrap;
  max-height: 220px;
  overflow: auto;
}

.document-history-card {
  border: 1px solid var(--stroke);
  border-radius: 12px;
  background: var(--bg-panel);
  padding: 14px 16px;
  margin-top: 0;
}

.document-history-title {
  margin: 0 0 10px;
  font-size: 0.98rem;
  font-weight: 700;
}

.document-history-list {
  display: grid;
  gap: 8px;
}

.document-history-empty {
  margin: 0;
  font-size: 0.84rem;
  color: var(--ink-soft);
}

.document-history-item {
  border: 1px solid var(--stroke-soft);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.84);
  padding: 10px;
}

.document-history-header {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  align-items: baseline;
  margin-bottom: 6px;
}

.document-history-type {
  font-weight: 700;
  font-size: 0.82rem;
  color: #1f5f4c;
}

.document-history-meta {
  color: var(--ink-soft);
  font-size: 0.76rem;
}

.document-history-changes {
  margin: 0;
  display: grid;
  gap: 2px;
}

.document-history-change {
  margin: 0;
  font-size: 0.8rem;
  line-height: 1.25;
  color: var(--ink);
  word-break: break-word;
}

.document-thread-list {
  display: grid;
  gap: 8px;
}

.document-thread-item {
  display: grid;
  gap: 7px;
  border: 1px solid var(--stroke-soft);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.84);
  padding: 10px;
}

.document-thread-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 5px 9px;
}

.document-thread-title {
  color: var(--ink);
  font-size: 0.86rem;
  font-weight: 800;
  text-decoration: none;
}

.document-thread-title:hover {
  color: var(--accent);
}

.document-thread-meta {
  color: var(--ink-soft);
  font-size: 0.74rem;
}

.document-thread-question {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.8rem;
  line-height: 1.45;
}

.document-thread-sources {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.document-thread-sources span {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border: 1px solid var(--stroke-soft);
  border-radius: 999px;
  padding: 2px 7px;
  background: color-mix(in srgb, var(--accent) 7%, #fff);
  color: var(--ink-soft);
  font-size: 0.72rem;
  font-weight: 700;
}

@media (max-width: 980px) {
  .filters-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .pagination-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .pagination-controls {
    justify-content: space-between;
  }

  .filter-chip {
    width: 100%;
  }

  .filter-select {
    width: 100%;
  }

  .document-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .document-actions-left,
  .document-actions-right {
    width: 100%;
  }
}

@media (max-width: 1100px) {
  .doc-detail-workspace {
    grid-template-columns: 1fr;
  }

  .doc-detail-rail {
    overflow: visible;
  }
}

@media (max-width: 760px) {
  .doc-detail-header-top,
  .doc-preview-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .doc-detail-actions {
    justify-content: flex-start;
  }

  .doc-preview-stage {
    grid-template-columns: 1fr;
  }

  .page-strip {
    display: none;
  }

  .page-canvas {
    padding: 16px;
  }

  .field-row,
  .sys-grid {
    grid-template-columns: 1fr;
  }
}
