:root {
  --bg: #f6f7f5;
  --surface: #ffffff;
  --surface-subtle: #f8faf9;
  --surface-raised: #ffffff;
  --ink: #16211d;
  --ink-soft: #4d5c56;
  --ink-muted: #7b8983;
  --line: #dfe6e2;
  --line-strong: #cbd6d0;
  --teal: #166c5a;
  --teal-dark: #0d5647;
  --teal-soft: #e8f4f0;
  --indigo: #4e5fad;
  --indigo-soft: #eef0fb;
  --amber: #a96813;
  --amber-soft: #fff4dd;
  --red: #a64242;
  --red-soft: #fdecec;
  --green: #2f7653;
  --green-soft: #e9f5ee;
  --blue: #326b9b;
  --blue-soft: #eaf3fa;
  --shadow-sm: 0 1px 2px rgb(15 35 27 / 6%);
  --shadow-md: 0 14px 38px rgb(15 35 27 / 13%);
  --radius-sm: 6px;
  --radius: 9px;
  --radius-lg: 13px;
  --sidebar-width: 238px;
  --drawer-width: 430px;
  --row-height: 70px;
  --col-id-width: 125px;
  --col-literature-width: 260px;
  --col-attachments-width: 180px;
  --col-extraction-width: 215px;
  --sticky-columns-width: 565px;
  --font:
    Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

body.column-resizing,
body.column-resizing * {
  cursor: col-resize !important;
  user-select: none !important;
}

button,
input,
select,
textarea {
  color: inherit;
  font: inherit;
}

button {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid rgb(22 108 90 / 35%);
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr) 0;
  width: 100%;
  height: 100%;
  transition: grid-template-columns 180ms ease;
}

.app-shell.drawer-open {
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr) var(--drawer-width);
}

.app-shell.sidebar-collapsed {
  grid-template-columns: 0 minmax(0, 1fr) 0;
}

.app-shell.sidebar-collapsed.drawer-open {
  grid-template-columns: 0 minmax(0, 1fr) var(--drawer-width);
}

.app-shell.drawer-open.conflict-review-open {
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr) min(800px, 56vw);
}

.app-shell.sidebar-collapsed.drawer-open.conflict-review-open {
  grid-template-columns: 0 minmax(0, 1fr) min(800px, 56vw);
}

.app-shell.sidebar-collapsed .sidebar {
  visibility: hidden;
  padding-right: 0;
  padding-left: 0;
  border-right: 0;
  opacity: 0;
  pointer-events: none;
}

.sidebar {
  z-index: 30;
  grid-column: 1;
  display: flex;
  min-width: 0;
  flex-direction: column;
  padding: 22px 16px 15px;
  overflow: hidden;
  background: #f1f3f1;
  border-right: 1px solid var(--line);
  transition: opacity 150ms ease, border-color 150ms ease;
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 0 23px;
}

.brand-copy {
  min-width: 0;
  flex: 1;
}

.brand-home {
  display: flex;
  align-items: center;
  gap: 9px;
  flex: 1;
  min-width: 0;
  color: inherit;
  text-decoration: none;
  border-radius: 6px;
}
.brand-home .brand-mark { flex-shrink: 0; }
.brand-home:hover .brand-name { color: var(--teal-dark); }
.brand-home:focus-visible { outline: 3px solid var(--teal); outline-offset: 4px; }

/* Close controls share a generous desktop hit target; other icons stay compact. */
body button[aria-label^="关闭"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 40px;
  width: 40px;
  min-width: 40px;
  height: 40px;
  min-height: 40px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f5f8f6;
  color: #456158;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
}
body button[aria-label^="关闭"]:hover { background: #e4f1eb; color: var(--teal-dark); }
body button[aria-label^="关闭"]:focus-visible { outline: 3px solid var(--teal); outline-offset: 3px; }
body button[aria-label^="关闭"][hidden] { display: none; }

.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 9px;
  background: var(--teal-dark);
  color: white;
  font-size: 16px;
  font-weight: 750;
  box-shadow: 0 5px 13px rgb(13 86 71 / 17%);
}

.brand-name {
  overflow: hidden;
  color: #15211d;
  font-size: 16px;
  font-weight: 720;
  letter-spacing: 0.02em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-subtitle {
  margin-top: 1px;
  overflow: hidden;
  color: var(--ink-muted);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.primary-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-item,
.project-chip {
  display: flex;
  width: 100%;
  min-height: 39px;
  align-items: center;
  gap: 10px;
  padding: 0 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink-soft);
  text-align: left;
}

.nav-item:hover,
.project-chip:hover {
  background: rgb(255 255 255 / 55%);
  color: var(--ink);
}

.nav-item.active {
  background: #ffffff;
  color: var(--teal-dark);
  box-shadow: var(--shadow-sm);
  font-weight: 650;
}

.nav-glyph {
  display: inline-grid;
  width: 19px;
  place-items: center;
  color: currentColor;
  font-size: 16px;
}

.nav-count {
  min-width: 22px;
  margin-left: auto;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgb(22 108 90 / 8%);
  color: var(--teal);
  font-size: 11px;
  text-align: center;
}

.sidebar-section {
  margin-top: 27px;
}

.sidebar-section-title {
  padding: 0 10px 8px;
  color: var(--ink-muted);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.project-chip.active {
  background: rgb(255 255 255 / 45%);
}

.project-color {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--indigo);
  box-shadow: 0 0 0 3px var(--indigo-soft);
}

.project-chip-text {
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-spacer {
  flex: 1;
}

.storage-card {
  padding: 13px 11px 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgb(255 255 255 / 45%);
}

.storage-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--ink-soft);
  font-size: 11px;
}

.storage-track {
  height: 5px;
  margin: 10px 0 7px;
  overflow: hidden;
  border-radius: 999px;
  background: #dce4df;
}

.storage-fill {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--teal);
  transition: width 260ms ease;
}

.text-button {
  padding: 0;
  border: 0;
  background: none;
  color: var(--teal);
  font-size: 12px;
  font-weight: 600;
}

.text-button:hover {
  color: var(--teal-dark);
  text-decoration: underline;
}

.local-badge {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 16px 8px 0;
  color: var(--ink-muted);
  font-size: 10px;
}

.local-badge span:last-child {
  margin-left: auto;
}

.local-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #3c9467;
  box-shadow: 0 0 0 3px rgb(60 148 103 / 12%);
}

.workspace {
  grid-column: 2;
  display: grid;
  min-width: 0;
  height: 100%;
  /* Optional mode navigation owns its row; hidden navigation collapses to 0.
     Explicit placement keeps toolbars out of the remaining-height content row. */
  grid-template-rows: 75px auto auto minmax(0, 1fr);
  overflow: hidden;
  background: var(--surface);
}

.topbar {
  grid-row: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px 10px 26px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.topbar-leading {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 11px;
}

.project-heading {
  min-width: 0;
}

.sidebar-control {
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-subtle);
  color: var(--ink-soft);
}

.sidebar-control:hover {
  border-color: var(--line-strong);
  background: #fff;
  color: var(--teal-dark);
}

.sidebar-toggle {
  width: 30px;
  height: 30px;
  margin-left: auto;
  background: rgb(255 255 255 / 42%);
}

.sidebar-reveal {
  display: none;
}

.sidebar-toggle-icon {
  position: relative;
  display: block;
  width: 18px;
  height: 17px;
  overflow: hidden;
  border: 1.5px solid currentcolor;
  border-radius: 4px;
}

.sidebar-toggle-panel {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 5px;
  border-right: 1px solid currentcolor;
  background: rgb(22 108 90 / 9%);
}

.sidebar-toggle-chevron {
  position: absolute;
  top: 50%;
  right: 2px;
  font-size: 13px;
  font-weight: 750;
  line-height: 1;
  transform: translateY(-54%);
}

.app-shell.sidebar-collapsed .sidebar-reveal {
  display: grid;
  border-color: #b9cec5;
  color: var(--teal-dark);
}

.breadcrumb {
  margin-bottom: 2px;
  color: var(--ink-muted);
  font-size: 10px;
}

.project-title-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.project-title-row h1 {
  max-width: min(620px, 48vw);
  margin: 0;
  overflow: hidden;
  color: #13201b;
  font-size: 18px;
  font-weight: 690;
  letter-spacing: -0.01em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.provider-status {
  display: flex;
  min-width: 218px;
  align-items: center;
  gap: 0;
  padding: 7px 9px 7px 8px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-subtle);
  color: var(--ink);
  text-align: left;
}

.provider-status:hover {
  border-color: var(--line-strong);
  background: white;
}

.sidebar-model-settings {
  margin: 16px 0;
}

.sidebar-model-settings .provider-status {
  width: 100%;
  min-width: 0;
  min-height: 48px;
  padding-inline: 12px;
}

.sidebar-model-settings .provider-status-copy {
  display: flex;
  margin-left: 0;
  overflow-wrap: anywhere;
}

.sidebar-model-settings .provider-status:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 3px;
}

.provider-orb {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border: 2px solid white;
  border-radius: 50%;
  color: white;
  font-size: 10px;
  font-weight: 750;
}

