/* Collector Platform warm operational theme and right-side record inspector. */
:root {
  --blue: #f97316;
  --blue2: #d95d0b;
  --amber: #f97316;
  --accent-soft: #fff3e8;
  --accent-line: #fed7b2;
  --accent-ink: #b84c08;
}

/* Let the main grid track shrink; wide tables scroll inside their own wrappers
   instead of increasing the width of the whole application shell. */
.main,
.content,
.surface,
.surface-head { min-width: 0; }

.brand-mark {
  background: linear-gradient(145deg, #fb8a32, #e45d08);
  box-shadow: 0 8px 20px rgba(249, 115, 22, .28);
}

nav button.active {
  background: #26344a;
  box-shadow: inset 3px 0 var(--blue);
}

nav button.active span { color: #ffb36f; }
.workspace-menu .add-workspace,
.link-btn,
.modal-kicker,
.login-kicker { color: var(--accent-ink); }

.login-view::before {
  background:
    radial-gradient(circle at 20% 45%, rgba(249, 115, 22, .2), transparent 27%),
    linear-gradient(120deg, transparent 49.8%, rgba(255, 255, 255, .025) 50%, transparent 50.2%);
  background-size: auto, 52px 52px;
}

.dropzone.drag { border-color: var(--blue); background: var(--accent-soft); }
input:focus,
select:focus,
textarea:focus {
  border-color: #f59a52 !important;
  box-shadow: 0 0 0 3px rgba(249, 115, 22, .12) !important;
  outline: none;
}

.record-row {
  cursor: pointer;
  transition: background-color .14s ease, box-shadow .14s ease;
}
.record-row:hover { background: #fff9f4; }
.record-row:focus-visible { outline: 2px solid #fb923c; outline-offset: -2px; }

.modal.drawer-open { place-items: stretch end; }
.modal.drawer-open .modal-backdrop {
  background: rgba(12, 20, 32, .42);
  backdrop-filter: blur(1.5px);
}
.modal-panel.drawer {
  width: min(760px, calc(100vw - 280px));
  height: 100vh;
  max-height: none;
  border-radius: 16px 0 0 16px;
  box-shadow: -24px 0 60px rgba(16, 24, 40, .2);
  animation: drawerIn .22s cubic-bezier(.2, .75, .25, 1);
}
.modal-panel.drawer > header {
  padding: 24px 30px 20px;
  background: linear-gradient(180deg, #fffaf6, #fff);
  border-bottom-color: #f2e5d9;
}
.modal-panel.drawer h2 {
  max-width: 610px;
  font-size: 23px;
  line-height: 1.35;
  letter-spacing: -.025em;
}
.modal-panel.drawer .modal-body { padding: 26px 30px 42px; }

.record-loading {
  display: grid;
  min-height: 260px;
  place-items: center;
  color: var(--muted);
}
.record-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  overflow: hidden;
  border: 1px solid #eadfd6;
  border-radius: 10px;
  background: #fffaf6;
}
.record-summary > div {
  padding: 14px 16px;
  border-right: 1px solid #efe4db;
  border-bottom: 1px solid #efe4db;
}
.record-summary > div:nth-child(2n) { border-right: 0; }
.record-summary > div:nth-last-child(-n+2) { border-bottom: 0; }
.record-summary label,
.record-summary strong { display: block; }
.record-summary label { margin-bottom: 5px; color: #8a7465; font-size: 11px; }
.record-summary strong { color: #3e3028; font-size: 13px; }

.source-jump {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
  padding: 11px 14px;
  border: 1px solid var(--accent-line);
  border-radius: 9px;
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}
.source-jump:hover { background: #ffe9d5; }

.record-section { margin-top: 28px; }
.record-section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 12px;
}
.record-section-head h3 { margin: 0; font-size: 17px; }
.record-section-head p { margin: 0; color: var(--muted); font-size: 11px; text-align: right; }
.record-data {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  overflow: hidden;
  border: 1px solid #e8e2dc;
  border-radius: 10px;
  background: #fff;
}
.record-data > .record-field {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 12px;
  min-height: 68px;
  padding: 14px 16px;
  border-right: 1px solid #eee7e1;
  border-bottom: 1px solid #eee7e1;
  align-items: start;
}
.record-data > .record-field:nth-child(2n) { border-right: 0; }
.record-data > .record-field-wide { grid-column: 1 / -1; border-right: 0; }
.record-data > .record-field > label { color: #7a6b60; font-size: 12px; }
.record-data > .record-field > label small {
  display: block;
  margin-top: 3px;
  color: #b2a69e;
  font: 10px/1.3 "Cascadia Code", Consolas, monospace;
}
.record-data .record-field-content {
  min-width: 0;
  padding: 0;
  border: 0;
  color: #2e3746;
  display: block;
  font-size: 14px;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
}
.resolved-field-value,
.unmapped-field-value,
.resolved-field-value strong,
.resolved-field-value small,
.unmapped-field-value strong,
.unmapped-field-value small { display: block; }
.resolved-field-value strong,
.unmapped-field-value strong { font-size: 14px; font-weight: 650; }
.resolved-field-value small,
.unmapped-field-value small {
  margin-top: 3px;
  color: #9a8d84;
  font: 10px/1.4 "Cascadia Code", Consolas, monospace;
}
.record-data .mapping-state {
  display: inline-flex;
  margin-bottom: 5px;
  padding: 2px 7px;
  border-radius: 999px;
  background: #fff0d9;
  color: #a85b00;
  font-size: 10px;
  font-weight: 750;
}
.value-list { display: flex; flex-wrap: wrap; gap: 6px; }
.value-chip {
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-size: 12px;
}
.empty-value { color: #a2a8b1; }
.inline-json { font-size: 11px; }
.record-link { color: var(--accent-ink); text-decoration: none; }
.record-link:hover { text-decoration: underline; }

.record-technical {
  overflow: hidden;
  margin-top: 20px;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  background: #fafbfc;
}
.record-technical > summary {
  padding: 14px 16px;
  color: #5f6977;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  user-select: none;
}
.record-technical[open] > summary { border-bottom: 1px solid #e5e7eb; }
.technical-block { padding: 16px; }
.technical-block + .technical-block { padding-top: 0; }
.technical-block h4 { margin: 0 0 8px; color: #667085; font-size: 12px; }
.record-technical .json-view { max-height: 430px; margin: 0; }
.record-technical .raw-json { max-height: 560px; }

@keyframes drawerIn {
  from { transform: translateX(36px); opacity: .72; }
  to { transform: none; opacity: 1; }
}

@media (max-width: 900px) {
  .modal-panel.drawer { width: 100vw; border-radius: 0; }
  .modal-panel.drawer .modal-body { padding: 20px; }
  .record-data { grid-template-columns: 1fr; }
  .record-data > .record-field,
  .record-data > .record-field:nth-child(2n) { border-right: 0; }
  .record-data > .record-field-wide { grid-column: auto; }
}

/* Dense operational surfaces ------------------------------------------------ */
.content { padding-top: 24px; }
.surface.flush { margin: 0; border-radius: 9px; }
.pane-pad { padding: 22px; }
.muted { color: var(--muted); font-size: 12px; }
.danger-text { color: #c24135 !important; }
.center-actions { display: flex; justify-content: center; padding: 0 24px 28px; }
.section-head.sub { margin-top: 25px; }
.section-head h3 { margin: 0; font-size: 15px; }
.subheading { margin: 23px 0 10px; font-size: 13px; color: #4b5563; }
.inline-pre { margin: 0; white-space: pre-wrap; font: 12px/1.65 "Cascadia Code", Consolas, monospace; }
.code-area { min-height: 220px !important; font: 12px/1.55 "Cascadia Code", Consolas, monospace; }
.table-wrap.short { max-height: 350px; }

/* Source drawer: wide enough for the former three-column connector studio. */
.modal-panel.drawer.source-drawer {
  width: min(1540px, calc(100vw - 272px));
  min-width: 980px;
  border-radius: 12px 0 0 12px;
}
.modal-panel.drawer.source-drawer > header { padding: 19px 28px 16px; }
.modal-panel.drawer.source-drawer .modal-body {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  padding: 0;
}
.source-tabs {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  flex: 0 0 auto;
  align-items: end;
  gap: 24px;
  width: 100%;
  height: 62px;
  padding: 0 28px;
  border-bottom: 1px solid #e4e7ec;
  background: #fff;
}
.source-tabs button {
  height: 62px;
  padding: 3px 0 0;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: #667085;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}
.source-tabs button:hover { color: #344054; }
.source-tabs button.active { color: var(--accent-ink); border-bottom-color: var(--blue); }
.source-tab-body { flex: 1 1 auto; min-width: 0; overflow: auto; background: #f7f8fa; }

/* Table actions must remain readable at operational desktop widths. */
.link-btn,
.actions button { white-space: nowrap; }

.detail-row > span,
.detail-row > a,
.detail-row > pre {
  min-width: 0;
  overflow-wrap: anywhere;
}

/* Connector contract studio. */
.connector-toolbar {
  min-height: 58px;
  padding: 10px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid #dde3ea;
  background: #fff;
}
.connector-toolbar > div:first-child { display: flex; flex-direction: column; gap: 2px; }
.connector-toolbar strong { font-size: 15px; color: #1f2e3d; }
.connector-toolbar span { font-size: 11px; color: #8491a2; }
.connector-grid {
  display: grid;
  grid-template-columns: 245px 310px minmax(520px, 1fr);
  min-height: calc(100vh - 235px);
  background: #fff;
}
.connector-versions,
.connector-methods,
.connector-editor { min-width: 0; min-height: 0; border-right: 1px solid #dde3ea; }
.connector-versions,
.connector-methods { background: #fbfcfd; overflow: auto; }
.column-title {
  position: sticky;
  top: 0;
  z-index: 2;
  min-height: 70px;
  padding: 14px 15px;
  display: flex;
  align-items: center;
  gap: 11px;
  border-bottom: 1px solid #dfe5eb;
  background: rgba(255,255,255,.96);
  backdrop-filter: blur(8px);
}
.column-title > span {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #fff0e3;
  color: #d85a09;
  font: 700 11px/1 "Cascadia Code", Consolas, monospace;
}
.column-title strong,
.column-title small { display: block; }
.column-title strong { margin-bottom: 3px; color: #27364a; font-size: 13px; }
.column-title small { color: #8a98a9; font-size: 10px; }
.connector-versions > button,
.connector-methods > button,
.mapping-sets > button {
  width: 100%;
  min-height: 66px;
  padding: 11px 14px;
  border: 0;
  border-bottom: 1px solid #e6eaf0;
  background: #fff;
  color: #304156;
  text-align: left;
  cursor: pointer;
}
.connector-versions > button:hover,
.connector-methods > button:hover,
.mapping-sets > button:hover { background: #fff8f2; }
.connector-versions > button.active,
.connector-methods > button.active,
.mapping-sets > button.active {
  box-shadow: inset 3px 0 var(--blue);
  background: #fff4ea;
}
.connector-versions > button { position: relative; }
.connector-versions > button > strong { display: inline-block; font-size: 13px; }
.connector-versions > button > .pill { float: right; }
.connector-versions > button > small { display: block; margin-top: 5px; color: #8b98a8; font-size: 10px; }
.connector-methods > button {
  display: grid;
  grid-template-columns: 28px minmax(0,1fr) auto;
  align-items: center;
  gap: 10px;
}
.connector-methods > button i {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border: 1px solid #d9e1e9;
  border-radius: 50%;
  color: #94a0ae;
  font: normal 10px/1 "Cascadia Code", Consolas, monospace;
}
.connector-methods > button.active i,
.connector-methods > button i:first-letter { border-color: #86d5ad; color: #07864e; background: #eaf9f1; }
.connector-methods > button strong,
.connector-methods > button small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.connector-methods > button strong { font-size: 12px; }
.connector-methods > button small { margin-top: 3px; color: #8996a6; font-size: 10px; }
.connector-methods > button em { color: #a36a3b; font-size: 10px; font-style: normal; }
.connector-editor { display: flex; flex-direction: column; border-right: 0; background: #fff; overflow: hidden; }
.connector-editor > header {
  flex: 0 0 auto;
  min-height: 98px;
  padding: 18px 22px 13px;
  display: flex;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid #e2e7ec;
}
.editor-kicker { color: #8b98a7; font: 700 10px/1.4 "Cascadia Code", Consolas, monospace; letter-spacing: .08em; }
.connector-editor h2 { margin: 7px 0 4px; font-size: 20px; color: #223246; }
.connector-editor header code { color: #bf550d; font-size: 11px; }
.method-spec { display: grid; grid-template-columns: 1.5fr 1fr 1fr; border-bottom: 1px solid #e2e7ec; background: #fcfcfd; }
.method-spec > div { min-height: 78px; padding: 13px 18px; border-right: 1px solid #e2e7ec; }
.method-spec > div:last-child { border: 0; }
.method-spec label { color: #758295; font-size: 10px; font-weight: 750; }
.method-spec p { margin: 6px 0 0; color: #566477; font-size: 11px; line-height: 1.55; }
.code-filebar {
  flex: 0 0 34px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 18px;
  background: #142438;
  color: #a8b9ca;
  font: 10px/1 "Cascadia Code", Consolas, monospace;
}
.code-filebar > span { width: 7px; height: 7px; border-radius: 50%; background: #45c886; }
.code-editor.studio { flex: 1 1 auto; height: auto; min-height: 410px; border: 0; border-radius: 0; background: #0e1d2e; }
.code-editor pre,
.code-editor textarea { font-size: 12px; line-height: 1.62; }
.code-editor .num { color: #efbf72; }
.connector-editor > footer { flex: 0 0 34px; padding: 10px 18px; border-top: 1px solid #dfe4e9; color: #909baa; font-size: 10px; }

/* Mapping, access, benchmark and runtime governance. */
.mapping-layout { display: grid; grid-template-columns: 245px minmax(0,1fr); min-height: calc(100vh - 176px); background: #f7f8fa; }
.mapping-sets { border-right: 1px solid #dfe4ea; background: #fff; }
.mapping-sets > button > strong,
.mapping-sets > button > small { display: block; }
.mapping-sets > button > strong { margin-bottom: 5px; font-size: 12px; }
.mapping-sets > button > small { margin-top: 5px; color: #8a97a6; font-size: 10px; }
.mapping-sets .pill { float: right; }
.dashed-action { margin: 12px !important; width: calc(100% - 24px) !important; border: 1px dashed #f0a36b !important; border-radius: 7px; color: var(--accent-ink) !important; }
.mapping-main { min-width: 0; padding: 21px; overflow: auto; }
.governance-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 18px 0;
  padding: 14px 16px;
  border: 1px solid #fed7b2;
  border-radius: 9px;
  background: #fff8f1;
}
.governance-actions > div { flex: 1; }
.governance-actions h3 { margin: 0 0 4px; font-size: 14px; }
.governance-actions p { margin: 0; color: #7e6a5e; font-size: 11px; }
.governance-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 13px; margin-top: 18px; }
.governance-grid > section { min-width: 0; padding: 15px; border: 1px solid #e0e5eb; border-radius: 9px; background: #fff; }
.governance-grid h3 { margin: 0 0 11px; font-size: 13px; }
.governance-grid h3 span { color: #9b6b4a; font-size: 11px; }
.queue-row,
.identity-row {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 55px;
  padding: 9px 0;
  border-bottom: 1px solid #edf0f3;
}
.queue-row:last-child,
.identity-row:last-child { border-bottom: 0; }
.queue-row > div,
.identity-row > div { flex: 1; min-width: 0; }
.queue-row strong,
.queue-row small,
.identity-row strong,
.identity-row small { display: block; overflow: hidden; text-overflow: ellipsis; }
.queue-row strong,
.identity-row strong { color: #344054; font-size: 12px; }
.queue-row small,
.identity-row small { margin-top: 3px; color: #8b96a5; font-size: 10px; white-space: nowrap; }
.identity-row.pane-row { padding: 11px 18px; }
.resource-summary { display: flex; gap: 7px; }
.resource-summary span { padding: 6px 9px; border-radius: 6px; background: #f2f4f7; color: #667085; font-size: 11px; }
.access-columns { display: grid; grid-template-columns: minmax(0,1.35fr) minmax(330px,.65fr); gap: 24px; margin-bottom: 22px; }
.inline-editor { margin-top: 16px; padding: 17px; border: 1px solid #f3c89f; border-radius: 9px; background: #fffaf5; }
.inline-editor.floating { position: relative; margin: 0 0 16px; box-shadow: 0 12px 35px rgba(62,39,22,.1); }
.inline-editor h3 { margin: 0 0 14px; font-size: 14px; }
.benchmark-card { display: grid; grid-template-columns: minmax(0,1fr) auto auto auto; align-items: center; gap: 12px; padding: 14px 16px; margin-bottom: 10px !important; }
.benchmark-card p { margin: 4px 0 0; color: var(--muted); font-size: 11px; }

.run-statusbar { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid #e1e6eb; background: #fffaf5; }
.run-statusbar > div:first-child { flex: 1; }
.run-detail { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 18px; padding: 18px 0; }
.run-detail > section { min-width: 0; }
.run-icon,
.stop-icon { width: 34px; min-width: 34px !important; padding: 0 !important; font-size: 14px !important; }
.run-icon { color: #0b8b50 !important; border-color: #a8ddc2 !important; background: #effaf4 !important; }
.run-icon:hover { background: #dff5e9 !important; }
.stop-icon { color: #c83232 !important; border-color: #efb3b3 !important; background: #fff2f2 !important; }
.stop-icon:hover { background: #ffe3e3 !important; }

@media (max-width: 1280px) {
  .content > .two-col { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .modal-panel.drawer.source-drawer { width: calc(100vw - 248px); }
  .connector-grid { grid-template-columns: 210px 270px minmax(480px,1fr); }
  .source-tabs { gap: 18px; }
  .source-tabs button { font-size: 13px; }
  .governance-grid { grid-template-columns: 1fr; }
}

/* Workspace-driven field order and detail presentation --------------------- */
.field-order-table tbody tr { transition: opacity .12s, background .12s; }
.field-order-table tbody tr.dragging { opacity: .42; background: var(--accent-soft); }
.drag-handle { display:inline-block; margin-right:8px; color:#9a8778; cursor:grab; font-size:17px; vertical-align:middle; }
.order-btn { width:27px; height:27px; margin-right:3px; border:1px solid #eadfd5; border-radius:6px; background:#fff; color:#8b5b38; cursor:pointer; }
.order-btn:hover:not(:disabled) { border-color:#f59a52; background:var(--accent-soft); }
.order-btn:disabled { opacity:.28; cursor:default; }
.preserve-lines { white-space:pre-wrap; overflow-wrap:anywhere; line-height:1.72; }
.provenance-list { border:1px solid #eee3da; border-radius:9px; overflow:hidden; margin:14px 0; }
.provenance-item { display:flex; align-items:center; justify-content:space-between; gap:18px; padding:13px 15px; border-bottom:1px solid #f1e8e1; }
.provenance-item:last-child { border-bottom:0; }
.provenance-item strong,.provenance-item small { display:block; }
.provenance-item small { margin-top:4px; color:var(--muted); font-size:11px; }
.provenance-item>div:last-child { display:flex; align-items:center; gap:10px; }
.provenance-item a { color:var(--accent-ink); text-decoration:none; font-size:12px; }
.code-area { min-height:150px!important; }
.form-stack label small { display:block; margin-top:4px; color:var(--muted); font-weight:400; line-height:1.5; }
.danger-text { color:var(--red)!important; }

.candidate-list{display:grid;gap:14px;padding:18px}.candidate-card{border:1px solid var(--line);border-radius:14px;padding:16px;background:linear-gradient(180deg,#fff,#fffaf5)}.candidate-pair{display:grid;grid-template-columns:minmax(0,1fr) 46px minmax(0,1fr);align-items:center;gap:12px}.candidate-pair>div{min-width:0;padding:12px 14px;border:1px solid #f0e2d4;border-radius:10px;background:#fff}.candidate-pair small,.candidate-pair strong{display:block}.candidate-pair small{font-size:11px;color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;margin-bottom:5px}.candidate-pair strong{font-size:14px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.candidate-link{width:38px;height:38px;border-radius:50%;display:grid;place-items:center;background:#fff1e3;color:var(--orange,#ea6a1b);font-size:18px;font-weight:800}.candidate-meta{display:flex;gap:8px;align-items:center;margin:12px 0 8px;font-size:11px;color:var(--muted)}.candidate-meta span{padding:3px 7px;border-radius:999px;background:#f5f1ed}.candidate-meta .candidate-score{margin-left:auto;background:#e7f7ee;color:#087a48;font-weight:750}.candidate-evidence-list{display:flex;gap:7px;flex-wrap:wrap}.candidate-evidence{display:inline-flex;gap:6px;padding:5px 8px;border:1px solid #e8e1da;border-radius:7px;background:#fff;font-size:11px;color:#5d6673}.candidate-evidence b{color:#263445}.candidate-actions{display:grid;grid-template-columns:auto auto 1fr auto auto;gap:8px;align-items:center;margin-top:14px;padding-top:12px;border-top:1px solid #eee6df}
.login-captcha{margin-top:18px;padding:16px;border:1px solid #fed7aa;border-radius:14px;background:#fffaf5;box-shadow:0 18px 50px rgba(124,45,18,.12)}
.captcha-title{display:flex;align-items:center;justify-content:space-between}.captcha-title button{border:0;background:transparent;font-size:24px;color:#9a3412;cursor:pointer}.login-captcha p{margin:4px 0 12px;color:#78716c;font-size:13px}
.captcha-canvas{position:relative;width:320px;max-width:100%;height:176px;overflow:hidden;border-radius:10px;background:#f1f5f9}.captcha-canvas>img:first-child{display:block;width:320px;height:176px;max-width:none}.captcha-tile{position:absolute;z-index:2;filter:drop-shadow(0 2px 4px rgba(15,23,42,.45));pointer-events:none}
.captcha-slider{width:100%;margin:14px 0 8px;accent-color:#f97316}.captcha-actions{display:flex;justify-content:flex-end;gap:8px}
