:root {
  --bg: #f6f3ed;
  --panel: #fffaf1;
  --panel-2: #ffffff;
  --ink: #1f2a2e;
  --muted: #657075;
  --line: #ddd2bf;
  --accent: #176b5b;
  --accent-2: #e7f1ed;
  --danger: #9e2f2f;
  --warning: #9a6a15;
  --shadow: 0 14px 35px rgba(32, 42, 46, 0.12);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  color: var(--ink);
  background: radial-gradient(circle at top left, #fff8e6, transparent 28rem), var(--bg);
}

.app-header {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: center;
  padding: 22px 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 250, 241, 0.92);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.eyebrow {
  margin: 0 0 4px;
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 800;
}

h1 {
  margin: 0;
  font-size: clamp(26px, 3vw, 40px);
  line-height: 1.05;
}

.subhead {
  max-width: 780px;
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 15px;
}

.header-actions, .toolbar-right, .tool-row, .section-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.app-shell {
  display: grid;
  grid-template-columns: 310px minmax(620px, 1fr) 370px;
  gap: 18px;
  padding: 18px;
}

.panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px;
  box-shadow: 0 8px 18px rgba(32, 42, 46, 0.05);
}

.card h2 {
  margin: 0 0 12px;
  font-size: 16px;
}

.file-drop {
  display: block;
  padding: 16px;
  border: 1px dashed #b7aa94;
  border-radius: 14px;
  background: #fffdf7;
  cursor: pointer;
  margin-bottom: 12px;
}
.file-drop span { display: block; font-weight: 800; }
.file-drop small { color: var(--muted); }
.file-drop.dragover {
  border-color: var(--accent);
  background: #edf7f3;
  box-shadow: inset 0 0 0 2px rgba(23, 107, 91, .12);
}
.upload-actions { margin-bottom: 8px; }
.upload-help {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  color: #455056;
  font-weight: 700;
}

input, select, textarea {
  width: 100%;
  border: 1px solid #cfc4b2;
  border-radius: 10px;
  padding: 9px 10px;
  font: inherit;
  color: var(--ink);
  background: #fffdf9;
}

textarea { resize: vertical; }

.grid-two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 10px;
}

.inline-check {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}
.inline-check input { width: auto; }

.tool-row {
  margin-bottom: 10px;
}
.tool-row select { flex: 1; }

.btn {
  border: 1px solid #b8aa94;
  background: #fffdf7;
  color: var(--ink);
  border-radius: 999px;
  padding: 9px 13px;
  font-weight: 800;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 8px 14px rgba(32,42,46,.1); }
.btn.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--danger); border-color: #d6a5a5; }
.btn.small { padding: 6px 10px; font-size: 12px; }
.file-btn { display: inline-flex; align-items: center; justify-content: center; }

.stacked-actions {
  display: grid;
  gap: 8px;
}

.hint, .disclaimer {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.canvas-stage {
  min-width: 0;
  background: #efe8db;
  border: 1px solid var(--line);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.canvas-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: #fffaf1;
}
.canvas-toolbar span {
  margin-left: 10px;
  color: var(--muted);
  font-size: 13px;
}

.canvas-wrap {
  width: 100%;
  overflow: auto;
  padding: 14px;
}

#pitCanvas {
  display: block;
  touch-action: none;
  width: 100%;
  max-width: 1200px;
  height: auto;
  min-height: 540px;
  background: #ffffff;
  border-radius: 14px;
  border: 1px solid #d6cab7;
  cursor: grab;
}
#pitCanvas:active { cursor: grabbing; }

.hidden { display: none !important; }
.empty-state {
  padding: 18px;
  color: var(--muted);
  border-radius: 14px;
  border: 1px dashed var(--line);
  background: #fffdf7;
  font-size: 14px;
}
.inspector { display: grid; gap: 10px; }

.score-list {
  display: grid;
  gap: 10px;
  max-height: 260px;
  overflow: auto;
}
.score-item {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fffdf7;
  padding: 10px;
}
.score-item strong { display: block; font-size: 13px; margin-bottom: 8px; }
.score-row {
  display: grid;
  grid-template-columns: 84px 1fr 36px;
  align-items: center;
  gap: 8px;
  margin: 5px 0;
  font-size: 11px;
  color: #536067;
}
.meter {
  height: 7px;
  background: #ece4d8;
  border-radius: 999px;
  overflow: hidden;
}
.meter > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #b66c2d, #d8a22f, #176b5b);
  border-radius: inherit;
}

