:root {
  --kb-bg: #f5faf8;
  --kb-surface: #ffffff;
  --kb-surface-soft: #f2f8f6;
  --kb-ink: #092722;
  --kb-ink-soft: #294740;
  --kb-muted: #55695f;
  --kb-line: #c9d9d3;
  --kb-line-strong: #b0c6bf;
  --kb-teal: #00645f;
  --kb-teal-hover: #004e4a;
  --kb-teal-soft: #e7f5f1;
  --kb-blue: #08a9de;
  --kb-blue-soft: #e9f8fd;
  --kb-green: #86bd12;
  --kb-green-dark: #3f6600;
  --kb-green-soft: #f1f8df;
  --kb-warning: #9a5a00;
  --kb-warning-soft: #fff5df;
  --kb-danger: #b23a37;
  --kb-danger-soft: #fff0ef;
  --kb-shadow: 0 1px 2px rgba(4, 40, 34, 0.04), 0 16px 48px rgba(10, 67, 57, 0.07);
  --kb-font: "Segoe UI", "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  --kb-display: Bahnschrift, "Segoe UI Semibold", "Microsoft YaHei", system-ui, sans-serif;
  --kb-radius-sm: 6px;
  --kb-radius: 10px;
  --kb-radius-lg: 14px;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  min-height: 100%;
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--kb-ink);
  background:
    radial-gradient(circle at 91% 2%, rgba(8, 169, 222, 0.07), transparent 25rem),
    linear-gradient(180deg, #fbfdfc 0, var(--kb-bg) 28rem, #f7faf9 100%);
  font-family: var(--kb-font);
  line-height: 1.5;
}

button,
input,
select {
  font: inherit;
}

button,
a,
input,
select,
label {
  -webkit-tap-highlight-color: transparent;
}

button,
a {
  touch-action: manipulation;
}

button {
  color: inherit;
}

a {
  color: inherit;
}

svg {
  display: block;
}

[hidden] {
  display: none !important;
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 100;
  padding: 10px 14px;
  color: #ffffff;
  background: var(--kb-teal);
  border-radius: var(--kb-radius-sm);
  font-size: 14px;
  font-weight: 700;
  transform: translateY(-160%);
  transition: transform 0.16s ease;
}

.skip-link:focus {
  transform: translateY(0);
}

:focus-visible {
  outline: 3px solid rgba(8, 169, 222, 0.42);
  outline-offset: 3px;
}

.kb-header {
  position: sticky;
  top: 0;
  z-index: 20;
  min-height: 80px;
  border-bottom: 1px solid rgba(220, 232, 228, 0.9);
  background: #ffffff;
}

.kb-header__inner {
  width: min(100% - 48px, 1320px);
  min-height: 80px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 32px;
}

.kb-brand {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 20px;
  text-decoration: none;
}

.kb-brand img {
  width: 128px;
  height: 50px;
  object-fit: contain;
}

.kb-brand__divider {
  width: 1px;
  height: 34px;
  background: var(--kb-line-strong);
}

.kb-brand__product {
  color: var(--kb-ink);
  font-size: 17px;
  font-weight: 720;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.kb-nav {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.kb-nav a {
  min-height: 40px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--kb-ink-soft);
  font-size: 14px;
  font-weight: 650;
  text-decoration: none;
}

.kb-nav a:hover {
  color: var(--kb-teal);
  background: var(--kb-surface-soft);
}

.kb-nav svg,
.icon-button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.kb-nav .kb-nav__primary {
  color: #ffffff;
  background: var(--kb-teal);
}

.kb-nav .kb-nav__primary:hover {
  color: #ffffff;
  background: var(--kb-teal-hover);
}

.kb-account {
  padding-left: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-left: 1px solid var(--kb-line);
}

.kb-account__avatar {
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border: 1px solid #c6e2d9;
  border-radius: 50%;
  color: var(--kb-teal);
  background: var(--kb-teal-soft);
  font-size: 14px;
  font-weight: 750;
}

.kb-account__copy {
  max-width: 140px;
  display: grid;
  line-height: 1.25;
}

.kb-account__copy strong,
.kb-account__copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.kb-account__copy strong {
  font-size: 14px;
}

.kb-account__copy small {
  margin-top: 3px;
  color: var(--kb-muted);
  font-size: 12px;
}

.icon-button {
  width: 36px;
  height: 36px;
  padding: 0;
  display: grid;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--kb-muted);
  background: transparent;
  cursor: pointer;
}

