/* src/client/styles.css */
:root {
  --bg-canvas: #f3f5f8;
  --bg-surface: #fff;
  --bg-subtle: #f8fafc;
  --bg-hover: #f1f5f9;
  --border-subtle: #e2e8f0;
  --border-strong: #cbd5e1;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --accent: #1d4ed8;
  --accent-hover: #1e40af;
  --accent-soft: #eff6ff;
  --accent-border: #bfdbfe;
  --keep: #059669;
  --keep-soft: #ecfdf5;
  --keep-border: #a7f3d0;
  --reject: #dc2626;
  --reject-soft: #fef2f2;
  --reject-border: #fecaca;
  --warn: #b45309;
  --warn-soft: #fffbeb;
  --warn-border: #fde68a;
  --mark-bg: #fef08a;
  --mark-ink: #713f12;
  --shadow-sm: 0 1px 2px #0f172a0d;
  --shadow-md: 0 4px 12px #0f172a14;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 10px;
  --font-sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Inter", system-ui, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
}

[data-theme="dark"] {
  --bg-canvas: #0b101b;
  --bg-surface: #111827;
  --bg-subtle: #182235;
  --bg-hover: #1f2b42;
  --border-subtle: #253248;
  --border-strong: #374863;
  --text-primary: #f1f5f9;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --accent: #60a5fa;
  --accent-hover: #93c5fd;
  --accent-soft: #3b82f624;
  --accent-border: #60a5fa59;
  --keep: #34d399;
  --keep-soft: #10b98124;
  --keep-border: #34d39959;
  --reject: #f87171;
  --reject-soft: #ef444424;
  --reject-border: #f8717159;
  --warn: #fbbf24;
  --warn-soft: #f59e0b24;
  --warn-border: #fbbf2459;
  --mark-bg: #facc1547;
  --mark-ink: #fef08a;
  --shadow-sm: 0 1px 2px #00000059;
  --shadow-md: 0 6px 16px #00000073;
  --buncss-light: ;
  --buncss-dark: initial;
  color-scheme: dark;
}

*, *:before, *:after {
  box-sizing: border-box;
}

html, body, #root {
  background: var(--bg-canvas);
  color: var(--text-primary);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  height: 100%;
  margin: 0;
  padding: 0;
  font-size: 13.5px;
  line-height: 1.5;
}

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

button {
  cursor: pointer;
}

.mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.app-shell {
  display: flex;
  overflow: hidden;
  flex-direction: column;
  height: 100vh;
}

.topbar {
  display: flex;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  z-index: 20;
  flex-shrink: 0;
  justify-content: space-between;
  align-items:  center;
  gap: 12px;
  height: 52px;
  padding: 0 16px;
}

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

.brand-mark {
  display: inline-flex;
  letter-spacing: -.01em;
  white-space: nowrap;
  align-items:  center;
  gap: 8px;
  font-size: 14.5px;
  font-weight: 700;
}

.brand-badge {
  display: inline-flex;
  background: var(--accent);
  color: #fff;
  border-radius: 6px;
  justify-content: center;
  align-items:  center;
  width: 26px;
  height: 26px;
  font-size: 13px;
  font-weight: 700;
}

[data-theme="dark"] .brand-badge {
  color: #0b101b;
}

.project-pill {
  display: inline-block;
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border-radius: 999px;
  max-width: 460px;
  padding: 3px 10px;
  font-size: 12px;
  line-height: 1.4;
}

.topbar-stats {
  display: flex;
  color: var(--text-secondary);
  align-items:  center;
  gap: 14px;
  font-size: 12px;
}

.stat-item {
  display: inline-flex;
  white-space: nowrap;
  align-items:  center;
  gap: 5px;
}

.stat-value {
  color: var(--text-primary);
  font-weight: 700;
  font-family: var(--font-mono);
}

.topbar-actions {
  display: flex;
  flex-shrink: 0;
  align-items:  center;
  gap: 8px;
}

.btn {
  display: inline-flex;
  white-space: nowrap;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  color: var(--text-primary);
  white-space: nowrap;
  flex-shrink: 0;
  justify-content: center;
  align-items:  center;
  gap: 6px;
  height: 30px;
  padding: 0 11px;
  transition: background .12s, border-color .12s, color .12s;
  font-size: 12.5px;
  font-weight: 500;
}

.btn:hover:not(:disabled) {
  background: var(--bg-hover);
  border-color: var(--border-strong);
}

