:root {
  --bg: #0a1822;
  --bg-grid: rgba(120, 174, 210, 0.08);
  --panel: rgba(10, 27, 40, 0.84);
  --panel-strong: rgba(7, 19, 28, 0.94);
  --panel-border: rgba(115, 174, 210, 0.2);
  --panel-highlight: rgba(182, 225, 255, 0.08);
  --text: #edf7ff;
  --muted: #90aabd;
  --accent: #4ab4d9;
  --accent-strong: #7fd8ff;
  --accent-soft: rgba(74, 180, 217, 0.14);
  --warm: #ffb347;
  --success: #70d38b;
  --danger: #f06e62;
  --shadow: 0 28px 70px rgba(0, 0, 0, 0.42);
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Space Grotesk", sans-serif;
  color: var(--text);
  background:
    linear-gradient(rgba(120, 174, 210, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(120, 174, 210, 0.07) 1px, transparent 1px),
    radial-gradient(circle at top left, rgba(74, 180, 217, 0.2), transparent 26%),
    radial-gradient(circle at bottom right, rgba(255, 179, 71, 0.16), transparent 24%),
    linear-gradient(180deg, #09141d 0%, #0f2432 45%, #122b3c 100%);
  background-size: 34px 34px, 34px 34px, auto, auto, auto;
  overflow: hidden;
}

button,
input,
select {
  font: inherit;
}

.app-shell {
  width: calc(100% - 32px);
  max-width: none;
  margin: 0 auto;
  padding: 24px 0 32px;
  min-height: 100vh;
  height: 100vh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 18px;
}

.topbar,
.panel,
.part-card,
.droid-card,
.option-card {
  backdrop-filter: blur(18px) saturate(130%);
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-start;
  padding: 16px 22px;
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(180deg, rgba(18, 45, 63, 0.94), rgba(9, 24, 36, 0.92)),
    var(--panel);
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.topbar::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, transparent, rgba(127, 216, 255, 0.08), transparent);
  pointer-events: none;
}

.topbar h1,
.section-heading h2 {
  margin: 0;
}

.eyebrow {
  margin: 0 0 2px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.66rem;
  color: var(--accent-strong);
}

.eyebrow a {
  color: #ffffff;
}

.auth-panel {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  align-items: center;
}

.auth-status {
  color: var(--muted);
  font-size: 0.86rem;
}

.layout {
  display: grid;
  grid-template-columns: minmax(280px, 320px) max-content minmax(0, 1fr);
  gap: 18px;
  width: 100%;
  height: 100%;
  min-height: 0;
  align-items: stretch;
}

.panel {
  background:
    linear-gradient(180deg, rgba(18, 36, 50, 0.92), rgba(7, 19, 29, 0.9)),
    var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 24px;
  height: 100%;
  min-height: 0;
  min-width: 0;
}

.sidebar,
.visual-panel,
.detail-panel {
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100%;
  min-height: 0;
}

.visual-panel {
  width: fit-content;
  max-width: min(100%, 620px);
  justify-self: start;
  align-self: stretch;
}

.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.section-hint,
.progress-pill {
  font-size: 0.9rem;
  color: var(--muted);
}

.progress-pill {
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 999px;
  border: 1px solid rgba(127, 216, 255, 0.18);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.02);
}

.primary-button,
.ghost-button,
.pill-button {
  border-radius: 999px;
  padding: 12px 16px;
  cursor: pointer;
  transition: transform 140ms ease, background 140ms ease, color 140ms ease, border-color 140ms ease;
  border: 1px solid transparent;
}

