:root {
  --bg-root: #0a0f0c;
  --bg-panel: #111814;
  --bg-card: #16201a;
  --bg-input: #0c120e;
  --border-subtle: #28382e;
  --border-accent: #99CC00;
  --accent: #99CC00;
  --accent-hover: #b2e617;
  --text-main: #edf4ee;
  --text-muted: #98aba0;
  --danger: #ef4444;
  --warn: #f59e0b;
  --check-cyan: #38bdf8;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg-root);
  color: var(--text-main);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color-scheme: dark;
  overflow: hidden;
}

.studio-shell {
  display: grid;
  grid-template-rows: 58px 1fr;
  height: 100vh;
}

.studio-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 16px;
  background: linear-gradient(180deg, #151e18 0%, #0f1612 100%);
  border-bottom: 1px solid var(--border-subtle);
}

.brand-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-mark {
  width: 30px;
  height: 30px;
  border-radius: 7px;
  background: rgba(153, 204, 0, 0.16);
  border: 1px solid var(--accent);
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 14px;
}

.brand-title {
  font-size: 14.5px;
  font-weight: 800;
  letter-spacing: 0.01em;
}

.brand-title span {
  color: var(--accent);
}

.mode-pill {
  font-size: 10.5px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(153, 204, 0, 0.13);
  border: 1px solid rgba(153, 204, 0, 0.42);
  color: #d9f99d;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.topbar-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.crs-select, .crs-custom-input {
  height: 33px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  color: var(--text-main);
  padding: 0 10px;
  font-size: 12px;
}

.crs-select:focus, .crs-custom-input:focus {
  border-color: var(--accent);
  outline: none;
}

.btn-studio {
  height: 33px;
  padding: 0 12px;
  border-radius: 6px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  color: var(--text-main);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
  text-decoration: none;
}

.btn-studio:hover {
  border-color: var(--accent);
  color: #fff;
}

.btn-studio--accent {
  background: rgba(153, 204, 0, 0.14);
  border-color: rgba(153, 204, 0, 0.6);
  color: var(--accent);
}

.btn-studio--accent.is-active {
  background: var(--accent);
  color: #0b110d;
  font-weight: 800;
}

.btn-studio--primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #0b110d;
  font-weight: 800;
}

.btn-studio--primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: #070b08;
}

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

.studio-workspace {
  display: grid;
  grid-template-columns: 430px 1fr;
  height: calc(100vh - 58px);
  min-height: 0;
}

.left-column {
  display: grid;
  grid-template-rows: 44% 56%;
  border-right: 1px solid var(--border-subtle);
  background: var(--bg-panel);
  min-height: 0;
}

.map-pane {
  position: relative;
  border-bottom: 1px solid var(--border-subtle);
  min-height: 0;
}

#gcpMap {
  width: 100%;
  height: 100%;
  background: #0c1410;
}

.map-overlay-bar {
  position: absolute;
  top: 10px;
  left: 10px;
  right: 10px;
  z-index: 500;
  display: flex;
  justify-content: space-between;
  gap: 6px;
  pointer-events: none;
}

.map-overlay-bar > * {
  pointer-events: auto;
}

.map-search-box {
  display: flex;
  gap: 4px;
  background: rgba(11, 17, 13, 0.92);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 3px;
}

.map-search-box input {
  background: transparent;
  border: none;
  color: #fff;
  font-size: 11.5px;
  padding: 3px 7px;
  width: 155px;
}

.map-search-box input:focus {
  outline: none;
}

.gcp-list-pane {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.pane-header {
  padding: 10px 12px;
  background: #131c16;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.pane-header h2 {
  margin: 0;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
}

.gcp-table-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.gcp-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 9px 10px;
  margin-bottom: 7px;
  cursor: pointer;
  transition: border-color 0.14s ease, background 0.14s ease;
}

.gcp-card:hover {
  border-color: #4f6d59;
}