.btn:disabled {
  opacity: .45;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
}

[data-theme="dark"] .btn-primary {
  color: #0b101b;
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.btn-keep {
  background: var(--keep-soft);
  border-color: var(--keep-border);
  color: var(--keep);
}

.btn-keep.active {
  background: var(--keep);
  border-color: var(--keep);
  color: #fff;
}

[data-theme="dark"] .btn-keep.active {
  color: #06281c;
}

.btn-modify {
  background: var(--accent-soft);
  border-color: var(--accent-border);
  color: var(--accent);
}

.btn-modify.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

[data-theme="dark"] .btn-modify.active {
  color: #0b101b;
}

.btn-reject {
  background: var(--reject-soft);
  border-color: var(--reject-border);
  color: var(--reject);
}

.btn-reject.active {
  background: var(--reject);
  border-color: var(--reject);
  color: #fff;
}

[data-theme="dark"] .btn-reject.active {
  color: #2b0909;
}

.btn-sm {
  height: 26px;
  padding: 0 9px;
  font-size: 12px;
}

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

.dropdown-wrap {
  position: relative;
}

.dropdown-menu {
  position: absolute;
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 220px;
  padding: 5px;
  top: calc(100% + 6px);
  right: 0;
}

.dropdown-item {
  display: flex;
  text-align: left;
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  background: none;
  border: none;
  justify-content: space-between;
  align-items:  center;
  gap: 10px;
  width: 100%;
  padding: 7px 10px;
  font-size: 12.5px;
}

.dropdown-item:hover {
  background: var(--bg-hover);
}

.dropdown-ext {
  font-family: var(--font-mono);
  color: var(--text-muted);
  font-size: 11px;
}

.workbench-grid {
  display: grid;
  grid-template-columns: 296px minmax(0, 1fr) 410px;
  background: var(--border-subtle);
  flex: 1;
  gap: 1px;
  min-height: 0;
}

.pane {
  display: flex;
  background: var(--bg-canvas);
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}

.pane-white {
  background: var(--bg-surface);
}

.left-controls {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  gap: 8px;
  padding: 10px 12px;
}

.search-box {
  display: flex;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
  align-items:  center;
  gap: 6px;
  height: 30px;
  padding: 0 9px;
}

.search-box:focus-within {
  border-color: var(--accent);
  background: var(--bg-surface);
}

.search-box input {
  outline: none;
  background: none;
  border: none;
  flex: 1;
  min-width: 0;
  font-size: 12.5px;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.filter-chip {
  border: 1px solid var(--border-subtle);
  background: var(--bg-subtle);
  color: var(--text-secondary);
  display: inline-flex;
  border-radius: 999px;
  align-items:  center;
  gap: 4px;
  height: 22px;
  padding: 2px 8px;
  font-size: 11.5px;
}

.filter-chip:hover {
  border-color: var(--border-strong);
  color: var(--text-primary);
}

.filter-chip.active {
  background: var(--accent-soft);
  border-color: var(--accent-border);
  color: var(--accent);
  font-weight: 600;
}

.cell-list-scroll {
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 6px;
  min-height: 0;
  padding: 8px;
}

.cell-item {
  display: flex;
  text-align: left;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  flex-direction: column;
  gap: 5px;
  width: 100%;
  padding: 9px 10px;
  transition: border-color .12s, box-shadow .12s;
}

.cell-item:hover {
  border-color: var(--border-strong);
}

.cell-item.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
  background: var(--accent-soft);
}

.cell-item-top {
  display: flex;
  justify-content: space-between;
  align-items:  center;
  gap: 6px;
}

.cell-id-badge {
  display: inline-flex;
  font-family: var(--font-mono);
  color: var(--text-primary);
  align-items:  center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 600;
}

.focus-tag {
  background: var(--warn-soft);
  border: 1px solid var(--warn-border);
  color: var(--warn);
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 10px;
  font-weight: 600;
}

.cell-item-title {
  color: var(--text-primary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  overflow: hidden;
  -webkit-box-orient: vertical;
  font-size: 12.5px;
  font-weight: 500;
  line-height: 1.4;
}

.cell-item-meta {
  display: flex;
  color: var(--text-muted);
  justify-content: space-between;
  align-items:  center;
  gap: 6px;
  font-size: 11px;
}

.cat-pill {
  display: inline-flex;
  border: 1px solid var(--border-subtle);
  background: var(--bg-subtle);
  color: var(--text-secondary);
  border-radius: 4px;
  align-items:  center;
  padding: 1px 6px;
  font-size: 11px;
  font-weight: 500;
}

.cat-pill.special {
  background: var(--warn-soft);
  border-color: var(--warn-border);
  color: var(--warn);
}

.status-dot {
  display: inline-flex;
  align-items:  center;
  gap: 4px;
  font-size: 11px;
}

.dot {
  display: inline-block;
  border-radius: 50%;
  width: 7px;
  height: 7px;
}

.dot.unreviewed {
  background: var(--border-strong);
}

.dot.in_progress {
  background: var(--warn);
}

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

.core-header-card {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  gap: 10px;
  padding: 12px 16px;
}

.core-title-row {
  display: flex;
  justify-content: space-between;
  align-items:  flex-start;
  gap: 12px;
}

.core-row-label {
  display: inline-flex;
  font-family: var(--font-mono);
  color: var(--accent);
  align-items:  center;
  gap: 6px;
  margin-bottom: 3px;
  font-size: 12px;
  font-weight: 700;
}

.core-header-text {
  color: var(--text-primary);
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.4;
}

.category-bar {
  display: flex;
  flex-wrap: wrap;
  align-items:  center;
  gap: 6px;
}

.category-segmented {
  display: inline-flex;
  border-radius: var(--radius-md);
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  flex-wrap: wrap;
  gap: 3px;
  padding: 3px;
}

.cat-seg-btn {
  color: var(--text-secondary);
  background: none;
  border: none;
  border-radius: 5px;
  padding: 3px 9px;
  font-size: 12px;
  font-weight: 500;
}

.cat-seg-btn:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.cat-seg-btn.active {
  background: var(--bg-surface);
  color: var(--accent);
  box-shadow: var(--shadow-sm);
  font-weight: 700;
}

.cat-hint-inline {
  color: var(--text-muted);
  font-size: 11.5px;
}

.cat-suggest-chip {
  display: inline-flex;
  background: var(--warn-soft);
  border: 1px solid var(--warn-border);
  color: var(--warn);
  border-radius: 999px;
  align-items:  center;
  gap: 4px;
  padding: 3px 9px;
  font-size: 11.5px;
  font-weight: 600;
}

.cat-suggest-chip:hover {
  filter: brightness(.96);
}

.draft-preview-box {
  border-radius: var(--radius-md);
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 12px;
}

.draft-preview-box.updated {
  background: var(--keep-soft);
  border-color: var(--keep-border);
}

.draft-preview-top {
  display: flex;
  color: var(--text-secondary);
  justify-content: space-between;
  align-items:  center;
  gap: 8px;
  font-size: 11.5px;
}

.draft-textarea {
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  resize: vertical;
  outline: none;
  background: none;
  border: 1px solid #0000;
  width: 100%;
  min-height: 44px;
  padding: 4px 6px;
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.5;
}

.draft-textarea:focus {
  background: var(--bg-surface);
  border-color: var(--accent-border);
}

.draft-initial-diff {
  color: var(--text-muted);
  border-top: 1px dashed var(--border-subtle);
  padding: 4px 6px 0;
  font-size: 11.5px;
}

.bev-banner {
  border-radius: var(--radius-md);
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 9px 12px;
  font-size: 12px;
}

.clauses-toolbar {
  background: var(--bg-canvas);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  color: var(--text-secondary);
  flex-shrink: 0;
  justify-content: space-between;
  align-items:  center;
  gap: 10px;
  padding: 8px 16px;
  font-size: 12px;
}

.hotkey-legend {
  display: flex;
  flex-wrap: wrap;
  align-items:  center;
  gap: 10px;
}

.kbd {
  display: inline-flex;
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  font-family: var(--font-mono);
  color: var(--text-primary);
  border-radius: 4px;
  justify-content: center;
  align-items:  center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  font-size: 10.5px;
  font-weight: 600;
}

.clauses-scroll {
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 10px;
  min-height: 0;
  padding: 12px 16px 24px;
}

.clause-card {
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding: 11px 13px;
  transition: border-color .12s, box-shadow .12s, opacity .12s;
}

.clause-card.focused {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.clause-card.status-keep {
  border-left: 3px solid var(--keep);
}

.clause-card.status-modify {
  border-left: 3px solid var(--accent);
}

.clause-card.status-reject {
  border-left: 3px solid var(--reject);
  background: var(--bg-subtle);
}

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

.clause-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 6px;
  min-width: 0;
}

.clause-badges {
  display: flex;
  flex-wrap: wrap;
  align-items:  center;
  gap: 5px;
}

.clause-index {
  font-family: var(--font-mono);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
}

.topic-badge {
  background: var(--bg-hover);
  color: var(--text-secondary);
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 11px;
  font-weight: 600;
}

.signal-badge {
  font-family: var(--font-mono);
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  color: var(--accent);
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 10.5px;
}

.clause-text {
  color: var(--text-primary);
  font-size: 13.5px;
  line-height: 1.55;
}

.clause-card.status-reject .clause-text {
  text-decoration: line-through;
  color: var(--text-muted);
}

.clause-actions {
  display: flex;
  flex-shrink: 0;
  align-items:  center;
  gap: 6px;
}

.reason-picker {
  display: flex;
  border-top: 1px dashed var(--border-subtle);
  flex-direction: column;
  gap: 8px;
  padding-top: 8px;
}

.reason-group-block {
  display: flex;
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  flex-direction: column;
  gap: 5px;
  padding: 7px 9px;
}

.reason-group-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 6px;
  font-size: 11.5px;
}

.reason-group-title {
  color: var(--text-primary);
  font-weight: 700;
}

.reason-group-sub {
  color: var(--text-muted);
  font-size: 11px;
}

.reason-sub-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

@media (max-width: 1260px) {
  .reason-sub-grid {
    grid-template-columns: 1fr;
  }
}

.reason-btn {
  display: flex;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: var(--bg-subtle);
  text-align: left;
  color: var(--text-secondary);
  align-items:  center;
  gap: 5px;
  padding: 6px 8px;
  transition: all .1s;
  font-size: 11.5px;
}

.reason-btn:hover {
  border-color: var(--reject-border);
  color: var(--text-primary);
  background: var(--reject-soft);
}

.reason-btn.modify-opt:hover {
  border-color: var(--accent-border);
  background: var(--accent-soft);
}

.reason-btn.active {
  background: var(--reject);
  border-color: var(--reject);
  color: #fff;
  font-weight: 600;
}

.reason-btn.modify-opt.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

[data-theme="dark"] .reason-btn.active {
  color: #2b0909;
}

[data-theme="dark"] .reason-btn.modify-opt.active {
  color: #0b101b;
}

.reason-btn .kbd {
  flex-shrink: 0;
}

.reason-btn.active .kbd {
  color: inherit;
  background: #ffffff38;
  border-color: #0000;
}

.reason-code-badge {
  font-family: var(--font-mono);
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 700;
}

.optional-note-box {
  display: flex;
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  border: 1px solid var(--accent-border);
  align-items:  center;
  gap: 7px;
  padding: 5px 8px;
}

.optional-note-box.required-missing {
  border-color: var(--reject);
  background: var(--reject-soft);
}

.optional-note-tag {
  font-family: var(--font-mono);
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 4px;
  flex-shrink: 0;
  padding: 1px 6px;
  font-size: 11px;
  font-weight: 700;
}

.req-badge {
  border-radius: 4px;
  flex-shrink: 0;
  margin-left: auto;
  padding: 1px 5px;
  font-size: 10px;
  font-weight: 700;
}

.req-badge.optional {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
}

.req-badge.required {
  background: var(--warn-soft);
  border: 1px solid var(--warn-border);
  color: var(--warn);
}

.reason-btn.active .req-badge {
  color: inherit;
  background: #ffffff38;
  border-color: #0000;
}

.required-missing-hint {
  color: var(--reject);
  font-size: 11.5px;
  font-weight: 600;
}

.validation-alert-banner {
  border-radius: var(--radius-md);
  background: var(--reject-soft);
  border: 1px solid var(--reject-border);
  color: var(--reject);
  display: flex;
  justify-content: space-between;
  align-items:  center;
  gap: 10px;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 600;
}

.target-select-inline {
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg-surface);
  color: var(--text-primary);
  outline: none;
  max-width: 260px;
  height: 28px;
  padding: 0 8px;
  font-size: 12px;
}