.icon-button:hover {
  color: var(--kb-danger);
  border-color: #f0d3d1;
  background: var(--kb-danger-soft);
}

.kb-main {
  width: min(100% - 48px, 1320px);
  margin: 0 auto;
  padding: 54px 0 56px;
}

.kb-hero {
  position: relative;
  min-height: 214px;
  display: grid;
  grid-template-columns: minmax(320px, 0.85fr) minmax(560px, 1.15fr);
  align-items: center;
  gap: 64px;
}

.kb-hero::after {
  content: "";
  position: absolute;
  right: 9%;
  bottom: 10%;
  width: 240px;
  height: 120px;
  z-index: -1;
  border-radius: 50%;
  background: rgba(134, 189, 18, 0.08);
  filter: blur(40px);
}

.eyebrow,
.section-label {
  margin: 0;
  color: var(--kb-teal);
  font-family: var(--kb-display);
  font-size: 12px;
  font-weight: 760;
  letter-spacing: 0.15em;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 9px;
}

.eyebrow span {
  width: 26px;
  height: 2px;
  background: linear-gradient(90deg, var(--kb-blue) 0 48%, var(--kb-green) 48% 100%);
}

.kb-hero h1 {
  margin: 10px 0 12px;
  font-family: var(--kb-display);
  font-size: clamp(34px, 3.4vw, 52px);
  line-height: 1.12;
  letter-spacing: -0.01em;
}

.kb-hero__copy > p:last-child {
  max-width: 580px;
  margin: 0;
  color: var(--kb-muted);
  font-size: 15px;
  line-height: 1.8;
}

.ingestion-route {
  position: relative;
  margin: 0;
  padding: 30px 0 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 28px;
  list-style: none;
}

.ingestion-route::before {
  content: "";
  position: absolute;
  top: 51px;
  left: 17%;
  right: 17%;
  height: 1px;
  background: linear-gradient(90deg, rgba(8, 169, 222, 0.48), rgba(0, 100, 95, 0.55), rgba(134, 189, 18, 0.6));
}

.ingestion-route li {
  position: relative;
  min-width: 0;
  display: grid;
  justify-items: center;
  text-align: center;
}

.route-index {
  position: absolute;
  top: -28px;
  color: #5c6f69;
  font-family: var(--kb-display);
  font-size: 12px;
  letter-spacing: 0.1em;
}

.route-node {
  position: relative;
  z-index: 1;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 9px solid #f8fcfa;
  border-radius: 50%;
  box-shadow: 0 0 0 1px currentColor, 0 8px 24px rgba(14, 85, 72, 0.1);
}

.route-node::after {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}

.route-node--blue {
  color: var(--kb-blue);
}

.route-node--teal {
  color: #18a786;
}

.route-node--green {
  color: var(--kb-green);
}

.route-copy {
  margin-top: 16px;
  display: grid;
  gap: 4px;
}

.route-copy strong {
  font-size: 14px;
}

.route-copy small {
  color: var(--kb-muted);
  font-size: 12px;
  line-height: 1.5;
}

.kb-workbench {
  margin-top: 24px;
  display: grid;
  grid-template-columns: minmax(360px, 408px) minmax(0, 1fr);
  align-items: start;
  gap: 24px;
}

.upload-panel,
.library-panel {
  border: 1px solid var(--kb-line);
  border-radius: var(--kb-radius-lg);
  background: rgba(255, 255, 255, 0.95);
  box-shadow: var(--kb-shadow);
}

.upload-panel {
  padding: 28px;
}

.library-panel {
  min-height: 640px;
  padding: 28px 32px 32px;
}

.panel-heading,
.library-heading,
.selected-files__heading,
.library-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.panel-heading {
  align-items: flex-start;
}

.panel-heading h2,
.library-heading h2 {
  margin: 5px 0 0;
  font-size: 22px;
  line-height: 1.25;
  letter-spacing: -0.01em;
}

