/* ═══════════════════════════════════════════════════
   GeoCAD Bridge — Traverse Adjustment
   Professional dark-panel layout
   ═══════════════════════════════════════════════════ */

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

:root {
  --bg:        #0d1b26;
  --surface:   #132032;
  --surface2:  #1a2d42;
  --border:    #1e3a52;
  --border2:   #254d6a;
  --accent:    #00b8c8;
  --accent2:   #00d4a0;
  --warn:      #f59e0b;
  --danger:    #ef4444;
  --pass:      #22c55e;
  --text:      #e2f0f5;
  --text2:     #8ab0c0;
  --text3:     #546e7a;
  --font:      "Segoe UI", Inter, Arial, sans-serif;
  --radius:    8px;
  --radius-lg: 12px;
  --shadow:    0 4px 20px rgba(0,0,0,.35);
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  line-height: 1.4;
  overflow: hidden;
}

/* ── APP BAR ── */
.trv-appbar {
  display: flex;
  align-items: center;
  gap: 16px;
  height: 54px;
  padding: 0 16px;
  background: #091523;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.trv-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--text);
  flex-shrink: 0;
}
.trv-brand-img {
  width: 34px;
  height: 28px;
  object-fit: contain;
}
.trv-brand-name {
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  color: var(--text);
}
.trv-brand-name b { color: var(--accent); }

.trv-appbar-title {
  flex: 1;
  border-left: 1px solid var(--border);
  padding-left: 16px;
  margin-left: 4px;
}
.trv-appbar-title h1 {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  line-height: 1.2;
}
.trv-appbar-title p {
  font-size: 11px;
  color: var(--text2);
  margin-top: 1px;
}

.trv-appbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}
.trv-project-select {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  padding: 5px 10px;
  cursor: pointer;
}
.trv-project-select select {
  background: transparent;
  border: none;
  color: var(--text);
  font: inherit;
  cursor: pointer;
  outline: none;
  max-width: 180px;
}
.trv-project-icon { font-size: 14px; }

.trv-icon-btn {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text2);
  text-decoration: none;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  transition: border-color .15s, color .15s;
}
.trv-icon-btn svg { width: 16px; height: 16px; }
.trv-icon-btn:hover { border-color: var(--accent); color: var(--accent); }

/* ── STEPS BAR ── */
.trv-steps {
  display: flex;
  align-items: center;
  height: 52px;
  padding: 0 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  gap: 0;
  flex-shrink: 0;
  overflow-x: auto;
}

.trv-step {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 14px;
  border: none;
  background: transparent;
  color: var(--text3);
  cursor: pointer;
  font: inherit;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  transition: color .15s, border-color .15s;
  flex-shrink: 0;
}
.trv-step:hover { color: var(--text2); }
.trv-step.active { color: var(--accent); border-bottom-color: var(--accent); }

.trv-step-num {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid currentColor;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}
.trv-step.active .trv-step-num {
  background: var(--accent);
  border-color: var(--accent);
  color: #041316;
}
.trv-step-body b { display: block; font-size: 12px; font-weight: 700; }
.trv-step-body small { font-size: 10px; color: var(--text3); }
.trv-step.active .trv-step-body small { color: var(--text2); }

.trv-step-divider {
  width: 40px;
  height: 1px;
  background: var(--border2);
  flex-shrink: 0;
}

/* ── WORKSPACE GRID ── */
.trv-workspace {
  display: grid;
  grid-template-columns: 280px 1fr 300px;
  height: calc(100vh - 54px - 52px - 52px); /* appbar + steps + action bar */
  overflow: hidden;
}

/* ── LEFT PANEL ── */
.trv-left-panel {
  background: var(--surface);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.trv-panel-head {
  padding: 10px 14px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text2);
  border-bottom: 1px solid var(--border);
  background: var(--surface2);
  flex-shrink: 0;
}

.trv-setup-form {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}