.target-select-inline:focus {
  border-color: var(--accent);
}

.modify-editor {
  border-radius: var(--radius-sm);
  border: 1px solid var(--accent-border);
  background: var(--bg-surface);
  color: var(--text-primary);
  resize: vertical;
  outline: none;
  width: 100%;
  min-height: 54px;
  padding: 7px 9px;
  font-size: 13px;
  line-height: 1.5;
}

.modify-editor:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.supplement-composer {
  border-radius: var(--radius-md);
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 11px;
}

.clause-extras-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items:  center;
  gap: 8px;
  font-size: 11.5px;
}

.note-input-inline {
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  outline: none;
  flex: 1;
  width: 100%;
  min-width: 0;
  height: 28px;
  padding: 0 9px;
  font-size: 12px;
}

.note-input-inline:focus {
  border-color: var(--accent);
}

.bev-clause-hint {
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  font-size: 11.5px;
}

.boundary-card {
  border-radius: var(--radius-md);
  background: var(--warn-soft);
  border: 1px solid var(--warn-border);
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 2px;
  padding: 11px 13px;
}

.boundary-top {
  display: flex;
  justify-content: space-between;
  align-items:  center;
  gap: 8px;
}

.boundary-badge {
  display: inline-flex;
  color: var(--warn);
  align-items:  center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 700;
}