.primary-button {
  background: linear-gradient(180deg, #58c6eb 0%, #2d94bf 100%);
  color: #03131d;
  border-color: rgba(173, 232, 255, 0.28);
  font-weight: 700;
}

.primary-button:hover,
.ghost-button:hover,
.pill-button:hover {
  transform: translateY(-1px);
}

.ghost-button {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  border: 1px solid rgba(127, 216, 255, 0.16);
}

.pill-button {
  background: rgba(74, 180, 217, 0.12);
  color: var(--accent-strong);
  border-color: rgba(74, 180, 217, 0.28);
}

.hidden {
  display: none !important;
}

.new-droid-form {
  display: grid;
  gap: 14px;
  margin-bottom: 18px;
  padding: 18px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(127, 216, 255, 0.14);
}

.new-droid-form label,
.option-group label {
  display: grid;
  gap: 6px;
  font-size: 0.95rem;
  color: var(--muted);
}

input,
select {
  width: 100%;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(127, 216, 255, 0.18);
  padding: 12px 14px;
  background: rgba(5, 19, 28, 0.82);
  color: var(--text);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.droid-list,
.parts-panel,
.section-options {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.droid-card,
.part-card,
.option-card,
.category-block {
  border: 1px solid rgba(127, 216, 255, 0.12);
  border-radius: var(--radius-md);
  background:
    linear-gradient(180deg, rgba(22, 44, 61, 0.82), rgba(11, 24, 35, 0.86));
}

.droid-card {
  padding: 16px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.droid-card.active {
  border-color: rgba(127, 216, 255, 0.4);
  box-shadow:
    inset 0 0 0 1px rgba(127, 216, 255, 0.22),
    0 0 0 1px rgba(74, 180, 217, 0.12);
}

.droid-card.active::before,
.part-card::before,
.option-card::before,
.category-block::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: linear-gradient(180deg, var(--accent-strong), rgba(255, 179, 71, 0.9));
  opacity: 0.9;
}

.droid-card header,
.part-card header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.droid-card h3,
.part-card h4,
.category-block h3 {
  margin: 0;
}

.meta {
  font-family: "IBM Plex Mono", monospace;
  color: var(--muted);
  font-size: 0.82rem;
}

.droid-card footer {
  margin-top: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.status-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  display: inline-block;
  background: rgba(127, 216, 255, 0.22);
}

.status-dot.complete {
  background: var(--success);
}

.droid-canvas {
  min-height: 0;
  display: grid;
  place-items: center;
  border-radius: 24px;
  background:
    linear-gradient(rgba(120, 174, 210, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(120, 174, 210, 0.08) 1px, transparent 1px),
    radial-gradient(circle at 50% 10%, rgba(127, 216, 255, 0.08), transparent 32%),
    linear-gradient(180deg, rgba(10, 30, 44, 0.96), rgba(7, 18, 28, 0.94));
  background-size: 30px 30px, 30px 30px, auto, auto;
  border: 1px solid rgba(127, 216, 255, 0.16);
  padding: 20px;
  width: fit-content;
  max-width: 100%;
  flex: 1;
  align-self: center;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.02);
}

.empty-state {
  color: var(--muted);
  text-align: center;
}

.section-progress-board {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  width: 100%;
  margin-bottom: 14px;
}

.section-progress-card {
  position: relative;
  padding: 12px 14px 14px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(127, 216, 255, 0.14);
  background: linear-gradient(180deg, rgba(16, 38, 53, 0.9), rgba(8, 21, 31, 0.92));
  overflow: hidden;
}

.section-progress-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent-strong), transparent);
  opacity: 0.8;
}

.section-progress-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 8px;
}

.section-progress-name,
.section-progress-percent,
.section-progress-meta {
  font-family: "IBM Plex Mono", monospace;
}

.section-progress-name {
  color: var(--text);
  font-size: 0.84rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.section-progress-percent {
  color: var(--accent-strong);
  font-size: 0.9rem;
}

.section-progress-meter {
  position: relative;
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(127, 216, 255, 0.08) 0 25%, transparent 25% 30%, rgba(127, 216, 255, 0.08) 30% 55%, transparent 55% 60%, rgba(127, 216, 255, 0.08) 60% 100%),
    rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(127, 216, 255, 0.1);
}

.section-progress-fill {
  position: absolute;
  inset: 0 auto 0 0;
  min-width: 10px;
  border-radius: inherit;
  background:
    repeating-linear-gradient(
      135deg,
      rgba(255, 255, 255, 0.18) 0 8px,
      rgba(255, 255, 255, 0.04) 8px 16px
    ),
    linear-gradient(90deg, #2f89b4 0%, #62d8ff 72%, #ffb347 100%);
  box-shadow: 0 0 16px rgba(98, 216, 255, 0.28);
}

.section-progress-meta {
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.droid-image-frame {
  position: relative;
  display: grid;
  place-items: center;
  padding: 44px 36px 34px;
  border-radius: 26px;
  background:
    linear-gradient(180deg, rgba(11, 29, 41, 0.78), rgba(5, 16, 24, 0.86));
  border: 1px solid rgba(127, 216, 255, 0.16);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.02),
    0 18px 40px rgba(0, 0, 0, 0.24);
}

.droid-image-frame::before {
  content: "";
  position: absolute;
  inset: 14px;
  border: 1px dashed rgba(127, 216, 255, 0.16);
  border-radius: 20px;
  pointer-events: none;
}

.image-axis {
  position: absolute;
  display: flex;
  gap: 16px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.66rem;
  letter-spacing: 0.14em;
  color: rgba(144, 170, 189, 0.82);
  text-transform: uppercase;
  pointer-events: none;
}

.axis-top {
  top: 14px;
  left: 68px;
  right: 68px;
  justify-content: space-between;
}

.axis-left {
  top: 62px;
  bottom: 54px;
  left: 14px;
  flex-direction: column;
  justify-content: space-between;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
}

.frame-chip {
  position: absolute;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid rgba(127, 216, 255, 0.18);
  background: rgba(4, 16, 24, 0.78);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.62rem;
  letter-spacing: 0.12em;
  color: var(--accent-strong);
  text-transform: uppercase;
  pointer-events: none;
}

.chip-top-left {
  top: 10px;
  left: 14px;
}

.chip-top-right {
  top: 10px;
  right: 14px;
}

.chip-bottom-left {
  bottom: 10px;
  left: 14px;
}

.chip-bottom-right {
  bottom: 10px;
  right: 14px;
}

.droid-image-map {
  position: relative;
  width: min(100%, 540px);
  aspect-ratio: var(--image-aspect);
  max-width: 100%;
  border-radius: 28px;
  overflow: hidden;
}

.droid-photo {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  border-radius: 28px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.34);
  border: 1px solid rgba(127, 216, 255, 0.08);
}