.provider-orb.kimi {
  background: var(--teal);
}


.provider-orb.kimi,
.provider-orb.glm {
  margin-left: -7px;
}

.provider-orb.glm {
  background: #7b5bb3;
}

.provider-orb.vision {
  margin-left: -7px;
  background: #257aa0;
}

.provider-status-copy {
  display: flex;
  min-width: 0;
  flex: 1;
  flex-direction: column;
  margin-left: 8px;
}

.provider-status strong {
  font-size: 12px;
  font-weight: 660;
}

.provider-status small {
  color: var(--ink-muted);
  font-size: 9px;
}

.chevron {
  color: var(--ink-muted);
  font-size: 13px;
}

.avatar {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: #f7f4ec;
  color: #5d4a27;
  font-weight: 700;
}

.workbench-header {
  grid-row: 3;
  position: relative;
  z-index: 5;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.projects-page {
  grid-row: 2 / -1;
  min-width: 0;
  min-height: 0;
  padding: 30px clamp(24px, 4vw, 58px) 44px;
  overflow-y: auto;
  background: var(--bg);
}

.projects-page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  max-width: 1180px;
  margin: 0 auto 25px;
}

.projects-eyebrow {
  margin-bottom: 5px;
  color: var(--teal);
  font-size: 9px;
  font-weight: 760;
  letter-spacing: 0.14em;
}

.projects-page-header h2 {
  margin: 0;
  font-size: 24px;
  font-weight: 720;
  letter-spacing: -0.02em;
}

.projects-page-header p {
  margin: 6px 0 0;
  color: var(--ink-muted);
  font-size: 11px;
}

.projects-toolbar {
  display: flex;
  min-height: 42px;
  max-width: 1180px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 0 auto 15px;
  border-bottom: 1px solid var(--line);
}

.project-view-tabs {
  display: flex;
  align-self: stretch;
  gap: 20px;
}

.project-view-tab {
  position: relative;
  padding: 0 2px;
  border: 0;
  background: none;
  color: var(--ink-muted);
  font-size: 11px;
}

.project-view-tab.active {
  color: var(--ink);
  font-weight: 680;
}

.project-view-tab.active::after {
  position: absolute;
  right: 0;
  bottom: -1px;
  left: 0;
  height: 2px;
  border-radius: 2px 2px 0 0;
  background: var(--teal);
  content: "";
}

.project-view-tab span {
  margin-left: 3px;
  color: var(--ink-muted);
  font-size: 9px;
}

.projects-storage-summary {
  color: var(--ink-muted);
  font-size: 10px;
}

.project-card-grid {
  display: grid;
  max-width: 1180px;
  grid-template-columns: repeat(auto-fill, minmax(285px, 1fr));
  gap: 14px;
  margin: 0 auto;
}

.project-card {
  display: grid;
  min-height: 206px;
  grid-template-rows: auto minmax(48px, 1fr) auto auto;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.project-card.current {
  border-color: #a9cfc2;
  box-shadow: 0 0 0 2px rgb(22 108 90 / 6%);
}

.project-card.archived {
  background: #fafbfa;
}

.project-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.project-card-head h3 {
  margin: 0;
  overflow: hidden;
  font-size: 14px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-state-tag {
  flex: 0 0 auto;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--teal-soft);
  color: var(--teal);
  font-size: 8px;
  font-weight: 680;
}

.project-state-tag.archived {
  background: #eef1ef;
  color: var(--ink-muted);
}

.project-card-description {
  margin: 9px 0 13px;
  overflow: hidden;
  color: var(--ink-muted);
  font-size: 10px;
  line-height: 1.6;
}

.project-card-meta {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.project-card-meta div {
  display: grid;
  gap: 2px;
}

.project-card-meta span {
  color: var(--ink-muted);
  font-size: 8px;
}

.project-card-meta strong {
  font-size: 10px;
  font-weight: 660;
}

.project-card-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 7px;
  padding-top: 13px;
}

.projects-empty {
  max-width: 1180px;
  margin: 55px auto 0;
  color: var(--ink-muted);
  text-align: center;
}

.projects-empty h3 {
  margin: 7px 0 3px;
  color: var(--ink-soft);
  font-size: 14px;
}

.projects-empty p {
  margin: 0;
  font-size: 10px;
}

.view-tabs {
  display: flex;
  height: 39px;
  align-items: end;
  gap: 20px;
  padding: 0 26px;
}

.workbench-filter-summary {
  padding: 10px 24px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-soft, #f7faf9);
  color: var(--ink-muted);
  font-size: 12px;
  line-height: 1.6;
}

.view-tab {
  position: relative;
  height: 39px;
  padding: 0 1px;
  border: 0;
  background: none;
  color: var(--ink-muted);
  font-size: 12px;
}

.view-tab:hover {
  color: var(--ink);
}

.view-tab.active {
  color: var(--ink);
  font-weight: 650;
}

.view-tab.active::after {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 2px;
  border-radius: 2px 2px 0 0;
  background: var(--teal);
  content: "";
}

.view-tab span {
  margin-left: 4px;
  color: var(--ink-muted);
  font-size: 10px;
}

.toolbar {
  display: flex;
  min-height: 57px;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 9px 20px 9px 26px;
  border-top: 1px solid #f3f5f4;
}

.toolbar-primary,
.toolbar-secondary {
  display: flex;
  align-items: center;
  gap: 7px;
}

.toolbar-divider {
  width: 1px;
  height: 24px;
  margin: 0 4px;
  background: var(--line);
}

.button {
  display: inline-flex;
  min-height: 33px;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 11px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: var(--surface);
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 620;
  box-shadow: var(--shadow-sm);
}

.button:hover {
  border-color: #b7c4bd;
  background: var(--surface-subtle);
  color: var(--ink);
}

.button.primary {
  border-color: var(--teal);
  background: var(--teal);
  color: white;
  box-shadow: 0 3px 9px rgb(22 108 90 / 16%);
}

.button.primary:hover {
  border-color: var(--teal-dark);
  background: var(--teal-dark);
  color: white;
}

.button.accent {
  border-color: #c8d0ec;
  background: var(--indigo-soft);
  color: #384890;
}

.button.accent:hover {
  border-color: #aeb9e0;
  background: #e4e8f9;
}

.button.quiet {
  border-color: transparent;
  background: transparent;
  box-shadow: none;
  color: var(--ink-muted);
}

.button.quiet:hover {
  background: var(--surface-subtle);
  color: var(--ink);
}

.button.danger {
  border-color: #efc8c8;
  background: var(--red-soft);
  color: var(--red);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.icon-button {
  display: inline-grid;
  width: 31px;
  height: 31px;
  flex: 0 0 auto;
  place-items: center;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ink-muted);
  font-size: 20px;
  line-height: 1;
}

.icon-button:hover {
  background: var(--surface-subtle);
  color: var(--ink);
}

.icon-button.subtle {
  width: 25px;
  height: 25px;
  font-size: 12px;
}

.search-box {
  display: flex;
  height: 33px;
  align-items: center;
  gap: 6px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-subtle);
  color: var(--ink-muted);
}

.search-box:focus-within {
  border-color: #93b8ad;
  box-shadow: 0 0 0 3px rgb(22 108 90 / 8%);
}

.search-box input {
  width: 146px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 11px;
}

.selection-bar {
  display: flex;
  min-height: 37px;
  align-items: center;
  justify-content: space-between;
  padding: 7px 22px 7px 27px;
  border-top: 1px solid #d7e9e3;
  background: #f0f8f5;
  color: var(--teal-dark);
  font-size: 11px;
}

.selection-actions {
  display: flex;
  gap: 16px;
}

.table-region {
  grid-row: 4;
  display: grid;
  min-width: 0;
  min-height: 0;
  grid-template-rows: minmax(0, 1fr) 34px;
  background: var(--surface);
}

.grid-scroll {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: auto;
  background:
    linear-gradient(90deg, rgb(244 247 245 / 82%), transparent 12px)
      var(--sticky-columns-width) 0 / 12px 100% no-repeat,
    var(--surface);
  scrollbar-color: #c9d4ce transparent;
  scrollbar-width: thin;
}

.data-grid {
  width: var(--grid-width, 100%);
  min-width: 0;
  border-spacing: 0;
  border-collapse: separate;
  table-layout: fixed;
  background: var(--surface);
}

.data-grid col.col-id {
  width: var(--col-id-width);
}

.data-grid col.col-literature {
  width: var(--col-literature-width);
}

.data-grid col.col-attachments {
  width: var(--col-attachments-width);
}

.data-grid col.col-extraction {
  width: var(--col-extraction-width);
}

.data-grid thead th {
  position: sticky;
  z-index: 8;
  top: 0;
  height: 42px;
  padding: 0;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line-strong);
  background: #f7f9f8;
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 640;
  text-align: left;
}

.data-grid thead th:last-child,
.data-grid tbody td:last-child {
  border-right: 0;
}

.data-grid col.col-add-control { width: var(--col-add-width, 52px); }

/* Stays reachable at the visible right edge while the data columns scroll.
   With a short table it sits directly after the last column. */