.privacy-badge {
  min-height: 28px;
  padding: 0 9px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid #cfe3dc;
  border-radius: 999px;
  color: var(--kb-teal);
  background: var(--kb-teal-soft);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.privacy-badge svg {
  width: 13px;
  height: 13px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

#uploadForm {
  margin-top: 24px;
}

.drop-zone {
  position: relative;
  min-height: 174px;
  border: 1px dashed #99c7ba;
  border-radius: var(--kb-radius);
  color: var(--kb-ink-soft);
  background:
    linear-gradient(135deg, rgba(8, 169, 222, 0.035), transparent 45%),
    var(--kb-surface-soft);
  transition: border-color 0.16s ease, background-color 0.16s ease, transform 0.16s ease;
}

.drop-zone:hover,
.drop-zone.is-dragging {
  border-color: var(--kb-teal);
  background: #ecf7f4;
}

.drop-zone.is-dragging {
  transform: translateY(-2px);
}

.drop-zone[aria-disabled="true"] {
  opacity: 1;
  color: var(--kb-muted);
  background: var(--kb-surface-soft);
}

.drop-zone[aria-disabled="true"] label {
  cursor: wait;
}

.drop-zone:focus-within {
  outline: 3px solid rgba(8, 169, 222, 0.34);
  outline-offset: 3px;
}

.drop-zone label {
  min-height: 172px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  cursor: pointer;
}

.drop-zone__icon {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--kb-teal);
  background: #ffffff;
  box-shadow: 0 6px 18px rgba(10, 76, 64, 0.1);
}

.drop-zone__icon svg {
  width: 25px;
  height: 25px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.drop-zone strong {
  margin-top: 14px;
  font-size: 14px;
}

.drop-zone label > span:last-child {
  max-width: 300px;
  margin-top: 7px;
  color: var(--kb-muted);
  font-size: 12px;
  line-height: 1.6;
}

.selected-files {
  margin-top: 14px;
  padding: 14px;
  border: 1px solid var(--kb-line);
  border-radius: 8px;
  background: #fbfdfc;
}

.selected-files__heading strong {
  font-size: 13px;
}

.text-button {
  padding: 3px 0;
  border: 0;
  color: var(--kb-teal);
  background: transparent;
  font-size: 12px;
  font-weight: 650;
  cursor: pointer;
}

#uploadQueue {
  max-height: 236px;
  margin: 10px 0 0;
  padding: 0;
  display: grid;
  gap: 6px;
  overflow-y: auto;
  list-style: none;
}

.queue-item {
  min-width: 0;
  padding: 9px 10px;
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  border-radius: var(--kb-radius-sm);
  background: var(--kb-surface-soft);
}