.gcp-card.is-selected {
  border-color: var(--accent);
  background: rgba(153, 204, 0, 0.09);
  box-shadow: 0 0 0 1px rgba(153, 204, 0, 0.35);
}

.gcp-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 6px;
}

.gcp-label-input {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  color: #fff;
  font-weight: 700;
  font-size: 12px;
  border-radius: 4px;
  padding: 3px 6px;
  width: 115px;
}

.gcp-role-select {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  color: #dce6dc;
  font-size: 11px;
  border-radius: 4px;
  padding: 3px 5px;
}

.obs-badge {
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
}

.obs-badge--ready {
  background: rgba(153, 204, 0, 0.2);
  color: #bef264;
  border: 1px solid var(--accent);
}

.obs-badge--warn {
  background: rgba(245, 158, 11, 0.16);
  color: #fde68a;
  border: 1px solid rgba(245, 158, 11, 0.45);
}

.gcp-coords-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 0.75fr;
  gap: 5px;
}

.gcp-coords-grid label {
  display: block;
  font-size: 9.5px;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.gcp-coords-grid input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  color: #e2ebe4;
  font-size: 11px;
  padding: 3px 5px;
}

.right-column {
  display: grid;
  grid-template-rows: 42px 1fr 136px;
  background: #090d0b;
  min-height: 0;
}

.inspector-toolbar {
  padding: 0 14px;
  background: #121a15;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 12px;
}

.canvas-stage {
  position: relative;
  overflow: hidden;
  background: radial-gradient(circle at center, #111814 0%, #070a08 100%);
  min-height: 0;
}

#imageCanvas {
  width: 100%;
  height: 100%;
  display: block;
  cursor: crosshair;
}

.loupe-box {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 156px;
  height: 156px;
  border: 2px solid var(--accent);
  border-radius: 10px;
  overflow: hidden;
  background: #050806;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.65);
  pointer-events: none;
  display: none;
}

.loupe-caption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(10, 15, 12, 0.86);
  color: #d9f99d;
  font-size: 10px;
  font-family: monospace;
  text-align: center;
  padding: 2px 4px;
}

.empty-canvas-hint {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
  color: var(--text-muted);
  pointer-events: none;
}

.photo-strip {
  background: #101713;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.photo-strip-header {
  padding: 5px 12px;
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
  border-bottom: 1px solid #1d2922;
}

.photo-strip-items {
  display: flex;
  gap: 8px;
  padding: 8px 12px;
  overflow-x: auto;
  flex: 1;
  align-items: center;
}

.photo-chip {
  flex: 0 0 auto;
  min-width: 145px;
  max-width: 185px;
  padding: 8px 10px;
  border-radius: 7px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  font-size: 11.5px;
  transition: all 0.14s ease;
}

.photo-chip:hover {
  border-color: #5b7c65;
}

.photo-chip.is-active {
  border-color: var(--accent);
  background: rgba(153, 204, 0, 0.14);
}

.photo-chip.has-obs {
  border-left: 3px solid var(--accent);
}

.photo-chip-name {
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.photo-chip-meta {
  margin-top: 3px;
  font-size: 10.5px;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
  gap: 6px;
}

.toast-banner {
  position: fixed;
  bottom: 16px;
  right: 16px;
  z-index: 2000;
  padding: 10px 16px;
  border-radius: 8px;
  background: #152419;
  border: 1px solid var(--accent);
  color: #ecfccb;
  font-size: 12.5px;
  font-weight: 600;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.55);
  display: none;
}

@media (max-width: 980px) {
  html, body {
    overflow: auto;
  }
  .studio-shell {
    height: auto;
    min-height: 100vh;
  }
  .studio-topbar {
    height: auto;
    padding: 10px 12px;
    flex-wrap: wrap;
  }
  .studio-workspace {
    grid-template-columns: 1fr;
    height: auto;
  }
  .left-column {
    grid-template-rows: 300px 340px;
  }
  .right-column {
    grid-template-rows: 42px 460px 136px;
  }
}