.data-grid thead th.grid-add-column {
  right: 0;
  z-index: 9;
  text-align: center;
  box-shadow: -1px 0 var(--line);
}

.grid-add-column-button {
  display: inline-grid;
  width: 40px;
  height: 34px;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: var(--surface);
  color: var(--teal-dark);
  font: inherit;
  font-size: 23px;
  line-height: 1;
  cursor: pointer;
}

.grid-add-column-button:hover { background: var(--teal-soft); border-color: var(--teal); }
.grid-add-column-button:focus-visible { outline: 2px solid var(--teal); outline-offset: 1px; }
.grid-add-column-button:disabled { opacity: 0.55; cursor: wait; }
.data-grid tbody td.grid-add-column-spacer { padding: 0; border-bottom: 0; background: var(--surface); }

.header-inner {
  display: flex;
  min-width: 0;
  height: 42px;
  align-items: center;
  gap: 7px;
  padding: 0 12px 0 10px;
}

.header-inner .header-label {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.column-move-handle {
  padding-block: 10px;
  cursor: grab;
  user-select: none;
  border-radius: 3px;
}

.column-move-handle:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 1px;
}

.column-move-handle[aria-disabled="true"] { cursor: progress; }
.column-drag-active, .column-drag-active .column-move-handle { cursor: grabbing; }
.data-grid thead th.column-dragging { background: var(--teal-soft); }
.data-grid thead th.column-drop-before { box-shadow: inset 3px 0 var(--teal); }
.data-grid thead th.column-drop-after { box-shadow: inset -3px 0 var(--teal); }

.drawer-config-version {
  margin: 6px 0 0;
  color: var(--ink-muted);
  font-size: 12px;
  font-weight: 500;
}

.column-dependency {
  display: inline-grid;
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 5px;
  background: var(--teal-soft);
  color: var(--teal-dark);
  font-size: 11px;
  font-weight: 750;
}

.column-action {
  display: grid;
  width: 23px;
  height: 23px;
  flex: 0 0 23px;
  place-items: center;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--ink-muted);
  opacity: 0.55;
}

th:hover .column-action,
.column-action:focus-visible {
  opacity: 1;
}

.column-action:hover {
  background: #eaf0ed;
  color: var(--ink);
}

/* At 90px keep the column name and settings reachable. Secondary metadata
   remains available in the name's tooltip and in column settings. */
.column-narrow .header-inner {
  gap: 4px;
  padding-left: 6px;
  padding-right: 10px;
}

.column-narrow .column-dependency {
  display: none;
}

.column-resizer {
  position: absolute;
  z-index: 20;
  top: 0;
  right: -7px;
  bottom: 0;
  width: 16px;
  cursor: col-resize;
  touch-action: none;
}

.column-resizer::before {
  position: absolute;
  top: 8px;
  right: 7px;
  bottom: 8px;
  width: 2px;
  border-radius: 999px;
  background: #bac9c3;
  content: "";
  transition: background 120ms ease, box-shadow 120ms ease;
}

.column-resizer::after {
  position: absolute;
  top: 5px;
  right: 17px;
  padding: 3px 6px;
  border: 1px solid #bdd0c8;
  border-radius: 5px;
  background: #f8fbfa;
  box-shadow: var(--shadow-sm);
  color: var(--teal-dark);
  content: attr(data-width);
  font-size: 8px;
  font-weight: 680;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-2px);
  transition: opacity 100ms ease, transform 100ms ease;
  white-space: nowrap;
}

th:hover > .column-resizer::before,
.column-resizer:focus-visible::before {
  background: #6f9586;
}

.column-resizer:hover::before,
.column-resizer.active::before {
  background: var(--teal);
  box-shadow: 0 0 0 2px rgb(22 108 90 / 12%);
}

.column-resizer:hover::after,
.column-resizer:focus-visible::after,
.column-resizer.active::after {
  opacity: 1;
  transform: translateY(0);
}

.data-grid tbody td {
  height: var(--row-height);
  padding: 8px 10px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-soft);
  vertical-align: middle;
}

.data-grid tbody tr:hover td {
  background: #fbfcfb;
}

.data-grid tbody tr.row-selected td {
  background: #f4faf7;
}

.data-grid tbody td.cell-selected {
  position: relative;
  z-index: 2;
  background: #f3f8ff !important;
  box-shadow: inset 0 0 0 2px #7e92d4;
}

.sticky-id {
  position: sticky !important;
  left: 0;
  box-shadow: 5px 0 8px rgb(29 46 38 / 4%);
}

.data-grid thead .sticky-id {
  z-index: 12;
  background: #f4f7f5;
}

.data-grid tbody .sticky-id {
  z-index: 4;
  background: white;
}

.data-grid tbody tr:hover .sticky-id {
  background: #fbfcfb;
}

.data-grid tbody tr.row-selected .sticky-id {
  background: #f4faf7;
}

.id-cell {
  display: flex;
  align-items: center;
  gap: clamp(4px, calc(var(--col-id-width) - 86px), 10px);
}

.row-checkbox,
.header-checkbox {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
  accent-color: var(--teal);
}

.ref-id {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 3px;
  padding: 4px 0;
  overflow: hidden;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: #2e4f45;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
  text-align: left;
}

.ref-id-text {
  overflow: hidden;
  text-overflow: ellipsis;
}

.ref-id svg {
  width: 12px;
  height: 12px;
  flex: 0 0 auto;
  opacity: 0.45;
}

.ref-id:hover,
.ref-id:focus-visible {
  background: var(--teal-soft);
  color: var(--teal);
}

.ref-id:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
}

.ref-id-card {
  width: min(440px, calc(100vw - 32px));
}

.ref-id-document {
  margin: 0 0 16px;
  color: var(--ink-muted);
  overflow-wrap: anywhere;
}

.ref-id-help,
.ref-id-error {
  margin: 10px 0 0;
  line-height: 1.6;
  font-size: 11px;
}

.ref-id-help {
  color: var(--ink-muted);
}

.ref-id-error {
  color: #a12f2f;
}

.file-cell {
  display: grid;
  min-width: 0;
  grid-template-columns: 29px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
}

.file-icon {
  display: grid;
  width: 28px;
  height: 34px;
  place-items: end center;
  padding-bottom: 4px;
  border: 1px solid #c9d4cf;
  border-radius: 4px;
  background: #f9fbfa;
  color: var(--ink-muted);
  font-size: 7px;
  font-weight: 750;
  letter-spacing: 0.04em;
}

.file-main {
  min-width: 0;
}