.scan-overlay,
.reticle {
  position: absolute;
  pointer-events: none;
}

.scan-overlay {
  inset: 0;
  background:
    linear-gradient(180deg, transparent 0%, rgba(127, 216, 255, 0.05) 48%, transparent 100%),
    repeating-linear-gradient(
      180deg,
      rgba(255, 255, 255, 0.02) 0,
      rgba(255, 255, 255, 0.02) 1px,
      transparent 1px,
      transparent 8px
    );
  mix-blend-mode: screen;
  opacity: 0.55;
  animation: scanDrift 9s linear infinite;
  z-index: 1;
}

.reticle {
  width: 84px;
  height: 84px;
  border: 1px solid rgba(127, 216, 255, 0.16);
  border-radius: 50%;
  z-index: 1;
}

.reticle::before,
.reticle::after {
  content: "";
  position: absolute;
  background: rgba(127, 216, 255, 0.24);
}

.reticle::before {
  top: 50%;
  left: 12px;
  right: 12px;
  height: 1px;
  transform: translateY(-50%);
}

.reticle::after {
  left: 50%;
  top: 12px;
  bottom: 12px;
  width: 1px;
  transform: translateX(-50%);
}

.reticle-a {
  top: 12%;
  right: 8%;
}

.reticle-b {
  bottom: 11%;
  left: 7%;
  width: 62px;
  height: 62px;
}

.droid-hotspots {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
}

.droid-hotspot {
  cursor: pointer;
  outline: none;
}

.hotspot-shape {
  transition: fill 140ms ease, stroke 140ms ease, opacity 140ms ease;
}

.hotspot-shape {
  fill: rgba(74, 180, 217, 0);
  stroke: rgba(127, 216, 255, 0.62);
  stroke-width: 4;
}

.droid-hotspot:hover .hotspot-shape,
.droid-hotspot.is-active .hotspot-shape,
.droid-hotspot:focus-visible .hotspot-shape {
  fill: rgba(255, 179, 71, 0);
  stroke: rgba(255, 179, 71, 0.98);
}

.option-card,
.category-block {
  padding: 16px;
  min-width: 0;
  position: relative;
}

.category-block {
  display: grid;
  gap: 12px;
  overflow: hidden;
}

.part-card {
  padding: 16px;
  display: grid;
  gap: 12px;
  min-width: 0;
  position: relative;
}

.part-notes,
.part-files {
  color: var(--muted);
  font-size: 0.92rem;
}

.part-files code {
  display: inline-block;
  margin-right: 6px;
  margin-bottom: 6px;
  padding: 5px 8px;
  border-radius: 999px;
  background: rgba(74, 180, 217, 0.12);
  border: 1px solid rgba(127, 216, 255, 0.14);
  max-width: 100%;
  overflow-wrap: anywhere;
}

.checkbox-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  font-size: 0.95rem;
  min-width: 0;
}

.checkbox-row input {
  width: 18px;
  height: 18px;
}

.multi-checkboxes {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
}

.detail-panel {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.detail-panel .section-heading,
.detail-panel .section-options,
.detail-scroll {
  min-height: 0;
}

.detail-panel .section-heading {
  margin-bottom: 16px;
  flex: 0 0 auto;
}

.detail-scroll {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding-right: 6px;
}

.detail-panel .section-options {
  flex: 0 0 auto;
  margin-bottom: 12px;
}

.parts-panel {
  flex: 0 0 auto;
  min-height: 0;
  overflow: visible;
  align-content: start;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  border-radius: 999px;
  font-size: 0.82rem;
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
  border: 1px solid rgba(127, 216, 255, 0.14);
}

.badge.complete {
  color: var(--success);
}

@keyframes scanDrift {
  0% {
    transform: translateY(-12%);
  }

  50% {
    transform: translateY(0%);
  }

  100% {
    transform: translateY(12%);
  }
}

@media (max-width: 1160px) {
  body {
    overflow: auto;
  }

  .app-shell {
    min-height: auto;
    height: auto;
    display: block;
  }

  .layout {
    grid-template-columns: 1fr;
    height: auto;
  }

  .panel {
    min-height: auto;
    height: auto;
  }

  .droid-canvas {
    min-height: 520px;
  }
}

@media (max-width: 720px) {
  .app-shell {
    width: calc(100% - 20px);
    padding-top: 10px;
  }

  .topbar,
  .panel {
    padding: 18px;
    border-radius: 22px;
  }

  .section-heading,
  .topbar {
    flex-direction: column;
  }

  .droid-image-frame {
    padding: 38px 20px 28px;
  }

  .section-progress-board {
    grid-template-columns: 1fr;
  }

  .axis-top {
    left: 34px;
    right: 34px;
  }

  .axis-left,
  .frame-chip {
    display: none;
  }
}