.boundary-question {
  color: var(--text-primary);
  font-size: 12.5px;
  font-weight: 600;
}

.boundary-options {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.boundary-opt-btn {
  display: flex;
  text-align: left;
  border-radius: var(--radius-sm);
  border: 1px solid var(--warn-border);
  background: var(--bg-surface);
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  width: 100%;
  padding: 7px 10px;
  font-size: 12px;
}

.boundary-opt-btn:hover {
  background: var(--bg-hover);
  border-color: var(--warn);
}

.boundary-opt-btn.selected {
  background: var(--accent-soft);
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.boundary-opt-effect {
  color: var(--text-muted);
  text-align: right;
  flex-shrink: 0;
  max-width: 46%;
  font-size: 11px;
}

.right-tabs {
  display: flex;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
  align-items: stretch;
  gap: 16px;
  height: 40px;
  padding: 0 12px;
}

.tab-btn {
  position: relative;
  display: inline-flex;
  color: var(--text-muted);
  background: none;
  border: none;
  align-items:  center;
  gap: 6px;
  padding: 0 2px;
  font-size: 12.5px;
  font-weight: 600;
}

.tab-btn:hover {
  color: var(--text-primary);
}

.tab-btn.active {
  color: var(--accent);
}

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

.tab-count {
  font-family: var(--font-mono);
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  border-radius: 999px;
  padding: 0 5px;
  font-size: 11px;
}

.right-scroll {
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 10px;
  min-height: 0;
  padding: 12px;
}

.source-helper-bar {
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  gap: 7px;
  padding: 9px 11px;
}

.selection-capture-box {
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  display: flex;
  justify-content: space-between;
  align-items:  center;
  gap: 8px;
  padding: 8px 10px;
}

.source-para {
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  user-select: text;
  flex-shrink: 0;
  padding: 10px 12px;
  font-size: 12.5px;
  line-height: 1.65;
}

.source-para.matched {
  border-color: var(--accent-border);
  box-shadow: 0 0 0 1px var(--accent-border);
}

.source-para-meta {
  display: flex;
  color: var(--text-muted);
  justify-content: space-between;
  align-items:  center;
  gap: 6px;
  margin-bottom: 5px;
  font-size: 11px;
}

.source-para mark {
  background: var(--mark-bg);
  color: var(--mark-ink);
  border-radius: 3px;
  padding: 0 2px;
}

.rule-bucket {
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  overflow: hidden;
  flex-shrink: 0;
}

.rule-bucket-header {
  display: flex;
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border-subtle);
  justify-content: space-between;
  align-items:  center;
  padding: 8px 11px;
  font-size: 12px;
  font-weight: 700;
}

.rule-bucket-body {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 8px 11px;
}

.rule-entry {
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 6px 8px;
  font-size: 12px;
}

.jsonl-preview {
  font-family: var(--font-mono);
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text-secondary);
  padding: 8px 10px;
  font-size: 11px;
  line-height: 1.5;
}

.toast {
  position: fixed;
  background: var(--text-primary);
  color: var(--bg-surface);
  box-shadow: var(--shadow-md);
  z-index: 100;
  display: flex;
  pointer-events: none;
  border-radius: 999px;
  align-items:  center;
  gap: 8px;
  padding: 8px 14px;
  font-size: 12.5px;
  font-weight: 500;
  top: 62px;
  right: 20px;
}

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

.toolbar-actions button, .mini-btn, .filter-chip {
  white-space: nowrap;
  flex-shrink: 0;
}

select {
  min-width: 0;
  max-width: 100%;
}