.trv-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.trv-field > span, .trv-field > label > span {
  font-size: 11px;
  font-weight: 600;
  color: var(--text2);
}
.trv-field input, .trv-field textarea, .trv-field select, .trv-select {
  background: var(--bg);
  border: 1px solid var(--border2);
  border-radius: 6px;
  padding: 7px 9px;
  color: var(--text);
  font: inherit;
  font-size: 12px;
  width: 100%;
  transition: border-color .15s;
}
.trv-field input:focus, .trv-field textarea:focus, .trv-field select:focus {
  outline: none;
  border-color: var(--accent);
}
.trv-field textarea { resize: vertical; min-height: 80px; font-family: ui-monospace, Consolas, monospace; font-size: 11px; }

/* Toggle group (radio buttons styled as pills) */
.trv-toggle-group {
  display: flex;
  gap: 0;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--border2);
}
.trv-toggle-group label {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.trv-toggle-group input[type="radio"] { display: none; }
.trv-toggle-group span {
  display: block;
  width: 100%;
  text-align: center;
  padding: 6px 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text2);
  background: var(--bg);
  border-right: 1px solid var(--border2);
  transition: background .12s, color .12s;
}
.trv-toggle-group label:last-child span { border-right: none; }
.trv-toggle-group input:checked + span {
  background: var(--accent);
  color: #041316;
}

.trv-hidden-select { display: none; }

.trv-section-head {
  font-size: 11px;
  font-weight: 700;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: .06em;
  padding-top: 4px;
  border-top: 1px solid var(--border);
}

.trv-controls-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.trv-sm input, .trv-sm select { font-size: 11px; padding: 5px 7px; }
.trv-sm > span { font-size: 10px; }

.trv-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.trv-link-section { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }

.trv-message { padding: 8px 10px; border-radius: 6px; font-size: 11px; line-height: 1.5; }
.trv-error { background: rgba(239,68,68,.12); border: 1px solid rgba(239,68,68,.3); color: #fca5a5; }

/* ── CENTER PANEL ── */
.trv-center-panel {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
}

.trv-map-toolbar {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.trv-map-toolbar-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text2);
  padding-right: 8px;
  border-right: 1px solid var(--border2);
  margin-right: 4px;
  white-space: nowrap;
}
.trv-tool-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--text2);
  font: inherit;
  font-size: 11px;
  cursor: pointer;
  transition: background .12s, border-color .12s, color .12s;
}
.trv-tool-btn svg { width: 13px; height: 13px; flex-shrink: 0; }
.trv-tool-btn:hover { background: var(--surface); color: var(--text); border-color: var(--border2); }
.trv-tool-btn.active { background: rgba(0,184,200,.12); border-color: var(--accent); color: var(--accent); }
.trv-tool-sep { width: 1px; height: 22px; background: var(--border2); margin: 0 4px; }
.trv-north-badge {
  margin-left: auto;
  font-size: 11px;
  font-weight: 700;
  color: var(--text2);
  border: 1px solid var(--border2);
  border-radius: 4px;
  padding: 3px 7px;
}