.queue-item__type,
.document-type {
  display: grid;
  place-items: center;
  color: var(--kb-teal);
  background: #ffffff;
  border: 1px solid var(--kb-line);
  font-family: var(--kb-display);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.queue-item__type {
  width: 32px;
  height: 32px;
  border-radius: 6px;
}

.queue-item__copy {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.queue-item__copy strong {
  overflow: hidden;
  font-size: 12px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.queue-item__copy small {
  color: var(--kb-muted);
  font-size: 12px;
}

.queue-item__copy small.is-error {
  color: var(--kb-danger);
}

.queue-item__copy small.is-duplicate {
  color: var(--kb-warning);
}

.queue-item__progress {
  height: 3px;
  margin-top: 3px;
  overflow: hidden;
  border-radius: 99px;
  background: #dbe9e4;
}

.queue-item__progress span {
  width: 0;
  height: 100%;
  display: block;
  border-radius: inherit;
  background: var(--kb-teal);
  transition: width 0.18s ease;
}

.queue-remove {
  width: 30px;
  height: 30px;
  padding: 0;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 6px;
  color: var(--kb-muted);
  background: transparent;
  cursor: pointer;
}

.queue-remove:hover {
  color: var(--kb-danger);
  background: var(--kb-danger-soft);
}

.queue-remove svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}

.queue-status-mark {
  min-width: 36px;
  color: var(--kb-teal);
  font-size: 12px;
  font-weight: 700;
  text-align: right;
}

.form-grid {
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.field {
  min-width: 0;
  display: grid;
  gap: 7px;
}

.field > span,
.visibility-fieldset legend {
  color: var(--kb-ink-soft);
  font-size: 12px;
  font-weight: 700;
}

.field select,
.status-filter select,
.search-field input {
  min-width: 0;
  border: 1px solid var(--kb-line-strong);
  border-radius: 7px;
  color: var(--kb-ink);
  background-color: #ffffff;
}

.field select {
  width: 100%;
  min-height: 42px;
  padding: 0 34px 0 11px;
  font-size: 13px;
}

.field select:focus,
.status-filter select:focus,
.search-field input:focus {
  border-color: var(--kb-teal);
  outline: 3px solid rgba(0, 100, 95, 0.12);
  outline-offset: 0;
}

.field select:disabled {
  color: var(--kb-muted);
  background: #edf3f1;
  cursor: wait;
}

.visibility-fieldset {
  min-width: 0;
  margin: 18px 0 0;
  padding: 0;
  border: 0;
}

.visibility-fieldset legend {
  padding: 0;
}

.visibility-options {
  margin-top: 7px;
  display: grid;
  gap: 8px;
}

.visibility-option {
  position: relative;
  min-height: 58px;
  padding: 10px 12px;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  border: 1px solid var(--kb-line);
  border-radius: 8px;
  background: #ffffff;
  cursor: pointer;
}

.visibility-option:has(input:checked) {
  border-color: #73b7a4;
  background: var(--kb-teal-soft);
  box-shadow: inset 3px 0 var(--kb-teal);
}

.visibility-option input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.visibility-option:focus-within {
  outline: 3px solid rgba(8, 169, 222, 0.34);
  outline-offset: 2px;
}

.visibility-option__mark {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--kb-teal);
  background: #ffffff;
}

.visibility-option__mark svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.visibility-option > span:last-child {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.visibility-option strong {
  font-size: 12px;
}

.visibility-option small {
  color: var(--kb-muted);
  font-size: 12px;
}

.capability-note {
  margin: 12px 0 0;
  display: flex;
  align-items: flex-start;
  gap: 7px;
  color: var(--kb-muted);
  font-size: 12px;
  line-height: 1.6;
}

.capability-note svg {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
  margin-top: 1px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}

.upload-button {
  width: 100%;
  min-height: 48px;
  margin-top: 18px;
  padding: 0 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border: 0;
  border-radius: 8px;
  color: #ffffff;
  background: var(--kb-teal);
  box-shadow: 0 10px 24px rgba(0, 100, 95, 0.17);
  font-size: 14px;
  font-weight: 720;
  cursor: pointer;
  transition: background-color 0.16s ease, transform 0.16s ease;
}

.upload-button:hover:not(:disabled) {
  background: var(--kb-teal-hover);
  transform: translateY(-1px);
}

.upload-button:disabled {
  color: #5c6f69;
  background: #e4ece9;
  box-shadow: none;
  cursor: not-allowed;
}

.upload-button.is-uploading svg {
  animation: upload-pulse 1s ease-in-out infinite;
}

.upload-button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.library-heading {
  align-items: flex-end;
}

.library-title-row {
  justify-content: flex-start;
  gap: 9px;
}

.document-count {
  min-width: 24px;
  height: 24px;
  padding: 0 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  color: var(--kb-teal);
  background: var(--kb-teal-soft);
  font-family: var(--kb-display);
  font-size: 12px;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
}

.refresh-button {
  min-height: 38px;
  padding: 0 11px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--kb-line);
  border-radius: 7px;
  color: var(--kb-ink-soft);
  background: #ffffff;
  font-size: 12px;
  font-weight: 650;
  cursor: pointer;
}

.refresh-button:hover {
  color: var(--kb-teal);
  border-color: #a8cec3;
  background: var(--kb-surface-soft);
}

.refresh-button[aria-busy="true"] svg {
  animation: spin 0.85s linear infinite;
}

.refresh-button svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.library-toolbar {
  margin-top: 22px;
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 140px;
  gap: 10px;
}

.search-field {
  position: relative;
  min-width: 0;
}

.search-field svg {
  position: absolute;
  top: 50%;
  left: 13px;
  z-index: 1;
  width: 18px;
  height: 18px;
  color: var(--kb-muted);
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  transform: translateY(-50%);
}

.search-field input,
.status-filter select {
  width: 100%;
  height: 42px;
  font-size: 13px;
}

.search-field input {
  padding: 0 12px 0 39px;
}

.search-field input::placeholder {
  color: #879b95;
}

.status-filter select {
  padding: 0 34px 0 11px;
}

.library-error {
  margin-top: 18px;
  padding: 14px;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  border: 1px solid #f0d0cd;
  border-radius: 8px;
  color: var(--kb-danger);
  background: var(--kb-danger-soft);
}

.library-error > span {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 1px solid currentColor;
  border-radius: 50%;
  font-weight: 800;
}

.library-error strong {
  font-size: 13px;
}

.library-error p {
  margin: 2px 0 0;
  color: #81504e;
  font-size: 12px;
}

.library-error button,
.library-empty button,
.filter-empty button {
  min-height: 34px;
  padding: 0 11px;
  border: 1px solid currentColor;
  border-radius: 6px;
  color: inherit;
  background: transparent;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.library-loading {
  margin-top: 24px;
  display: grid;
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--kb-line);
  border-radius: 8px;
  background: var(--kb-line);
}

.skeleton-row {
  min-height: 92px;
  padding: 18px;
  display: grid;
  grid-template-columns: 2fr 1fr 0.7fr;
  align-items: center;
  gap: 24px;
  background: #ffffff;
}

.skeleton-row span {
  height: 10px;
  border-radius: 99px;
  background: linear-gradient(90deg, #edf2f0 20%, #f8faf9 48%, #edf2f0 76%);
  background-size: 240% 100%;
  animation: shimmer 1.45s ease-in-out infinite;
}

.skeleton-row span:nth-child(2) {
  width: 80%;
}

.skeleton-row span:nth-child(3) {
  width: 66%;
}

.library-empty,
.filter-empty {
  min-height: 420px;
  padding: 40px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.library-empty__symbol {
  width: 68px;
  height: 68px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--kb-teal);
  background: var(--kb-teal-soft);
}

.library-empty__symbol svg {
  width: 38px;
  height: 38px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.library-empty h3,
.filter-empty strong {
  margin: 18px 0 0;
  font-size: 15px;
}

.library-empty p,
.filter-empty p {
  max-width: 360px;
  margin: 8px 0 18px;
  color: var(--kb-muted);
  font-size: 12px;
  line-height: 1.7;
}

.library-empty button {
  color: var(--kb-teal);
}

.filter-empty {
  min-height: 340px;
}

.filter-empty button {
  color: var(--kb-teal);
}

.document-table {
  margin-top: 18px;
  overflow: hidden;
  border: 1px solid var(--kb-line);
  border-radius: 8px;
  background: #ffffff;
}

.document-table__head,
.document-row {
  display: grid;
  grid-template-columns: minmax(220px, 1.65fr) minmax(150px, 0.8fr) minmax(112px, 0.55fr) 80px;
  gap: 16px;
}

.document-table__head {
  min-height: 38px;
  padding: 0 16px;
  align-items: center;
  border-bottom: 1px solid var(--kb-line);
  color: var(--kb-muted);
  background: var(--kb-surface-soft);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.document-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.document-list > li + li {
  border-top: 1px solid var(--kb-line);
}

.document-row {
  min-height: 98px;
  padding: 16px;
  align-items: center;
  transition: background-color 0.15s ease;
}

.document-row:hover {
  background: #fbfdfc;
}

.document-main {
  min-width: 0;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
  gap: 11px;
}

.document-type {
  width: 42px;
  height: 48px;
  border-radius: 6px;
  color: var(--kb-teal);
  background: var(--kb-teal-soft);
}

.document-copy {
  min-width: 0;
}

.document-copy strong {
  display: block;
  overflow: hidden;
  font-size: 13px;
  font-weight: 680;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.document-meta,
.document-tags {
  margin-top: 5px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  color: var(--kb-muted);
  font-size: 12px;
}

.document-meta span + span::before {
  content: "·";
  margin-right: 6px;
  color: #a8b7b2;
}

.document-tags span {
  max-width: 130px;
  padding: 2px 5px;
  overflow: hidden;
  border-radius: 3px;
  color: #55716a;
  background: #edf4f1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-cell {
  min-width: 0;
}

.status-badge {
  min-height: 24px;
  padding: 0 8px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  color: var(--kb-muted);
  background: #eef3f1;
  font-size: 12px;
  font-weight: 750;
  white-space: nowrap;
}

.status-badge i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.status-badge--processing {
  color: #087da1;
  background: var(--kb-blue-soft);
}

.status-badge--ready {
  color: var(--kb-green-dark);
  background: var(--kb-green-soft);
}

.status-badge--failed {
  color: var(--kb-danger);
  background: var(--kb-danger-soft);
}

.status-badge--duplicate {
  color: var(--kb-warning);
  background: var(--kb-warning-soft);
}

.status-badge--processing i {
  animation: status-pulse 1.2s ease-in-out infinite;
}

.status-detail {
  max-width: 220px;
  margin: 6px 0 0;
  overflow: hidden;
  color: var(--kb-muted);
  font-size: 12px;
  line-height: 1.5;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  white-space: normal;
}

.document-progress {
  width: min(100%, 120px);
  height: 3px;
  margin-top: 7px;
  overflow: hidden;
  border-radius: 99px;
  background: #dceae6;
}

.document-progress span {
  height: 100%;
  display: block;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--kb-blue), #1ab589);
  transition: width 0.3s ease;
}

.document-progress.is-indeterminate span {
  width: 38%;
  animation: progress-slide 1.2s ease-in-out infinite;
}

.visibility-cell {
  display: grid;
  gap: 3px;
}

.visibility-label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--kb-ink-soft);
  font-size: 12px;
  font-weight: 650;
}

.visibility-label svg {
  width: 14px;
  height: 14px;
  color: var(--kb-teal);
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.visibility-cell small {
  color: var(--kb-muted);
  font-size: 12px;
}

.document-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
}

.document-action {
  width: 32px;
  height: 32px;
  padding: 0;
  display: grid;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--kb-muted);
  background: transparent;
  cursor: pointer;
}

.document-action:hover {
  color: var(--kb-teal);
  border-color: var(--kb-line);
  background: var(--kb-surface-soft);
}

.document-action--delete:hover {
  color: var(--kb-danger);
  border-color: #efd2d0;
  background: var(--kb-danger-soft);
}

.document-action svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.knowledge-assurance {
  margin-top: 24px;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  border: 0;
  background: transparent;
}

.knowledge-assurance > div {
  min-width: 0;
  min-height: 64px;
  padding: 10px 13px;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  gap: 11px;
  border: 1px solid var(--kb-line);
  border-radius: var(--kb-radius);
  background: rgba(255, 255, 255, 0.78);
}

.assurance-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--kb-teal);
  background: var(--kb-teal-soft);
}