.recommendations {
  display: grid;
  gap: 10px;
  max-height: 400px;
  overflow: auto;
}
.rec {
  border-left: 4px solid var(--accent);
  background: #fffdf7;
  border-radius: 12px;
  padding: 10px 12px;
  border-top: 1px solid var(--line);
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.rec.warning { border-left-color: var(--warning); }
.rec.danger { border-left-color: var(--danger); }
.rec h3 { margin: 0 0 5px; font-size: 14px; }
.rec p { margin: 0; color: #3e4a4f; font-size: 13px; line-height: 1.45; }
.rec small { display: block; margin-top: 7px; color: var(--muted); }

.app-footer {
  padding: 14px 28px 24px;
  color: var(--muted);
  font-size: 13px;
}

@media (max-width: 1200px) {
  .app-shell { grid-template-columns: 280px 1fr; }
  .right-panel { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(3, 1fr); align-items: start; }
}

@media (max-width: 850px) {
  .app-header { align-items: flex-start; flex-direction: column; }
  .app-shell { grid-template-columns: 1fr; }
  .right-panel { display: flex; }
  .header-actions, .toolbar-right { flex-wrap: wrap; }
  .grid-two { grid-template-columns: 1fr; }
}

.grid-three {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 10px;
}

.calibration-actions {
  grid-template-columns: 1fr;
  margin-bottom: 8px;
}

.zoom-status {
  min-width: 48px;
  text-align: center;
  font-weight: 800;
  color: var(--ink) !important;
  margin-left: 0 !important;
}

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

@media (max-width: 850px) {
  .grid-three { grid-template-columns: 1fr; }
}

.scenario-card .stacked-actions {
  margin-bottom: 10px;
}

.swap-controls {
  margin-top: 6px;
}

.scenario-summary {
  margin-top: 10px;
  padding: 12px;
  font-size: 12px;
  line-height: 1.45;
}

.scenario-summary strong {
  color: var(--ink);
}

.scenario-summary .delta-good {
  color: var(--accent);
  font-weight: 900;
}

.scenario-summary .delta-bad {
  color: var(--danger);
  font-weight: 900;
}


.canvas-tip {
  display: block;
  margin: 3px 0 0 0 !important;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.25;
}

.manager-review {
  display: grid;
  gap: 10px;
  font-size: 13px;
  line-height: 1.45;
}

.review-headline {
  padding: 10px 12px;
  background: #edf7f3;
  border: 1px solid #c8ddd5;
  border-radius: 12px;
  font-weight: 800;
  color: #174e44;
}

.review-priority {
  border: 1px solid var(--line);
  border-left: 5px solid var(--accent);
  background: #fffdf7;
  border-radius: 12px;
  padding: 11px 12px;
}
.review-priority.high { border-left-color: var(--danger); }
.review-priority.medium { border-left-color: var(--warning); }
.review-priority.monitor { border-left-color: var(--accent); }
.review-priority h3 { margin: 7px 0 6px; font-size: 14px; }
.review-priority p { margin: 5px 0; color: #3e4a4f; }
.priority-pill {
  display: inline-flex;
  padding: 4px 8px;
  border-radius: 999px;
  background: #efe8db;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.review-checklist {
  background: #faf7ef;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
}
.review-checklist ul { margin: 8px 0 10px 18px; padding: 0; }
.review-checklist p { margin: 6px 0 0; color: var(--muted); }

@media (max-width: 1200px) {
  .right-panel { grid-template-columns: repeat(2, 1fr); }
}

.spacing-warnings {
  display: grid;
  gap: 9px;
  font-size: 12px;
  line-height: 1.45;
}

.spacing-warning {
  border: 1px solid var(--line);
  border-left: 5px solid var(--warning);
  background: #fffdf7;
  border-radius: 12px;
  padding: 10px 12px;
}

.spacing-warning.danger {
  border-left-color: var(--danger);
  background: #fff8f6;
}

.spacing-warning strong {
  display: block;
  margin-bottom: 4px;
  color: var(--ink);
}

.spacing-warning p {
  margin: 0;
  color: #3e4a4f;
}

#performanceImportStatus {
  border: 1px dashed var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  background: #fffdf7;
}


.rotation-pad {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 10px 0 4px;
}
.rotation-pad .btn { width: 100%; }
.toolbar-rotate {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 4px;
  flex-wrap: wrap;
}
.toolbar-rotate-label {
  color: var(--muted) !important;
  margin-left: 0 !important;
  font-size: 12px !important;
  font-weight: 700;
}
.protected-build-note { font-weight: 700; color: var(--accent); }
.demo-watermark {
  position: fixed;
  right: 14px;
  bottom: 14px;
  z-index: 9999;
  padding: 8px 12px;
  border: 1px solid rgba(31,42,46,.18);
  border-radius: 999px;
  background: rgba(255,250,241,.86);
  backdrop-filter: blur(8px);
  box-shadow: 0 8px 24px rgba(32,42,46,.14);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .02em;
  color: rgba(31,42,46,.78);
  pointer-events: none;
  user-select: none;
}
.app-footer { padding-bottom: 54px; }

.center-column {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.inspector-under-map {
  width: 100%;
}