.file-name,
.file-name-link {
  display: block;
  max-width: 100%;
  overflow: hidden;
  color: var(--ink);
  font-size: 11px;
  font-weight: 610;
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-name-link:hover {
  color: var(--teal);
  text-decoration: underline;
}

.file-meta {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 3px;
  color: var(--ink-muted);
  font-size: 9px;
  overflow: hidden;
  white-space: nowrap;
}

.file-meta > span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.parse-dot {
  width: 5px;
  height: 5px;
  flex: 0 0 5px;
  border-radius: 50%;
  background: #8a9992;
}

.parse-dot.parsed,
.parse-dot.demo,
.parse-dot.vision_ready {
  background: #3b8b64;
}

.parse-dot.needs_ocr,
.parse-dot.stored_only {
  background: #d19232;
}

.parse-dot.parse_failed {
  background: #b74d4d;
}

.attachment-cell {
  display: flex;
  align-items: center;
  gap: 6px;
}

.attachment-preview {
  min-width: 0;
  flex: 1;
}

.attachment-name {
  display: block;
  overflow: hidden;
  color: var(--ink-soft);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attachment-count {
  margin-top: 2px;
  color: var(--ink-muted);
  font-size: 9px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.add-attachment {
  display: grid;
  width: 25px;
  height: 25px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px dashed #bcc9c2;
  border-radius: 6px;
  background: transparent;
  color: var(--ink-muted);
}

.add-attachment:hover {
  border-color: var(--teal);
  background: var(--teal-soft);
  color: var(--teal);
}

.extract-cell {
  position: relative;
  min-height: 48px;
  cursor: default;
}

.extract-cell.has-regenerate .cell-value {
  /* Reserve the action space so hovering does not reflow the extracted text. */
  padding-right: 34px;
}

.cell-regenerate-action {
  position: absolute;
  top: -2px;
  right: -2px;
  display: inline-flex;
  width: 28px;
  height: 28px;
  align-items: center;
  justify-content: center;
  padding: 5px;
  border: 1px solid #b9c8c1;
  border-radius: 50%;
  background: white;
  color: var(--teal-dark);
  box-shadow: var(--shadow-sm);
  opacity: 0;
  pointer-events: none;
}

/* Keep native keyboard focus available without opening the review drawer.
   Selection also preserves the existing click/touch interaction. */
.data-grid td[data-action="cell-detail"]:hover .cell-regenerate-action,
.data-grid td[data-action="cell-detail"]:focus-within .cell-regenerate-action,
.data-grid td.cell-selected .cell-regenerate-action {
  opacity: 1;
  pointer-events: auto;
}

#column-result-source-field[hidden],
#run-candidate-c[hidden],
#run-candidate-c-plus[hidden] {
  display: none;
}

.cell-regenerate-action:hover:not(:disabled),
.cell-regenerate-action:focus-visible,
.cell-regenerate-action.is-running {
  border-color: var(--teal);
  background: var(--teal-soft);
  color: var(--teal-dark);
}

.cell-regenerate-action:disabled {
  cursor: not-allowed;
}

.cell-regenerate-action svg {
  display: block;
  width: 16px;
  height: 16px;
  flex: none;
}

.cell-regenerate-action.is-running svg {
  animation: spin 1.2s linear infinite;
}

@media (prefers-reduced-motion: reduce) {
  .cell-regenerate-action.is-running svg {
    animation: none;
  }
}

.cell-value {
  display: -webkit-box;
  min-height: 17px;
  overflow: hidden;
  overflow-wrap: anywhere;
  color: var(--ink);
  font-size: 11px;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.cell-value.empty {
  color: #a7b2ad;
}

.cell-status-row {
  display: flex;
  min-height: 17px;
  align-items: center;
  gap: 5px;
  margin-top: 5px;
}

.status-button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 100%;
  padding: 0;
  overflow: hidden;
  border: 0;
  background: none;
  color: var(--ink-muted);
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-button:hover {
  color: var(--ink);
  text-decoration: underline;
}

.status-button > span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.status-dot {
  width: 6px;
  height: 6px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #aab5b0;
}

.status-dot.ai_candidate {
  background: var(--blue);
}

.status-dot.ai_agree {
  background: var(--indigo);
}

.status-dot.conflict,
.status-dot.needs_review {
  background: var(--amber);
}

.status-dot.confirmed {
  background: var(--green);
}

.status-dot.failed {
  background: var(--red);
}

.status-dot.stale,
.status-dot.stale_confirmed {
  background: #9b6f3c;
}

.status-dot.not_applicable {
  background: #89958f;
}

.status-dot.executing {
  background: var(--teal);
  box-shadow: 0 0 0 3px rgb(22 108 90 / 12%);
  animation: running-pulse 1.15s ease-in-out infinite;
}

.data-grid tbody td.cell-running {
  background: #f4faf7;
  box-shadow: inset 0 0 0 1px rgb(22 108 90 / 14%);
}

.extract-cell.is-running .cell-value.empty {
  color: var(--teal-dark);
}

@keyframes running-pulse {
  50% {
    opacity: 0.42;
    transform: scale(0.78);
  }
}

.cell-hover-action {
  position: absolute;
  right: -3px;
  bottom: -2px;
  display: none;
  padding: 2px 5px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: white;
  color: var(--teal);
  font-size: 9px;
  box-shadow: var(--shadow-sm);
}

td:not(.cell-selected):hover .cell-hover-action {
  display: block;
}

.grid-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px 0 26px;
  border-top: 1px solid var(--line);
  background: #fafbfa;
  color: var(--ink-muted);
  font-size: 10px;
}

.footer-legend {
  display: flex;
  align-items: center;
  gap: 14px;
}

.footer-legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.legend-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.legend-dot.candidate {
  background: var(--blue);
}

.legend-dot.agree {
  background: var(--indigo);
}

.legend-dot.conflict {
  background: var(--amber);
}

.legend-dot.confirmed {
  background: var(--green);
}

.table-loading {
  position: absolute;
  z-index: 80;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  background: rgb(255 255 255 / 88%);
  color: var(--ink-muted);
  font-size: 12px;
}

.loading-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid #d7e0dc;
  border-top-color: var(--teal);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.grid-empty {
  display: grid;
  min-height: 430px;
  place-items: center;
  align-content: center;
  padding: 40px;
  text-align: center;
}

.empty-icon {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-subtle);
  color: var(--ink-muted);
  font-size: 23px;
}

.grid-empty h2 {
  margin: 13px 0 4px;
  font-size: 15px;
}

.grid-empty p {
  margin: 0 0 15px;
  color: var(--ink-muted);
  font-size: 11px;
}

/* Follows the last data row; horizontal scrolling never hides the action. */
.grid-add-row {
  position: sticky;
  left: 0;
  width: 100%;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.grid-add-row-button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 44px;
  padding: 10px 14px;
  border: 0;
  background: #f8fbf9;
  color: var(--teal-dark);
  font: inherit;
  font-size: 12px;
  text-align: left;
  cursor: pointer;
}

.grid-add-row-button > span:first-child { font-size: 19px; line-height: 1; }
.grid-add-row-button:hover { background: var(--teal-soft); }
.grid-add-row-button:focus-visible { outline: 2px solid var(--teal); outline-offset: -3px; }
.grid-add-row-button:disabled { opacity: 0.6; cursor: wait; }

.drawer {
  z-index: 35;
  grid-column: 3;
  display: grid;
  min-width: 0;
  height: 100%;
  grid-template-rows: minmax(71px, auto) minmax(0, 1fr) auto;
  overflow: hidden;
  border-left: 1px solid var(--line-strong);
  background: var(--surface-raised);
  box-shadow: -8px 0 28px rgb(26 44 36 / 8%);
  opacity: 0;
  transform: translateX(18px);
  pointer-events: none;
  transition: opacity 140ms ease, transform 180ms ease;
}

.app-shell.drawer-open .drawer {
  opacity: 1;
  transform: translateX(0);
  pointer-events: auto;
}

.app-shell.drawer-open .toolbar-secondary {
  display: none;
}

.drawer-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  padding: 13px 15px 10px 19px;
  border-bottom: 1px solid var(--line);
}

#drawer-progress-slot { flex: 0 0 100%; min-width: 0; }
#drawer-progress-slot:empty { display: none; }