.assurance-icon svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.knowledge-assurance p {
  margin: 0;
  display: grid;
  gap: 4px;
}

.knowledge-assurance strong {
  font-size: 12px;
}

.knowledge-assurance small {
  color: var(--kb-muted);
  font-size: 12px;
  line-height: 1.6;
}

.kb-footer {
  width: min(100% - 48px, 1320px);
  min-height: 72px;
  margin: 0 auto;
  padding: 18px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-top: 1px solid var(--kb-line);
  color: var(--kb-muted);
  font-size: 12px;
}

.delete-dialog {
  width: min(calc(100% - 32px), 420px);
  padding: 0;
  border: 1px solid var(--kb-line);
  border-radius: 12px;
  color: var(--kb-ink);
  background: #ffffff;
  box-shadow: 0 26px 80px rgba(4, 40, 34, 0.22);
}

.delete-dialog::backdrop {
  background: rgba(5, 28, 24, 0.46);
  backdrop-filter: blur(3px);
}

.delete-dialog form {
  padding: 28px;
  text-align: center;
}

.delete-dialog__icon {
  width: 48px;
  height: 48px;
  margin: 0 auto;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--kb-danger);
  background: var(--kb-danger-soft);
}

.delete-dialog__icon svg {
  width: 23px;
  height: 23px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.delete-dialog h2 {
  margin: 16px 0 8px;
  font-size: 18px;
}

.delete-dialog p {
  margin: 0;
  color: var(--kb-muted);
  font-size: 12px;
  line-height: 1.7;
}

.delete-dialog .delete-dialog__name {
  margin-top: 12px;
  padding: 9px;
  overflow: hidden;
  border-radius: 6px;
  color: var(--kb-ink-soft);
  background: var(--kb-surface-soft);
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.delete-dialog__actions {
  margin-top: 22px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.delete-dialog__actions button {
  min-height: 42px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.dialog-cancel {
  border: 1px solid var(--kb-line-strong);
  color: var(--kb-ink-soft);
  background: #ffffff;
}

.dialog-confirm {
  border: 1px solid var(--kb-danger);
  color: #ffffff;
  background: var(--kb-danger);
}

.dialog-confirm:disabled {
  opacity: 1;
  color: var(--kb-muted);
  background: var(--kb-surface-soft);
  cursor: wait;
}

@keyframes shimmer {
  to { background-position: -140% 0; }
}

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

@keyframes status-pulse {
  50% { opacity: 0.35; transform: scale(0.72); }
}

@keyframes upload-pulse {
  50% { transform: translateY(-2px); }
}

@keyframes progress-slide {
  0% { transform: translateX(-110%); }
  100% { transform: translateX(285%); }
}

@media (max-width: 1120px) {
  .kb-header__inner,
  .kb-main,
  .kb-footer {
    width: min(100% - 32px, 1040px);
  }

  .kb-header__inner {
    gap: 16px;
  }

  .kb-brand {
    gap: 14px;
  }

  .kb-brand img {
    width: 112px;
    height: 44px;
  }

  .kb-brand__product {
    font-size: 15px;
  }

  .kb-account__copy {
    display: none;
  }

  .kb-hero {
    grid-template-columns: minmax(300px, 0.8fr) minmax(480px, 1.2fr);
    gap: 32px;
  }

  .kb-workbench {
    grid-template-columns: 360px minmax(0, 1fr);
  }

  .upload-panel {
    padding: 24px;
  }

  .library-panel {
    padding: 24px;
  }

  .document-table__head,
  .document-row {
    grid-template-columns: minmax(190px, 1.55fr) minmax(130px, 0.75fr) 100px 72px;
    gap: 12px;
  }
}

@media (max-width: 980px) {
  .kb-header__inner {
    min-height: 72px;
  }

  .kb-header,
  .kb-header__inner {
    min-height: 72px;
  }

  .kb-brand__product,
  .kb-brand__divider {
    display: none;
  }

  .kb-nav {
    margin-left: auto;
  }

  .kb-account {
    padding-left: 10px;
  }

  .kb-main {
    padding-top: 38px;
  }

  .kb-hero {
    min-height: 0;
    grid-template-columns: 1fr;
    gap: 42px;
  }

  .kb-hero__copy {
    max-width: 680px;
  }

  .ingestion-route {
    max-width: 720px;
    width: 100%;
    justify-self: center;
  }

  .kb-workbench {
    margin-top: 48px;
    grid-template-columns: 1fr;
  }

  .upload-panel {
    display: grid;
    grid-template-columns: minmax(0, 0.72fr) minmax(360px, 1fr);
    column-gap: 28px;
  }

  .panel-heading {
    grid-column: 1;
  }

  #uploadForm {
    grid-column: 2;
    grid-row: 1 / span 2;
    margin-top: 0;
  }

  .library-panel {
    min-height: 580px;
  }
}

@media (max-width: 760px) {
  .kb-header {
    position: relative;
  }

  .kb-header__inner {
    width: calc(100% - 24px);
    padding: 10px 0;
    flex-wrap: wrap;
  }

  .kb-brand {
    order: 1;
  }

  .kb-brand img {
    width: 102px;
    height: 40px;
  }

  .kb-account {
    order: 2;
    margin-left: auto;
    border-left: 0;
  }

  .kb-nav {
    order: 3;
    width: 100%;
    margin: 0;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .kb-nav a {
    min-width: 0;
    border-color: var(--kb-line);
  }

  .kb-nav .kb-nav__primary {
    grid-column: 1 / -1;
  }

  .kb-main,
  .kb-footer {
    width: calc(100% - 24px);
  }

  .kb-main {
    padding: 32px 0 40px;
  }

  .kb-hero h1 {
    font-size: clamp(31px, 9vw, 42px);
  }

  .kb-hero__copy > p:last-child {
    font-size: 14px;
  }

  .ingestion-route {
    padding-top: 26px;
    gap: 12px;
  }

  .route-copy strong {
    font-size: 13px;
  }

  .route-copy small {
    font-size: 12px;
  }

  .upload-panel {
    padding: 22px;
    display: block;
  }

  #uploadForm {
    margin-top: 22px;
  }

  .library-panel {
    min-height: 520px;
    padding: 22px;
  }

  .document-table__head {
    display: none;
  }

  .document-list > li + li {
    border-top: 0;
  }

  .document-list {
    padding: 10px;
    display: grid;
    gap: 10px;
    background: var(--kb-surface-soft);
  }

  .document-row {
    min-height: 0;
    padding: 14px;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 15px 12px;
    border: 1px solid var(--kb-line);
    border-radius: 8px;
    background: #ffffff;
  }

  .document-main {
    grid-column: 1 / -1;
  }

  .status-cell {
    grid-column: 1;
  }

  .visibility-cell {
    grid-column: 2;
    grid-row: 2;
    align-self: start;
  }

  .document-actions {
    grid-column: 1 / -1;
    padding-top: 10px;
    justify-content: flex-start;
    border-top: 1px solid var(--kb-line);
  }

  .document-action {
    width: auto;
    min-width: 42px;
    padding: 0 9px;
  }

  .document-action::after {
    margin-left: 5px;
    font-size: 12px;
    font-weight: 650;
  }

  .document-action--retry::after {
    content: "重试";
  }

  .document-action--delete::after {
    content: "删除";
  }

  .knowledge-assurance {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .kb-main,
  .kb-footer {
    width: calc(100% - 20px);
  }

  .kb-brand img {
    width: 96px;
  }

  .kb-account__avatar {
    width: 34px;
    height: 34px;
  }

  .kb-nav a {
    padding: 0 8px;
    font-size: 13px;
  }

  .kb-hero {
    gap: 34px;
  }

  .ingestion-route::before {
    top: 47px;
  }

  .route-node {
    width: 36px;
    height: 36px;
    border-width: 8px;
  }

  .route-copy small {
    display: none;
  }

  .kb-workbench {
    margin-top: 38px;
  }

  .upload-panel,
  .library-panel {
    border-radius: 10px;
  }

  .upload-panel,
  .library-panel {
    padding: 18px;
  }

  .panel-heading {
    display: grid;
  }

  .privacy-badge {
    width: max-content;
  }

  .drop-zone label {
    padding: 20px 14px;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .library-heading {
    align-items: center;
  }

  .refresh-button span {
    display: none;
  }

  .refresh-button {
    width: 38px;
    padding: 0;
    justify-content: center;
  }

  .library-toolbar {
    grid-template-columns: 1fr;
  }

  .library-error {
    grid-template-columns: 28px minmax(0, 1fr);
  }

  .library-error button {
    grid-column: 2;
    width: max-content;
  }

  .library-empty,
  .filter-empty {
    min-height: 360px;
    padding-inline: 8px;
  }

  .document-table {
    margin-inline: -8px;
  }

  .document-row {
    padding: 12px;
  }

  .knowledge-assurance {
    padding: 18px;
  }

  .kb-footer {
    align-items: flex-start;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
  }

  .delete-dialog form {
    padding: 24px 20px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@media (prefers-contrast: more) {
  :root {
    --kb-line: #9aafa9;
    --kb-line-strong: #718d85;
    --kb-muted: #405d55;
  }

  .upload-panel,
  .library-panel,
  .document-table,
  .document-row {
    box-shadow: none;
  }
}