/* MAP WRAP */
.trv-map-wrap {
  flex: 1;
  position: relative;
  background: #081420;
  overflow: hidden;
  min-height: 220px;
}
.trv-plot-svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* SVG plot element styles (used by traverse-tool.js) */
.plot-grid { stroke: rgba(0,184,200,.08); stroke-width: 1; }
.plot-line-raw { fill: none; stroke: #5bafd6; stroke-width: 1.8; stroke-dasharray: 6,4; }
.plot-line-adjusted { fill: none; stroke: #00d4a0; stroke-width: 2.2; }
.plot-point { fill: #fff; stroke: #00b8c8; stroke-width: 2; r: 5; }
.plot-start { fill: #00d4a0; stroke: #00d4a0; }
.plot-label { fill: #e2f0f5; font-size: 11px; font-family: "Segoe UI", Inter, Arial, sans-serif; }
.plot-axis-label { fill: var(--text2); font-size: 10px; font-family: "Segoe UI", Inter, Arial, sans-serif; }
.plot-legend { fill: var(--text2); font-size: 10px; font-family: "Segoe UI", Inter, Arial, sans-serif; }

/* Map legend */
.trv-map-legend {
  position: absolute;
  bottom: 12px;
  right: 12px;
  background: rgba(9,21,35,.88);
  border: 1px solid var(--border2);
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.trv-legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--text2);
}
.trv-legend-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.trv-dot-known { background: #00d4a0; }
.trv-dot-station { background: #fff; border: 2px solid #00b8c8; }
.trv-legend-line {
  width: 24px; height: 2px; flex-shrink: 0;
}
.trv-line-adjusted { background: #00d4a0; }
.trv-line-raw { background: #5bafd6; border-top: 2px dashed #5bafd6; height: 0; }

/* ── RESULT AREA (tabs + table) ── */
.trv-result-area {
  flex-shrink: 0;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  max-height: 42%;
  background: var(--surface);
}

.trv-tabs {
  display: flex;
  gap: 0;
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  flex-shrink: 0;
}
.trv-tab {
  padding: 8px 14px;
  border: none;
  background: transparent;
  color: var(--text3);
  cursor: pointer;
  font: inherit;
  font-size: 11px;
  font-weight: 600;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  transition: color .12s, border-color .12s;
  flex-shrink: 0;
}
.trv-tab:hover { color: var(--text); }
.trv-tab.active { color: var(--accent); border-bottom-color: var(--accent); }

.trv-tab-panel { display: none; overflow: auto; flex: 1; }
.trv-tab-panel.active { display: flex; flex-direction: column; }

.trv-obs-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.trv-obs-upload-label {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border: 1px solid var(--border2);
  border-radius: 6px;
  cursor: pointer;
  color: var(--text2);
  font-size: 11px;
  font-weight: 600;
  transition: border-color .12s, color .12s;
}
.trv-obs-upload-label svg { width: 13px; height: 13px; }
.trv-obs-upload-label:hover { border-color: var(--accent); color: var(--accent); }
.trv-obs-upload-label input { display: none; }

.trv-outline-btn {
  padding: 5px 12px;
  border: 1px solid var(--border2);
  border-radius: 6px;
  background: transparent;
  color: var(--text2);
  font: inherit;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color .12s, color .12s;
}
.trv-outline-btn:hover { border-color: var(--accent); color: var(--accent); }

.trv-table-container { overflow: auto; flex: 1; }
.trv-table { border-collapse: collapse; width: 100%; font-size: 11px; font-variant-numeric: tabular-nums; }
.trv-table th {
  background: var(--surface2);
  border: 1px solid var(--border);
  padding: 6px 10px;
  text-align: left;
  color: var(--text2);
  font-weight: 700;
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 1;
}
.trv-table td {
  border: 1px solid var(--border);
  padding: 5px 10px;
  color: var(--text);
  white-space: nowrap;
}
.trv-table tr:hover td { background: rgba(0,184,200,.05); }

.trv-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 8px;
  padding: 12px;
}
.trv-summary-grid > div {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.trv-summary-grid > div span { font-size: 10px; color: var(--text2); text-transform: uppercase; letter-spacing: .05em; }
.trv-summary-grid > div strong { font-size: 14px; color: var(--accent); font-variant-numeric: tabular-nums; }

.trv-empty-note { padding: 20px; color: var(--text3); font-size: 12px; text-align: center; }

/* ── RIGHT PANEL ── */
.trv-right-panel {
  background: var(--surface);
  border-left: 1px solid var(--border);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.trv-accuracy-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text2);
  border-bottom: 1px solid var(--border);
  background: var(--surface2);
  flex-shrink: 0;
}

.trv-status-badge {
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
  background: var(--surface2);
  color: var(--text3);
  border: 1px solid var(--border2);
}
.trv-status-badge[data-status="PASS"] { background: rgba(34,197,94,.15); color: #4ade80; border-color: #22c55e; }
.trv-status-badge[data-status="FAIL"] { background: rgba(239,68,68,.15); color: #f87171; border-color: #ef4444; }
.trv-status-badge[data-status="REVIEW"] { background: rgba(245,158,11,.12); color: #fbbf24; border-color: #f59e0b; }
.trv-status-badge[data-status="UNCONTROLLED"] { background: rgba(100,116,139,.15); color: var(--text2); border-color: var(--border2); }

.trv-accuracy-body {
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
/* closure-analysis children injected by JS as div > span + strong */
#closure-analysis > div {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 6px;
  padding: 5px 0;
  border-bottom: 1px solid var(--border);
  font-size: 11px;
}
#closure-analysis > div:last-child { border-bottom: none; }
#closure-analysis > div span { color: var(--text2); }
#closure-analysis > div strong { color: var(--text); font-variant-numeric: tabular-nums; text-align: right; }

.trv-mt { margin-top: 4px; }

.trv-chart-legend {
  display: flex;
  gap: 14px;
  padding: 6px 14px 2px;
  font-size: 10px;
  color: var(--text2);
}
.trv-chart-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  margin-right: 4px;
}

.trv-chart-wrap {
  padding: 4px 10px 10px;
}
.trv-correction-chart {
  width: 100%;
  height: auto;
  display: block;
}
.chart-axis { stroke: var(--border2); stroke-width: 1; }
.chart-e { fill: #3b82f6; opacity: .85; }
.chart-n { fill: #60d89e; opacity: .85; }
.chart-empty { fill: var(--text3); font-size: 10px; text-anchor: middle; font-family: "Segoe UI", Inter, Arial, sans-serif; }

/* correction-chart text labels from JS */
#correction-chart text:not(.chart-empty) {
  fill: var(--text2);
  font-size: 9px;
  text-anchor: middle;
  font-family: "Segoe UI", Inter, Arial, sans-serif;
}

.trv-corrections-grid {
  padding: 8px 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.trv-corr-row {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  padding: 5px 0;
  border-bottom: 1px solid var(--border);
}
.trv-corr-row span { color: var(--text2); }
.trv-corr-row strong { color: var(--accent); font-variant-numeric: tabular-nums; }

/* ── BOTTOM ACTION BAR ── */
.trv-action-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  height: 52px;
  padding: 0 14px;
  background: var(--surface2);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.trv-action-left, .trv-action-right {
  display: flex;
  align-items: center;
  gap: 6px;
}

.trv-action-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 7px;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background .12s, border-color .12s, color .12s, opacity .12s;
}
.trv-action-btn svg { width: 14px; height: 14px; flex-shrink: 0; }
.trv-action-btn:disabled { opacity: .4; cursor: not-allowed; }

.trv-outline {
  background: transparent;
  border: 1px solid var(--border2);
  color: var(--text2);
}
.trv-outline:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); background: rgba(0,184,200,.06); }

.trv-primary {
  background: var(--accent);
  border: 1px solid var(--accent);
  color: #041316;
  font-weight: 800;
  font-size: 13px;
  padding: 6px 20px;
}
.trv-primary:hover { background: #00cfe0; border-color: #00cfe0; }

/* ── SCROLLBARS ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text3); }

/* ── RESPONSIVE ── */
@media (max-width: 1000px) {
  .trv-workspace { grid-template-columns: 240px 1fr 260px; }
}
@media (max-width: 800px) {
  html, body { overflow: auto; }
  .trv-workspace {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
    height: auto;
    overflow: visible;
  }
  .trv-right-panel { border-left: none; border-top: 1px solid var(--border); }
  .trv-map-wrap { min-height: 280px; }
}

/* 2026-10-02 Traverse interaction update: keep map tools clickable and plot fitted */
.trv-map-toolbar,
.trv-tool-btn,
.trv-tabs,
.trv-tab {
  pointer-events: auto;
  position: relative;
  z-index: 1000;
}
.trv-map-toolbar {
  overflow-x: auto;
  overflow-y: hidden;
}
.trv-tool-btn,
.trv-tab {
  white-space: nowrap;
}
.trv-tool-btn.off,
.trv-tab[disabled] {
  opacity: 0.55;
}
.trv-map-wrap {
  min-height: 360px;
  height: auto;
  margin: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
#traverse-plot,
.trv-plot-svg {
  width: 100%;
  height: 360px;
  min-height: 360px;
  display: block;
  pointer-events: none;
  flex-shrink: 0;
}
@media (max-width: 900px) {
  .trv-map-wrap { min-height: 300px; }
  #traverse-plot,
  .trv-plot-svg { height: 300px; min-height: 300px; }
}

.trv-disabled-option{opacity:.45;cursor:not-allowed;filter:saturate(.35)} .trv-disabled-option input{cursor:not-allowed} .trv-disabled-option span{cursor:not-allowed}