.drawer-eyebrow,
.modal-eyebrow {
  color: var(--ink-muted);
  font-size: 9px;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.drawer-header h2,
.modal-header h2 {
  margin: 3px 0 0;
  color: var(--ink);
  font-size: 16px;
  font-weight: 680;
}

.drawer-body {
  min-height: 0;
  overflow-y: auto;
  padding: 17px 19px 24px;
}

.drawer-footer {
  display: flex;
  min-height: 59px;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 10px 17px;
  border-top: 1px solid var(--line);
  background: #fbfcfb;
}

.regenerate-drawer-action {
  margin-right: auto;
  color: var(--teal-dark);
}

.form-section {
  padding: 0 0 19px;
}

.form-section + .form-section {
  padding-top: 17px;
  border-top: 1px solid var(--line);
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.section-heading h3 {
  margin: 0;
  font-size: 12px;
  font-weight: 680;
}

.section-heading small {
  color: var(--ink-muted);
  font-size: 9px;
}

.field {
  display: grid;
  gap: 6px;
  margin-bottom: 13px;
}

.field:last-child {
  margin-bottom: 0;
}

.field > span,
.field-label {
  color: var(--ink-soft);
  font-size: 10px;
  font-weight: 630;
}

.field > span em {
  margin-left: 4px;
  padding: 1px 5px;
  border-radius: 999px;
  background: var(--teal-soft);
  color: var(--teal);
  font-size: 8px;
  font-style: normal;
  font-weight: 650;
}

.field input,
.field select,
.field textarea,
.final-value-input {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: white;
  color: var(--ink);
  font-size: 11px;
}

.field input,
.field select {
  height: 35px;
  padding: 0 10px;
}

.field textarea {
  min-height: 104px;
  padding: 9px 10px;
  line-height: 1.55;
  resize: vertical;
}

.instruction-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.instruction-label-row > span {
  color: var(--ink-soft);
  font-size: 10px;
  font-weight: 630;
}

.instruction-label-row > span b {
  margin-left: 2px;
  color: #cf4a3d;
  font-weight: 700;
}

.reference-picker {
  position: relative;
}

.reference-field-trigger {
  min-height: 24px;
  padding: 2px 3px;
  border: 0;
  background: transparent;
  color: var(--teal);
  font-size: 10px;
  font-weight: 680;
}

.reference-field-trigger:hover:not(:disabled),
.reference-field-trigger:focus-visible {
  color: var(--teal-dark);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.reference-field-trigger:disabled {
  color: var(--ink-muted);
  cursor: not-allowed;
  opacity: 0.6;
}

.reference-field-menu {
  position: absolute;
  z-index: 8;
  top: calc(100% + 5px);
  right: 0;
  width: min(255px, calc(100vw - 48px));
  max-height: 260px;
  padding: 6px;
  overflow-y: auto;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: white;
  box-shadow: 0 12px 30px rgb(24 48 42 / 14%);
}

.reference-field-menu-title {
  padding: 5px 7px 7px;
  color: var(--ink-muted);
  font-size: 8px;
  font-weight: 650;
}

.reference-field-option {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  width: 100%;
  gap: 7px;
  min-height: 34px;
  padding: 6px 7px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ink-soft);
  text-align: left;
}

.reference-field-option:hover,
.reference-field-option:focus-visible {
  background: var(--teal-soft);
  color: var(--teal-dark);
  outline: 0;
}

.reference-field-option > span:nth-child(2) {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reference-field-option small {
  color: var(--teal);
  font-size: 8px;
}

.reference-option-type,
.reference-token-type {
  color: var(--ink-muted);
  font-size: 9px;
  font-weight: 680;
}

.reference-field-empty {
  padding: 10px 8px;
  color: var(--ink-muted);
  font-size: 9px;
  line-height: 1.5;
}

.instruction-editor-shell {
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: white;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}

.instruction-editor-shell:focus-within {
  border-color: #78a99c;
  box-shadow: 0 0 0 3px rgb(22 108 90 / 8%);
}

.instruction-editor {
  min-height: 112px;
  padding: 10px 11px;
  color: var(--ink);
  font-size: 11px;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
  outline: 0;
}

.instruction-editor:empty::before {
  color: var(--ink-muted);
  content: attr(data-placeholder);
  pointer-events: none;
}

.reference-token {
  display: inline-flex;
  max-width: min(220px, 75%);
  min-height: 23px;
  align-items: center;
  gap: 4px;
  margin: 0 3px;
  padding: 1px 4px 1px 7px;
  border: 1px solid #d6ddda;
  border-radius: 5px;
  background: #edf0ef;
  color: var(--ink-soft);
  line-height: 1;
  vertical-align: baseline;
}

.reference-token-type,
.reference-token-name {
  line-height: 1;
}

.reference-token-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reference-token button {
  display: grid;
  width: 17px;
  height: 17px;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--ink-muted);
  font-size: 13px;
  line-height: 1;
}

.reference-token button:hover,
.reference-token button:focus-visible {
  background: rgb(43 67 61 / 9%);
  color: var(--ink);
  outline: 0;
}

.instruction-meta {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.instruction-meta .field-hint {
  max-width: 78%;
}

#instruction-count {
  flex: none;
  color: var(--ink-muted);
  font-size: 8px;
  white-space: nowrap;
}

.instruction-field .dependency-preview {
  margin: 2px 0 0;
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.final-value-input:focus {
  border-color: #78a99c;
  outline: 0;
  box-shadow: 0 0 0 3px rgb(22 108 90 / 8%);
}

.field-hint {
  color: var(--ink-muted);
  font-size: 9px;
  line-height: 1.45;
}

.dependency-preview {
  margin: -3px 0 14px;
  padding: 10px 11px;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  background: #fafcfb;
  color: var(--ink-muted);
  font-size: 9px;
  line-height: 1.5;
}

.dependency-preview.active {
  border-style: solid;
  border-color: #bfd8ce;
  background: #f3faf7;
  color: var(--ink-soft);
}

.dependency-flow,
.upstream-context-flow {
  display: flex;
  align-items: center;
  gap: 8px;
}

.dependency-flow {
  margin-bottom: 5px;
}

.dependency-flow span,
.upstream-context-flow span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dependency-flow b,
.upstream-context-flow b {
  color: var(--teal);
}

.dependency-flow strong,
.upstream-context-flow strong {
  color: var(--teal-dark);
  font-weight: 680;
}

.dependency-preview small {
  color: var(--ink-muted);
  font-size: 8px;
  line-height: 1.5;
}

.upstream-context-panel blockquote {
  max-height: 150px;
  margin: 9px 0 7px;
  padding: 9px 10px;
  overflow: auto;
  border-left: 3px solid #9bc5b5;
  border-radius: 0 6px 6px 0;
  background: #f4f9f7;
  color: var(--ink-soft);
  font-size: 10px;
  line-height: 1.55;
  white-space: pre-wrap;
}

.switch-row,
.check-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--ink-soft);
  font-size: 10px;
}

.check-row {
  justify-content: flex-start;
  margin-top: 14px;
}

.switch {
  position: relative;
  display: inline-flex;
  width: 34px;
  height: 20px;
  flex: 0 0 auto;
}

.switch input {
  position: absolute;
  opacity: 0;
}

.switch-track {
  width: 100%;
  height: 100%;
  border-radius: 999px;
  background: #cbd4d0;
  transition: background 150ms ease;
}

.switch-track::after {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: white;
  box-shadow: 0 1px 3px rgb(0 0 0 / 18%);
  content: "";
  transition: transform 150ms ease;
}

.switch input:checked + .switch-track {
  background: var(--teal);
}

.switch input:checked + .switch-track::after {
  transform: translateX(14px);
}

.model-route {
  display: grid;
  gap: 7px;
}

.model-route-row {
  display: grid;
  grid-template-columns: 90px minmax(0, 1fr);
  align-items: center;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-subtle);
}

.model-route-row span {
  color: var(--ink-muted);
  font-size: 9px;
}

.model-route-row strong {
  color: var(--ink-soft);
  font-size: 10px;
  font-weight: 650;
  overflow-wrap: anywhere;
}

.experimental-tag,
.draft-tag {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--amber-soft);
  color: var(--amber);
  font-size: 8px;
  font-weight: 680;
}

.draft-tag {
  background: var(--blue-soft);
  color: var(--blue);
}

.cell-context {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-subtle);
  color: var(--ink-soft);
  font-size: 10px;
}

.cell-context strong {
  color: var(--ink);
}

.cell-context-separator {
  color: var(--line-strong);
}

.current-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  font-size: 9px;
}

.final-value-block {
  padding: 13px;
  border: 1px solid #cdd8d3;
  border-radius: 9px;
  background: #fbfdfc;
}

.final-value-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 7px;
  color: var(--ink-soft);
  font-size: 10px;
  font-weight: 650;
}

.final-value-input {
  min-height: 67px;
  padding: 9px 10px;
  line-height: 1.5;
  resize: vertical;
}

.candidate-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 9px;
}

.candidate-panel {
  min-width: 0;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.candidate-panel.extractor {
  border-top: 2px solid var(--teal);
}

.candidate-panel.reviewer {
  border-top: 2px solid var(--indigo);
}

.candidate-panel.arbiter {
  border-top: 2px solid #7b5bb3;
}

.candidate-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 7px;
  margin-bottom: 9px;
}

.candidate-name {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  font-weight: 700;
}

.candidate-mini-orb {
  display: grid;
  width: 19px;
  height: 19px;
  place-items: center;
  border-radius: 50%;
  color: white;
  font-size: 8px;
}

.candidate-panel.extractor .candidate-mini-orb {
  background: var(--teal);
}

.candidate-panel.reviewer .candidate-mini-orb {
  background: var(--indigo);
}

.candidate-panel.arbiter .candidate-mini-orb {
  background: #7b5bb3;
}

.candidate-model {
  overflow: hidden;
  color: var(--ink-muted);
  font-size: 7px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.candidate-value {
  min-height: 47px;
  color: var(--ink);
  font-size: 11px;
  font-weight: 620;
  line-height: 1.48;
}

.candidate-value-details summary {
  display: grid;
  min-height: 47px;
  grid-template-rows: auto auto;
  gap: 7px;
  color: var(--ink);
  cursor: pointer;
  font-size: 10px;
  font-weight: 620;
  line-height: 1.48;
  list-style: none;
}

.candidate-value-details summary::-webkit-details-marker {
  display: none;
}

.candidate-value-details summary b {
  color: var(--teal-dark);
  font-size: 8px;
  font-weight: 680;
}

.detail-label-open {
  display: none;
}

details[open] .detail-label-closed {
  display: none;
}

details[open] .detail-label-open {
  display: inline;
}

.candidate-value-details .candidate-value.expanded {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--line-strong);
  white-space: pre-wrap;
}

.candidate-status {
  margin-top: 7px;
  color: var(--ink-muted);
  font-size: 8px;
}

.conflict-panel,
.notice {
  padding: 11px 12px;
  border: 1px solid #efd5a7;
  border-radius: 8px;
  background: var(--amber-soft);
  color: #6d4d1e;
  font-size: 10px;
  line-height: 1.55;
}

.conflict-panel h4 {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 6px;
  color: #70480e;
  font-size: 10px;
}

.conflict-panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.conflict-panel-heading h4 {
  margin-bottom: 3px;
}

.conflict-panel-heading p {
  color: #806239;
  font-size: 9px;
}

.legacy-workflow-badge {
  flex: 0 0 auto;
  padding: 3px 7px;
  border: 1px solid rgb(160 103 24 / 24%);
  border-radius: 999px;
  background: rgb(255 255 255 / 58%);
  color: #8a642c;
  font-size: 8px;
  font-weight: 680;
  white-space: nowrap;
}

.comparison-counts {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 10px;
}

.comparison-counts span {
  padding: 3px 7px;
  border-radius: 999px;
  background: rgb(255 255 255 / 68%);
  font-size: 8px;
  font-weight: 680;
}

.comparison-counts .different {
  color: #9b5c07;
}

.comparison-counts .same {
  color: var(--teal-dark);
}

.comparison-counts .incomplete {
  color: #a34a3f;
}

.conflict-comparison-shell {
  max-width: 100%;
  margin-top: 8px;
  overflow: auto;
  border: 1px solid rgb(174 126 55 / 24%);
  border-radius: 7px;
  background: white;
  scrollbar-color: #c8b18f transparent;
  scrollbar-width: thin;
}

.conflict-comparison-shell:focus-visible {
  outline: 2px solid rgb(164 105 25 / 28%);
  outline-offset: 2px;
}

.conflict-comparison-table {
  width: 100%;
  min-width: 500px;
  border-spacing: 0;
  border-collapse: separate;
  table-layout: fixed;
  color: var(--ink-soft);
  font-size: 8px;
  line-height: 1.45;
}

.conflict-comparison-table.candidate-count-3 {
  min-width: 640px;
}

.conflict-comparison-table caption {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.conflict-comparison-table th,
.conflict-comparison-table td {
  padding: 8px;
  vertical-align: top;
  border-right: 1px solid #eadfcd;
  border-bottom: 1px solid #eadfcd;
  text-align: left;
  overflow-wrap: anywhere;
}

.conflict-comparison-table tr > :last-child {
  border-right: 0;
}

.conflict-comparison-table tbody tr:last-child > * {
  border-bottom: 0;
}

.conflict-comparison-table thead th {
  background: #f8f3ea;
  color: #725225;
  font-weight: 680;
}

.conflict-comparison-table th:first-child {
  position: sticky;
  z-index: 2;
  left: 0;
  width: 92px;
  background: #fbf7ef;
  color: #694b20;
  font-weight: 680;
}

.conflict-comparison-table thead th:first-child {
  z-index: 3;
  background: #f8f3ea;
}

.conflict-comparison-table th:last-child,
.conflict-comparison-table td:last-child {
  width: 64px;
}

.comparison-row.different > * {
  background: #fffaf0;
}

.comparison-row.different > th:first-child {
  background: #fff5df;
}

.comparison-row.same > * {
  background: #fbfdfc;
}

.comparison-row.same > th:first-child {
  background: #f1f8f5;
}

.comparison-row.incomplete > *,
.comparison-row.error > * {
  background: #fff9f7;
}

.comparison-row.incomplete > th:first-child,
.comparison-row.error > th:first-child {
  background: #fff0ec;
}

.comparison-candidate-heading {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
}

.comparison-candidate-heading > span {
  display: grid;
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  place-items: center;
  border-radius: 50%;
  background: #7d6b51;
  color: white;
  font-size: 8px;
}

.comparison-candidate-heading strong {
  overflow: hidden;
  color: #5e4420;
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conflict-comparison-table thead small {
  display: block;
  margin: 3px 0;
  overflow: hidden;
  color: #94764d;
  font-size: 7px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.comparison-candidate-state {
  color: var(--teal-dark);
  font-size: 7px;
  font-style: normal;
  font-weight: 650;
}

.comparison-candidate-state.failed {
  color: #ad4e41;
}

.comparison-value {
  color: var(--ink-soft);
  white-space: pre-wrap;
}

.comparison-empty,
.comparison-error {
  color: var(--ink-muted);
  font-style: italic;
}

.comparison-error {
  color: #a3483b;
}

.comparison-value-details summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
  align-items: start;
  color: var(--ink-soft);
  cursor: pointer;
  list-style: none;
}

.comparison-value-details summary::-webkit-details-marker {
  display: none;
}

.comparison-value-details summary b {
  color: var(--teal-dark);
  font-size: 7px;
  font-weight: 680;
  white-space: nowrap;
}

.comparison-value.expanded {
  margin-top: 7px;
  padding-top: 7px;
  border-top: 1px dashed #dfd3c0;
}

.comparison-status-cell {
  text-align: center !important;
}

.comparison-status {
  display: inline-flex;
  padding: 3px 6px;
  border-radius: 999px;
  background: #f6ead2;
  color: #936019;
  font-size: 7px;
  font-weight: 680;
  white-space: nowrap;
}

.comparison-status.same {
  background: var(--teal-soft);
  color: var(--teal-dark);
}

.comparison-status.incomplete,
.comparison-status.error {
  background: #fce9e5;
  color: #a3483b;
}

.comparison-note {
  margin-top: 7px !important;
  color: #927348;
  font-size: 7px;
}

.conflict-analysis-details {
  margin-top: 9px;
  border-top: 1px solid rgb(169 104 19 / 16%);
}

.conflict-analysis-details > summary {
  padding: 9px 1px 1px;
  color: #76501b;
  cursor: pointer;
  font-size: 8px;
  font-weight: 680;
}

.conflict-analysis-details dl {
  display: grid;
  gap: 7px;
  margin: 9px 0 0;
}

.conflict-analysis-details dl > div {
  display: grid;
  grid-template-columns: 78px minmax(0, 1fr);
  gap: 8px;
}

.conflict-analysis-details dt {
  color: #8a642c;
  font-size: 8px;
  font-weight: 680;
}

.conflict-analysis-details dd {
  margin: 0;
  color: #73572e;
  font-size: 8px;
  white-space: pre-wrap;
}

.conflict-runtime,
.conflict-diagnostics {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  margin-top: 7px;
  padding-top: 7px;
  border-top: 1px solid rgb(186 128 36 / 24%);
  color: #806239;
  font-size: 8px;
}

.conflict-panel p {
  margin: 0;
}

/* Focused field review, using the workbench's existing color and type tokens. */
.review-summary { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: baseline; margin: 12px 0; font-size: 11px; }
.review-summary strong { color: #85521b; font-size: 13px; }
.review-summary > span:last-child { color: var(--ink-muted); }
.review-warnings, .review-common, .review-run-context { margin: 12px 0; font-size: 11px; }
.review-warnings { border: 1px solid #edd3a1; border-radius: 7px; background: #fffaf0; padding: 10px; }
.review-warnings ul { margin: 8px 0 0; padding-left: 18px; line-height: 1.6; }
.review-common > summary, .review-run-context > summary, .review-warnings > summary { cursor: pointer; font-weight: 650; }
.field-review-scroll { margin-top: 10px; overflow: auto; border: 1px solid #e5dece; border-radius: 7px; }
.field-review-table { width: 100%; table-layout: fixed; border-collapse: collapse; color: var(--ink); font-size: 12px; }
.field-review-table th, .field-review-table td { padding: 10px; vertical-align: top; text-align: left; border: 1px solid #e9e2d4; }
.field-review-table thead th { background: #f7f5ee; }
.field-review-table thead th:first-child { width: 20%; }
.field-review-table small { display: block; margin-top: 5px; font-size: 10px; color: var(--ink-muted); font-weight: 400; overflow-wrap: anywhere; }
.field-review-row th { background: #fffaf0; }
.field-review-row td { background: white; overflow-wrap: anywhere; }
.field-review-label { display: block; color: #89581c; font-size: 10px; margin-top: 6px; }
.field-review-row.same .field-review-label, .field-review-row.format .field-review-label { color: var(--teal); }
.field-review-subfield th { background: #fffaf0; border-left: 3px solid #e1b46b; }
.field-review-subfield td { background: #fff; overflow-wrap: anywhere; }
.field-review-subfield.same th { background: #f5faf8; border-left-color: #a5c7bb; }
.subfield-lane-note, .subfield-note { color: var(--ink-muted); font-size: 11px; }
.subfield-details-row > td { background: #fafbf9; }
.subfield-details-row details { margin: 6px 0 10px; }
.subfield-details-row summary { cursor: pointer; font-size: 12px; font-weight: 600; }
.subfield-details-row .subfield-note { margin-top: 10px; line-height: 1.5; }
.subfield-details-row .field-review-table { font-size: 12px; }
.field-pick { padding: 4px 10px; min-height: 28px; margin-top: 8px; border: 1px solid #c4d8d0; border-radius: 5px; background: #f5faf8; color: var(--teal-dark); font-size: 11px; cursor: pointer; }
.field-pick:hover { background: #e5f1ed; }
.field-pick:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }
.field-picked { display: block; margin-top: 8px; color: var(--teal); font-size: 10px; }
.field-review-table .comparison-value, .field-review-table .comparison-value-details { font-size: 13px; line-height: 1.6; }
.field-review-table .comparison-value-details summary { font-size: 11px; }
.field-review-table .comparison-value-details[open] > summary > span { display: none; }
.field-review-table .comparison-value-details[open] > summary { justify-content: flex-end; }
.source-review-row td { background: #f4faf7; }
.source-review-row summary { color: var(--teal-dark); cursor: pointer; }
.source-excerpt { padding: 12px 0; white-space: pre-wrap; line-height: 1.8; }
.review-run-context pre { white-space: pre-wrap; font: inherit; line-height: 1.65; }
.whole-candidate-label { display: flex; align-items: center; gap: 5px; font-size: 10px; }
.whole-candidate-label select { max-width: 126px; border: 1px solid var(--line-strong); border-radius: 6px; padding: 8px; background: white; }
.review-empty { padding: 10px 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
@media (max-width: 900px) {
  .field-review-table, .field-review-table tbody, .field-review-table tr, .field-review-table td, .field-review-table th { display: block; width: auto; }
  .field-review-table thead { display: none; }
  .field-review-row th { border-top: 2px solid #e5dece; }
  .field-review-row td::before, .field-review-subfield td::before { content: attr(data-candidate-label); display: block; font-weight: 650; color: var(--teal-dark); margin-bottom: 6px; }
  .whole-candidate-label { flex-wrap: wrap; }
}

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

.evidence-item {
  padding: 10px 11px;
  border-left: 2px solid #9cbfb5;
  background: #f6faf8;
}

.evidence-anchor {
  margin-bottom: 5px;
  color: var(--teal);
  font-size: 8px;
  font-weight: 680;
}

.evidence-quote {
  margin: 0;
  color: var(--ink-soft);
  font-family: ui-serif, Georgia, "Songti SC", serif;
  font-size: 10px;
  line-height: 1.65;
}

.empty-detail {
  padding: 20px 10px;
  color: var(--ink-muted);
  font-size: 10px;
  text-align: center;
}

.modal {
  width: min(560px, calc(100vw - 32px));
  max-width: none;
  padding: 0;
  overflow: visible;
  border: 0;
  border-radius: 13px;
  background: transparent;
  box-shadow: var(--shadow-md);
}

.modal::backdrop {
  background: rgb(18 31 25 / 34%);
  backdrop-filter: blur(2px);
}

.modal-card {
  overflow: hidden;
  border: 1px solid rgb(255 255 255 / 75%);
  border-radius: 13px;
  background: var(--surface);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 17px 19px 13px;
  border-bottom: 1px solid var(--line);
}

.modal-body {
  padding: 18px 19px 20px;
}

.modal-footer {
  display: flex;
  min-height: 59px;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 11px 17px;
  border-top: 1px solid var(--line);
  background: #fafbfa;
}

.project-form-card,
.project-delete-card {
  width: min(520px, calc(100vw - 32px));
}

.text-input {
  width: 100%;
  min-height: 37px;
  padding: 8px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: white;
  font-size: 11px;
}

.field-label {
  display: flex;
  justify-content: space-between;
  margin: 0 0 6px;
}

.field-label:not(:first-child) {
  margin-top: 14px;
}

.field-label span {
  color: var(--ink-muted);
  font-size: 8px;
  font-weight: 500;
}

.project-description-input {
  min-height: 94px;
  resize: vertical;
}

.project-template-note {
  display: grid;
  gap: 4px;
  margin-top: 15px;
  padding: 11px 12px;
  border: 1px solid #cee2da;
  border-radius: 8px;
  background: #f4faf7;
}

.project-template-note strong {
  color: var(--teal-dark);
  font-size: 10px;
}

.project-template-note span,
.delete-confirm-copy {
  color: var(--ink-muted);
  font-size: 9px;
  line-height: 1.55;
}

.modal-eyebrow.danger {
  color: var(--red);
}

.notice.danger {
  border-color: #efc8c8;
  background: var(--red-soft);
  color: #7d3434;
}

.danger-button {
  border: 1px solid var(--red);
  background: var(--red);
  color: white;
}

.danger-button:hover:not(:disabled) {
  background: #8f3434;
}

.run-context { color: var(--ink-muted); font-size: 13px; line-height: 1.7; margin: 16px 0; }
.run-context a { color: var(--green); text-underline-offset: 3px; }
.run-context a:focus-visible { outline: 2px solid var(--green); outline-offset: 4px; }
.run-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-subtle);
}

.run-summary-grid > div {
  display: grid;
  gap: 4px;
  padding: 12px 13px;
  border-right: 1px solid var(--line);
}

.run-summary-grid > div:last-child {
  border-right: 0;
}

.run-summary-grid span {
  color: var(--ink-muted);
  font-size: 9px;
}

.run-summary-grid strong {
  font-size: 18px;
  font-weight: 690;
}

.workflow-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 19px 0;
}

.workflow-step {
  display: flex;
  align-items: center;
  gap: 8px;
}

.workflow-step span {
  max-width: 150px;
}

.workflow-step b {
  display: grid;
  width: 29px;
  height: 29px;
  place-items: center;
  border-radius: 8px;
  background: var(--teal-soft);
  color: var(--teal);
  font-size: 11px;
}

.workflow-step.extractor b {
  background: #eaf4f8;
  color: #257aa0;
}

.workflow-step.reviewer b {
  background: var(--indigo-soft);
  color: var(--indigo);
}

.workflow-step.human b {
  background: #f3eee3;
  color: #785a27;
}

.workflow-step span {
  color: var(--ink-soft);
  font-size: 9px;
  font-weight: 650;
}

.workflow-step small {
  color: var(--ink-muted);
  font-size: 8px;
  font-weight: 500;
}

.workflow-arrow {
  color: #a7b2ad;
}

.workflow-notice {
  margin-bottom: 10px;
  border-color: #bfd8ce;
  background: #f1f9f6;
  color: var(--teal-dark);
}

.notice.info {
  border-color: #c9dde8;
  background: var(--blue-soft);
  color: #315f7d;
}

.connection-card {
  width: 100%;
}

#connection-dialog {
  width: min(1080px, calc(100vw - 32px));
}

#connection-dialog .modal-body {
  max-height: min(690px, 72vh);
  overflow-y: auto;
}

.provider-card-list {
  display: grid;
  gap: 9px;
}

.provider-card {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
}

.provider-card-icon {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 9px;
  background: var(--teal-soft);
  color: var(--teal);
  font-weight: 750;
}


.provider-card-title {
  font-size: 11px;
  font-weight: 680;
}

.provider-card-meta {
  margin-top: 2px;
  color: var(--ink-muted);
  font-size: 9px;
}

.connection-state {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--ink-muted);
  font-size: 9px;
}

.connection-state .state-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #a3ada8;
}

.connection-state.ready {
  color: var(--green);
}

.connection-state.ready .state-dot {
  background: var(--green);
}

.connection-help {
  margin-top: 13px;
  padding: 11px 12px;
  border-radius: 8px;
  background: var(--surface-subtle);
  color: var(--ink-soft);
  font-size: 9px;
  line-height: 1.6;
}

.connection-help code {
  color: var(--teal-dark);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.connection-settings {
  display: grid;
  gap: 13px;
  margin-top: 14px;
}

.connection-mode-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 13px;
  border: 1px solid #cce0d8;
  border-radius: 9px;
  background: #f2f8f5;
}

.connection-mode-row > div {
  display: grid;
  gap: 2px;
}

.connection-mode-row strong {
  color: var(--teal-dark);
  font-size: 11px;
}

.connection-mode-row small {
  color: var(--ink-muted);
  font-size: 9px;
}

.provider-settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.model-picker select { width: 100%; text-overflow: ellipsis; }
.model-custom-field[hidden] { display: none; }
.model-capability-hint { min-height: 2.8em; }
.model-capability-warning { color: var(--amber, #986324); }
.model-test-status:not(:empty) { padding: 8px 10px; background: var(--teal-soft); border-radius: 8px; overflow-wrap: anywhere; }

.provider-settings-block {
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-subtle);
}

.provider-settings-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.provider-orb.deepseek { background: #3d70bb; margin-left: -5px; }
.provider-settings-block.deepseek .provider-settings-heading b { background: #e7effb; color: #3467b0; }
.provider-settings-block.mimo .provider-settings-heading b { background: #fceee1; color: #a75b20; }

.provider-settings-heading > div {
  display: flex;
  align-items: center;
  gap: 7px;
}

.provider-settings-heading b {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 7px;
  background: var(--teal-soft);
  color: var(--teal);
  font-size: 10px;
}

.provider-settings-block.kimi .provider-settings-heading b {
  background: var(--indigo-soft);
  color: var(--indigo);
}

.provider-settings-block.glm .provider-settings-heading b {
  background: #f1ebfa;
  color: #6b479d;
}

.provider-settings-heading strong {
  font-size: 10px;
}

.button.small {
  min-height: 27px;
  padding: 0 8px;
  font-size: 9px;
}

.compact-field {
  gap: 4px;
}

.compact-field input {
  min-height: 35px;
}

.compact-check {
  margin-top: 0;
  font-size: 9px;
}

.provider-settings-block code,
.connection-help code {
  overflow-wrap: anywhere;
}

.apply-models-row {
  margin-top: 0;
  padding: 0 2px;
}

@media (max-width: 680px) {
  .provider-settings-grid {
    grid-template-columns: 1fr;
  }
}

.modal-help {
  margin-right: auto;
  color: var(--ink-muted);
  font-size: 8px;
}

.activity-card {
  width: 100%;
  display: flex;
  flex-direction: column;
  max-height: calc(100dvh - 32px);
}

.activity-card > .modal-header,
.activity-card > .modal-footer { flex: 0 0 auto; }
.activity-content { min-height: 0; overflow-y: auto; }
.activity-content > #run-activity { padding: 0 19px; }
.activity-content > .activity-list { max-height: none; overflow: visible; }

.activity-list {
  max-height: 470px;
  overflow-y: auto;
}

.activity-item {
  display: grid;
  grid-template-columns: 9px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.activity-item:last-child {
  border-bottom: 0;
}

.activity-marker {
  width: 7px;
  height: 7px;
  margin-top: 5px;
  border-radius: 50%;
  background: var(--teal);
}

.activity-title {
  color: var(--ink);
  font-size: 10px;
  font-weight: 620;
}

.activity-detail {
  margin-top: 3px;
  color: var(--ink-muted);
  font-size: 8px;
}

.activity-time {
  color: var(--ink-muted);
  font-size: 8px;
  white-space: nowrap;
}

.busy-overlay {
  position: fixed;
  z-index: 200;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgb(19 33 27 / 26%);
  backdrop-filter: blur(2px);
}

.busy-card {
  display: grid;
  min-width: 240px;
  place-items: center;
  gap: 8px;
  padding: 22px 28px;
  border-radius: 12px;
  background: white;
  box-shadow: var(--shadow-md);
}

.busy-card strong {
  margin-top: 3px;
  font-size: 12px;
}

.busy-card span {
  color: var(--ink-muted);
  font-size: 9px;
}

.run-progress {
  position: relative;
  width: auto;
  margin: 8px 16px;
}
#drawer-progress-slot .run-progress { margin: 8px 0 0; }

.run-progress-card {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid #b9d2c8;
  border-radius: 11px;
  background: rgb(255 255 255 / 97%);
  box-shadow: none;
}

.run-progress-spinner {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 9px;
  background: var(--teal-soft);
}

.run-progress-copy {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  min-width: 0;
  gap: 3px;
}

.run-progress-summary {
  grid-column: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 3px 12px;
  min-width: 0;
}

.run-progress-summary > strong {
  color: var(--ink);
  font-size: 11px;
}

.run-progress-summary > span {
  min-width: 0;
  color: var(--ink-muted);
  font-size: 9px;
  overflow-wrap: anywhere;
}

.run-progress-copy progress { grid-column: 1; width: 100%; height: 6px; accent-color: var(--teal-dark); }
.run-progress-copy > button { grid-column: 2; grid-row: 1 / 4; align-self: center; min-height: 32px; padding: 5px 8px; font-size: 11px; }
.progress-batch { margin-bottom: 16px; }
.progress-batch > summary { padding: 10px 0; cursor: pointer; }
#activity-dialog { width: min(820px, calc(100vw - 32px)); }
#run-activity .conflict-comparison-table { min-width: 640px; font-size: 12px; }
#run-activity th:first-child { width: 70px; }
#run-activity th:last-child, #run-activity td:last-child { width: 245px; }

.run-progress-meta {
  grid-column: 1;
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--ink-muted);
  font-size: 8px;
}

.run-progress-meta > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.run-progress-meta b {
  flex: 0 0 auto;
  padding: 2px 5px;
  border-radius: 999px;
  background: var(--teal-soft);
  color: var(--teal-dark);
  font-size: 8px;
}

@media (max-width: 720px) {
  .run-progress {
    margin: 8px;
  }
  .run-progress-copy > button { grid-row: 1; }
  .run-progress-summary,
  .run-progress-copy progress { grid-column: 1 / -1; }
}

.toast-region {
  position: fixed;
  z-index: 300;
  right: 20px;
  bottom: 20px;
  display: grid;
  width: min(360px, calc(100vw - 40px));
  gap: 8px;
}

.toast {
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 11px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: white;
  box-shadow: var(--shadow-md);
  animation: toast-in 180ms ease both;
}

.toast-indicator {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--teal);
}

.toast.error .toast-indicator {
  background: var(--red);
}

.toast.warning .toast-indicator {
  background: var(--amber);
}

.toast-message {
  color: var(--ink-soft);
  font-size: 10px;
}

.toast-close {
  border: 0;
  background: none;
  color: var(--ink-muted);
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

body.density-compact {
  --row-height: 52px;
}

body.density-expanded {
  --row-height: 92px;
}

@media (max-width: 1120px) {
  :root {
    --sidebar-width: 76px;
    --drawer-width: 390px;
  }

  .sidebar {
    padding-right: 7px;
    padding-left: 7px;
  }

  .brand {
    justify-content: center;
    gap: 4px;
    padding-right: 0;
    padding-left: 0;
  }

  .brand-copy,
  .nav-item > span:not(.nav-glyph),
  .sidebar-section,
  .storage-card,
  .local-badge span:not(.local-dot) {
    display: none;
  }

  .brand-mark {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    font-size: 15px;
  }

  .sidebar-toggle {
    width: 28px;
    height: 28px;
    margin-left: 0;
  }

  .sidebar-toggle .sidebar-toggle-icon {
    width: 15px;
    height: 15px;
  }

  .nav-item {
    justify-content: center;
    padding: 0;
  }

  .nav-glyph {
    font-size: 18px;
  }

  .local-badge {
    justify-content: center;
  }

  .toolbar-secondary .button {
    display: none;
  }
}

@media (max-width: 820px) {
  :root {
    --sidebar-width: 0px;
  }

  .sidebar {
    display: none;
  }

  .sidebar-toggle,
  .sidebar-reveal {
    display: none !important;
  }

  .app-shell.drawer-open {
    grid-template-columns: 0 minmax(0, 1fr) min(430px, 85vw);
  }

  .app-shell.drawer-open.conflict-review-open,
  .app-shell.sidebar-collapsed.drawer-open.conflict-review-open {
    grid-template-columns: 0 minmax(0, 1fr) min(560px, 92vw);
  }

  .provider-status {
    min-width: auto;
  }

  .provider-status-copy,
  .chevron {
    display: none;
  }

  .toolbar-secondary {
    display: none;
  }
}
/* Screening is an independent stage, not another free-form extraction field. */
.screening-strip { display:flex; align-items:center; flex-wrap:wrap; gap:10px; padding:12px 24px; border-top:1px solid var(--line); background:#f8fbf9; font-size:13px; }
.screening-strip > strong { color:var(--teal); margin-right:4px; }
.screening-strip .button.small { font-size:12px; padding:8px 11px; }
.screening-strip select { max-width:190px; padding:8px 26px 8px 10px; border:1px solid var(--line); border-radius:8px; background:white; color:var(--ink); font:inherit; }
#screening-summary { color:var(--ink-muted); margin-left:auto; font-size:12px; }
.screening-cell { padding:14px 16px !important; cursor:pointer; vertical-align:top; }
.screening-cell:hover { background:#f2f8f5; }
.screening-cell:focus-visible { outline:2px solid var(--teal); outline-offset:-3px; }
.screening-cell small { display:block; color:var(--ink-muted); margin-top:5px; font-size:11px; }
.sr-only { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0; }
.screening-badge { display:inline-block; max-width:100%; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; vertical-align:middle; padding:4px 9px; border-radius:6px; background:#edf0ee; color:#5e6d67; font-size:12px; font-weight:650; line-height:1.4; }
.screening-badge.include { color:#176448; background:#e4f3e9; }
.screening-badge.exclude { color:#964441; background:#fbeceb; }
.screening-badge.review { color:#895c19; background:#fff2d7; }
.screening-reason { display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; color:#68766f; font-size:12px; margin-top:7px; line-height:1.6; }
.screening-note { border:1px solid #eddbb5; background:#fff8e9; padding:13px 15px; border-radius:9px; color:#80591e; font-size:13px; line-height:1.7; margin:12px 0; }
.screening-comparison-scroll { overflow:auto; border:1px solid var(--line); border-radius:10px; }
.screening-comparison { width:100%; min-width:630px; table-layout:fixed; border-collapse:collapse; font-size:13px; line-height:1.65; }
.screening-comparison th,.screening-comparison td { border:1px solid var(--line); padding:12px; vertical-align:top; text-align:left; overflow-wrap:anywhere; }
.screening-comparison thead th { background:#eff5f1; font-weight:650; }
.screening-comparison th:first-child { width:21%; }
.screening-comparison th:last-child { width:70px; }
.screening-comparison small { display:block; font-size:11px; color:#738078; font-weight:400; }
.screening-comparison tbody th { background:#fafcfb; font-weight:500; }
.screening-comparison p { margin:7px 0; }
.screening-comparison summary { color:var(--teal); cursor:pointer; font-size:12px; }
.screening-comparison blockquote { margin:10px 0; padding:0 0 0 9px; border-left:2px solid #a3c6b7; color:#53675d; white-space:pre-wrap; }
@media (max-width:900px) { .screening-strip { padding:10px 14px; gap:8px; } #screening-summary { width:100%; margin-left:0; } }

/* Background tasks stay global in navigation; workbench progress is local. */
.sidebar-running-tasks { margin-top: 18px; min-height: 0; flex-shrink: 1; }
.sidebar-running-tasks .sidebar-section-title { display: flex; align-items: center; }
#sidebar-running-list { max-height: 178px; overflow-y: auto; }
.running-project { display: flex; align-items: center; gap: 9px; width: 100%; padding: 8px 10px; border: 0; border-radius: 8px; background: transparent; color: var(--ink-soft); text-align: left; }
.running-project:hover, .running-project.is-current { background: rgb(255 255 255 / 65%); }
.running-project-indicator { flex: 0 0 auto; color: var(--teal); font-size: 19px; }
.running-project-copy { display: grid; gap: 3px; min-width: 0; }
.running-project-copy strong { overflow: hidden; font-size: 12px; font-weight: 550; text-overflow: ellipsis; white-space: nowrap; }
.running-project-copy small { color: var(--ink-muted); font-size: 11px; }
@media (max-width: 1120px) {
  .sidebar-running-tasks { display: block; }
  .sidebar-running-tasks .sidebar-section-title, .running-project-copy { display: none; }
  .running-project { justify-content: center; padding: 8px; }
}
