:root {
  --ink: #101417;
  --paper: #f6f7f3;
  --panel: #fffffb;
  --panel-2: #eef1eb;
  --line: #d8ddd4;
  --line-strong: #b6c0b4;
  --muted: #64706b;
  --steel: #2f3a3d;
  --graphite: #181d20;
  --cut: #087a61;
  --blue: #245fba;
  --amber: #bd7a10;
  --danger: #b93434;
  --violet: #5a4fcf;
  --shadow: 0 24px 70px rgba(16, 20, 23, 0.12);
  --shadow-soft: 0 14px 34px rgba(16, 20, 23, 0.08);
  --radius: 8px;
  --fast: 180ms ease;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(rgba(16, 20, 23, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(16, 20, 23, 0.035) 1px, transparent 1px),
    radial-gradient(circle at 12% 0%, rgba(36, 95, 186, 0.08), transparent 28%),
    var(--paper);
  background-size: 28px 28px, 28px 28px, auto, auto;
  font-family: "Aptos", "Segoe UI", sans-serif;
  letter-spacing: 0;
}

:focus-visible {
  outline: 3px solid rgba(90, 79, 207, 0.42);
  outline-offset: 2px;
}

button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: 0.68; }

.shell {
  min-height: 100vh;
  padding: 22px;
}

.workspace {
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr);
  min-height: calc(100vh - 44px);
  border: 1px solid rgba(16, 20, 23, 0.18);
  border-radius: var(--radius);
  background: rgba(255, 255, 251, 0.78);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.workspace::selection {
  background: rgba(90, 79, 207, 0.22);
}

.rail {
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 20px;
  color: #f7f4ec;
  background: linear-gradient(180deg, #1a2024, #101417);
  border-right: 1px solid rgba(16, 20, 23, 0.22);
}

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

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(247, 244, 236, 0.28);
  border-radius: 6px;
  background: #0d1113;
  color: #ced5c9;
  font-family: "Courier New", monospace;
  font-weight: 800;
}

.brand strong, .brand span { display: block; }
.brand span {
  color: #adb7b2;
  font-size: 12px;
  margin-top: 2px;
}

.steps {
  display: grid;
  gap: 8px;
}

.step {
  height: 40px;
  border: 1px solid rgba(247, 244, 236, 0.13);
  border-radius: 6px;
  background: transparent;
  color: #d8ded7;
  text-align: left;
  padding: 0 12px;
  transition: transform var(--fast), background var(--fast), border-color var(--fast), color var(--fast);
}

.step:hover {
  transform: translateX(3px);
  border-color: rgba(247, 244, 236, 0.34);
  background: rgba(255, 255, 255, 0.06);
}

.step.is-active {
  background: #f7f4ec;
  color: var(--graphite);
  border-color: #f7f4ec;
}

.status-block {
  margin-top: auto;
  padding-top: 18px;
  border-top: 1px solid rgba(247, 244, 236, 0.16);
}

.status-block span {
  display: block;
  color: #adb7b2;
  font-size: 12px;
  margin-bottom: 6px;
}

.status-block strong {
  font-size: 14px;
  color: #f7f4ec;
}

.main-panel {
  min-width: 0;
  padding: 28px;
}

.topbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}

.topbar-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.kicker {
  margin: 0 0 8px;
  color: var(--cut);
  font-size: 13px;
  font-weight: 900;
}

h1 {
  max-width: 900px;
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(28px, 3vw, 44px);
  line-height: 1.08;
  font-weight: 500;
  letter-spacing: 0;
}

h2 {
  margin: 0;
  font-size: 17px;
}

.primary-action, .ghost-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--ink);
  border-radius: 6px;
  min-height: 44px;
  padding: 0 16px;
  background: var(--ink);
  color: var(--paper);
  font-weight: 900;
  white-space: nowrap;
  transition: transform var(--fast), background var(--fast), border-color var(--fast), box-shadow var(--fast);
}

.primary-action:hover, .ghost-action:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-soft);
}

.primary-action.secondary {
  background: var(--cut);
  border-color: var(--cut);
}

.ghost-action {
  min-height: 34px;
  background: transparent;
  color: var(--ink);
}

.icon-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #32c48d;
  box-shadow: 0 0 0 4px rgba(50, 196, 141, 0.16);
}

.icon-line {
  width: 16px;
  height: 2px;
  background: currentColor;
  box-shadow: 0 -5px 0 currentColor, 0 5px 0 currentColor;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(420px, 0.95fr) minmax(420px, 1.05fr);
  gap: 20px;
  align-items: start;
}

.app-view { display: none; }
.content-grid.app-view.is-active { display: grid; }
.repository-view.app-view.is-active { display: grid; }

.input-stack {
  display: grid;
  gap: 16px;
}

.module {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 251, 0.94);
  padding: 18px;
  transition: transform var(--fast), border-color var(--fast), box-shadow var(--fast);
}

.module:hover {
  transform: translateY(-2px);
  border-color: var(--line-strong);
  box-shadow: var(--shadow-soft);
}

.module.compact { padding: 16px; }

.module-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.module-head span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-top: 3px;
}

.module-chip {
  flex: 0 0 auto;
  padding: 6px 9px;
  border: 1px solid rgba(8, 122, 97, 0.22);
  border-radius: 999px;
  color: var(--cut);
  background: rgba(8, 122, 97, 0.08);
  font-size: 12px;
}

.title-field { margin-bottom: 12px; }

.dropzone {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 198px;
  border: 1px dashed rgba(16, 20, 23, 0.38);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(8, 122, 97, 0.12), transparent 44%),
    linear-gradient(315deg, rgba(36, 95, 186, 0.10), transparent 46%),
    #fbfcf8;
  text-align: center;
  padding: 24px;
  overflow: hidden;
  transition: transform var(--fast), border-color var(--fast), background var(--fast), box-shadow var(--fast);
}

.dropzone::after {
  content: "";
  position: absolute;
  inset: 12px;
  border: 1px solid rgba(16, 20, 23, 0.06);
  border-radius: 6px;
  pointer-events: none;
}

.dropzone:hover,
.dropzone.is-dragover {
  transform: translateY(-2px);
  border-color: var(--cut);
  box-shadow: inset 0 0 0 1px rgba(8, 122, 97, 0.2), var(--shadow-soft);
}

.dropzone.is-dragover {
  background:
    linear-gradient(135deg, rgba(8, 122, 97, 0.22), transparent 44%),
    linear-gradient(315deg, rgba(90, 79, 207, 0.18), transparent 46%),
    #fbfcf8;
}

.dropzone input { display: none; }

.drop-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  margin-bottom: 11px;
  border: 1px solid var(--ink);
  border-radius: 50%;
  color: var(--cut);
  background: rgba(255, 255, 251, 0.72);
  font-size: 30px;
  line-height: 1;
  transition: transform var(--fast);
}

.dropzone:hover .drop-icon,
.dropzone.is-dragover .drop-icon {
  transform: rotate(90deg) scale(1.04);
}

.dropzone strong, .dropzone small { display: block; }
.dropzone small {
  max-width: 460px;
  margin-top: 8px;
  color: var(--muted);
}

.file-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.file-row, .finding {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: center;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fffffb;
  color: inherit;
  text-align: left;
  transition: transform var(--fast), border-color var(--fast), background var(--fast);
  appearance: none;
}

.file-row:hover, .archive-card:hover, .finding:hover {
  transform: translateY(-1px);
  border-color: var(--line-strong);
  background: #fbfdf8;
}

.file-row.is-active {
  border-color: rgba(90, 79, 207, 0.55);
  background: linear-gradient(90deg, rgba(90, 79, 207, 0.09), rgba(8, 122, 97, 0.05)), #fffffb;
  box-shadow: 0 0 0 3px rgba(90, 79, 207, 0.08);
}

.file-remove {
  align-self: center;
  border: 1px solid rgba(16, 20, 23, 0.14);
  border-radius: 999px;
  padding: 5px 8px;
  color: var(--muted);
  background: rgba(47, 58, 61, 0.05);
  font-size: 11px;
  font-weight: 900;
  transition: color var(--fast), border-color var(--fast), background var(--fast), transform var(--fast);
}

.file-remove:hover {
  color: var(--danger);
  border-color: rgba(185, 52, 52, 0.34);
  background: rgba(185, 52, 52, 0.08);
  transform: translateY(-1px);
}

.file-row strong,
.file-row small {
  display: block;
  overflow-wrap: anywhere;
}

.badge {
  min-width: 52px;
  padding: 5px 8px;
  border-radius: 999px;
  background: var(--graphite);
  color: var(--paper);
  font-size: 11px;
  font-weight: 900;
  text-align: center;
}

.file-row small, .finding p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.spec-grid, .search-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.nc-workflow {
  border-color: rgba(240, 164, 42, 0.36);
  background:
    linear-gradient(135deg, rgba(240, 164, 42, 0.08), rgba(8, 122, 97, 0.06)),
    rgba(255, 255, 251, 0.96);
}

.nc-principle {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}

.nc-principle div {
  min-width: 0;
  padding: 11px;
  border: 1px solid rgba(16, 20, 23, 0.13);
  border-radius: 6px;
  background: rgba(255, 255, 251, 0.78);
}

.nc-principle strong,
.nc-principle span {
  display: block;
  overflow-wrap: anywhere;
}

.nc-principle strong {
  color: var(--graphite);
  font-size: 13px;
}

.nc-principle span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.nc-spec-grid { margin-bottom: 12px; }

.question-panel {
  display: grid;
  gap: 10px;
  margin-top: 12px;
  padding: 12px;
  border: 1px solid rgba(185, 52, 52, 0.28);
  border-radius: 6px;
  background: rgba(185, 52, 52, 0.06);
}

.question-panel[hidden] { display: none; }

.question-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.question-head strong {
  color: var(--danger);
  font-size: 14px;
}

.question-head span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.question-list {
  display: grid;
  gap: 8px;
}

.question-item {
  display: grid;
  gap: 6px;
  padding: 10px;
  border: 1px solid rgba(16, 20, 23, 0.1);
  border-radius: 6px;
  background: rgba(255, 255, 251, 0.82);
}

.question-item span {
  color: var(--ink);
  font-size: 13px;
}

.question-item small {
  color: var(--muted);
  line-height: 1.4;
}

.nc-workflow-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
}

.nc-workflow-actions span {
  flex: 1 1 220px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.save-module {
  border-color: rgba(8, 122, 97, 0.26);
}

.save-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr) auto;
  gap: 12px;
  align-items: end;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fffffb;
  color: var(--ink);
  padding: 12px;
  outline: none;
  transition: border-color var(--fast), box-shadow var(--fast), background var(--fast);
}

textarea { min-height: 82px; resize: vertical; }
input:focus, select:focus, textarea:focus {
  border-color: var(--cut);
  box-shadow: 0 0 0 3px rgba(8, 122, 97, 0.13);
}

.wide { grid-column: 1 / -1; }

.review-panel {
  display: grid;
  align-content: start;
  gap: 14px;
  position: sticky;
  top: 18px;
}

.preview-shell {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #151a1d;
  color: #f6f7f3;
  overflow: hidden;
  box-shadow: var(--shadow-soft);
}

.preview-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 58px;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(246, 247, 243, 0.12);
}

.preview-toolbar span,
.preview-meta {
  color: #aeb9b4;
  font-size: 12px;
}

.preview-toolbar strong {
  display: block;
  margin-top: 2px;
  overflow-wrap: anywhere;
}

.preview-tabs {
  display: flex;
  gap: 6px;
  max-width: 48%;
  overflow-x: auto;
  padding-bottom: 2px;
}

.preview-tab {
  flex: 0 0 auto;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border: 1px solid rgba(246, 247, 243, 0.18);
  border-radius: 999px;
  background: rgba(246, 247, 243, 0.06);
  color: #dfe5dc;
  padding: 6px 9px;
  font-size: 12px;
  transition: transform var(--fast), background var(--fast), border-color var(--fast);
}

.preview-tab:hover,
.preview-tab.is-active {
  transform: translateY(-1px);
  border-color: rgba(50, 196, 141, 0.62);
  background: rgba(50, 196, 141, 0.16);
}

.preview-stage {
  position: relative;
  min-height: 360px;
  display: grid;
  place-items: center;
  background:
    linear-gradient(rgba(246, 247, 243, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(246, 247, 243, 0.06) 1px, transparent 1px),
    #1b2024;
  background-size: 26px 26px;
}

.preview-stage::after {
  content: "여기로 파일을 드롭해도 추가됩니다";
  position: absolute;
  inset: 18px;
  display: grid;
  place-items: center;
  border: 1px dashed rgba(50, 196, 141, 0.58);
  border-radius: 6px;
  color: #e8f7ef;
  background: rgba(8, 122, 97, 0.26);
  opacity: 0;
  pointer-events: none;
  transform: scale(0.98);
  transition: opacity var(--fast), transform var(--fast);
  font-weight: 900;
}

.preview-stage.is-drop-target::after {
  opacity: 1;
  transform: scale(1);
}

.preview-stage.is-loading::before {
  content: "";
  position: absolute;
  top: 14px;
  right: 14px;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(246, 247, 243, 0.24);
  border-top-color: #32c48d;
  border-radius: 50%;
  animation: spin 840ms linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.preview-stage canvas,
.preview-stage img,
.preview-stage iframe,
.preview-stage pre {
  width: 100%;
  max-width: 100%;
}

.step-summary-stage,
.step-geometry-stage {
  width: 100%;
  min-height: 360px;
  display: grid;
  grid-template-columns: minmax(360px, 1.4fr) minmax(260px, 0.72fr);
  gap: 18px;
  align-items: center;
  padding: 24px;
}

.step-viewport {
  position: relative;
  min-width: 0;
  overflow: hidden;
  border: 1px solid rgba(246, 247, 243, 0.14);
  border-radius: 6px;
  background: #121719;
  box-shadow: inset 0 0 0 1px rgba(50, 196, 141, 0.06);
}

.step-geometry-canvas {
  display: block;
  width: 100%;
  min-height: 420px;
  aspect-ratio: 16 / 9;
  cursor: default;
}

.step-viewport-label {
  position: absolute;
  left: 14px;
  top: 14px;
  display: grid;
  gap: 3px;
  padding: 8px 10px;
  border: 1px solid rgba(246, 247, 243, 0.14);
  border-radius: 6px;
  color: #f6f7f3;
  background: rgba(18, 23, 25, 0.78);
}

.step-viewport-label strong {
  color: #8fd7bc;
  font-size: 12px;
}

.step-viewport-label span {
  color: #aeb9b4;
  font-size: 11px;
}

.step-summary-main,
.step-summary-side {
  min-width: 0;
  display: grid;
  gap: 14px;
}

.step-summary-main {
  align-content: center;
}

.step-summary-main .badge {
  justify-self: start;
}

.step-summary-main h3 {
  margin: 0;
  color: #f6f7f3;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 30px;
  font-weight: 500;
}

.step-summary-main p {
  margin: 0;
  color: #aeb9b4;
  line-height: 1.55;
}

.step-file-facts {
  display: grid;
  gap: 8px;
  margin: 0;
}

.step-file-facts div {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 10px;
  align-items: baseline;
  padding: 9px 10px;
  border: 1px solid rgba(246, 247, 243, 0.12);
  border-radius: 6px;
  background: rgba(16, 21, 24, 0.62);
}

.step-file-facts dt {
  color: #8fd7bc;
  font-size: 12px;
  font-weight: 900;
}

.step-file-facts dd {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
  color: #eef3ed;
  font-size: 13px;
}

.step-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  border: 1px solid rgba(246, 247, 243, 0.12);
  border-radius: 6px;
  background: rgba(246, 247, 243, 0.12);
}

.step-metrics span {
  min-width: 0;
  padding: 9px 10px;
  color: #aeb9b4;
  background: rgba(21, 26, 29, 0.9);
  font-size: 11px;
  text-align: center;
}

.step-metrics strong {
  display: block;
  color: #8fd7bc;
  font-family: "Courier New", monospace;
  font-size: 17px;
  line-height: 1.1;
}

.step-preview-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
}

.compact-action {
  min-height: 42px;
  border-color: rgba(246, 247, 243, 0.36);
  color: #f6f7f3;
}

canvas {
  display: block;
  width: 100%;
  height: auto;
  touch-action: none;
  cursor: grab;
}

canvas.is-grabbing {
  cursor: grabbing;
}

.preview-stage img {
  display: block;
  max-height: 520px;
  object-fit: contain;
  background: #0f1315;
}

.preview-stage iframe {
  height: min(62vh, 560px);
  border: 0;
  background: #fff;
}

.preview-stage pre {
  margin: 0;
  min-height: 360px;
  max-height: 520px;
  overflow: auto;
  padding: 18px;
  color: #dfe5dc;
  white-space: pre-wrap;
  font-family: "Courier New", monospace;
  font-size: 12px;
  line-height: 1.55;
}

.conversion-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 14px;
  border-top: 1px solid rgba(246, 247, 243, 0.12);
  background: linear-gradient(90deg, rgba(50, 196, 141, 0.12), rgba(36, 95, 186, 0.08)), #111619;
}

.conversion-bar[hidden] { display: none; }

.conversion-bar span,
.conversion-bar strong {
  display: block;
}

.conversion-bar span {
  color: #8fd7bc;
  font-size: 12px;
  font-weight: 900;
}

.conversion-bar strong {
  margin-top: 3px;
  color: #eef3ed;
  font-size: 13px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.conversion-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 8px;
  align-items: center;
}

.convert-action {
  flex: 0 0 auto;
  min-height: 38px;
  border: 1px solid rgba(50, 196, 141, 0.62);
  border-radius: 6px;
  padding: 0 13px;
  background: #32c48d;
  color: #101417;
  font-weight: 900;
  transition: transform var(--fast), border-color var(--fast), background var(--fast), box-shadow var(--fast);
}

.convert-action.hot,
#extractNcBtn {
  border-color: #ffd27a;
  background: #f0a42a;
  color: #17120a;
  box-shadow: 0 0 0 4px rgba(240, 164, 42, 0.16);
}

.convert-action.hot:hover,
#extractNcBtn:hover {
  border-color: #fff1c9;
  background: #ffc45a;
  box-shadow: 0 14px 34px rgba(240, 164, 42, 0.26);
}

.convert-action.subtle {
  border-color: rgba(246, 247, 243, 0.28);
  background: rgba(246, 247, 243, 0.09);
  color: #eef3ed;
}

.convert-action:hover {
  transform: translateY(-2px);
  border-color: #e8f7ef;
  background: #58dca7;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.22);
}

.convert-action:disabled {
  background: rgba(246, 247, 243, 0.24);
  color: rgba(246, 247, 243, 0.72);
}

.preview-empty,
.cad-preview {
  width: 100%;
  min-height: 360px;
  display: grid;
  place-items: center;
  padding: 28px;
  text-align: center;
}

.dwg-preview {
  width: 100%;
  min-height: 360px;
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(220px, 0.78fr);
  gap: 18px;
  align-items: center;
  padding: 24px;
}

.dwg-sheet {
  min-height: 294px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(246, 247, 243, 0.14);
  border-radius: 6px;
  background:
    linear-gradient(rgba(50, 196, 141, 0.10) 1px, transparent 1px),
    linear-gradient(90deg, rgba(50, 196, 141, 0.10) 1px, transparent 1px),
    #101518;
  background-size: 18px 18px;
}

.dwg-frame {
  position: relative;
  width: min(92%, 410px);
  aspect-ratio: 1.45;
  border: 2px solid rgba(223, 229, 220, 0.82);
  border-radius: 4px;
  transform: perspective(900px) rotateX(56deg) rotateZ(-18deg);
  box-shadow: 0 28px 40px rgba(0, 0, 0, 0.28);
}

.dwg-layer,
.dwg-hole,
.dwg-dim {
  position: absolute;
  display: block;
}

.dwg-layer {
  height: 2px;
  background: #32c48d;
  transform-origin: left center;
}

.dwg-layer.line-a {
  left: 13%;
  top: 25%;
  width: 62%;
  transform: rotate(18deg);
}

.dwg-layer.line-b {
  left: 18%;
  top: 61%;
  width: 54%;
  transform: rotate(-11deg);
  background: #f0a42a;
}

.dwg-layer.line-c {
  left: 43%;
  top: 16%;
  width: 2px;
  height: 68%;
  background: #8fa8ff;
}

.dwg-hole {
  width: 26px;
  height: 26px;
  border: 2px solid #dfe5dc;
  border-radius: 50%;
  box-shadow: inset 0 0 0 5px rgba(50, 196, 141, 0.13);
}

.dwg-hole.h1 { left: 20%; top: 34%; }
.dwg-hole.h2 { left: 47%; top: 42%; }
.dwg-hole.h3 { right: 17%; bottom: 21%; }

.dwg-dim {
  color: #f0a42a;
  font-family: "Courier New", monospace;
  font-size: 13px;
  font-weight: 900;
}

.dwg-dim.dim-x { left: 8%; bottom: 7%; }
.dwg-dim.dim-y { right: 8%; top: 7%; color: #8fd7bc; }

.dwg-side {
  display: grid;
  gap: 13px;
  text-align: left;
}

.dwg-side .badge {
  justify-self: start;
}

.dwg-side h3 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 28px;
  font-weight: 500;
}

.dwg-side p {
  margin: 0;
  color: #aeb9b4;
  line-height: 1.55;
}

.convert-action.inline {
  justify-self: start;
  min-height: 42px;
}

.cad-preview-card {
  max-width: 460px;
  display: grid;
  gap: 14px;
}

.cad-preview-card .badge {
  justify-self: center;
}

.cad-preview-card h3 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 30px;
  font-weight: 500;
}

.cad-preview-card p {
  margin: 0;
  color: #aeb9b4;
  line-height: 1.55;
}

.preview-meta {
  padding: 10px 14px;
  border-top: 1px solid rgba(246, 247, 243, 0.12);
}

.preview-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  background: rgba(246, 247, 243, 0.12);
  border-top: 1px solid rgba(246, 247, 243, 0.12);
}

.preview-stats span {
  min-width: 0;
  padding: 10px 12px;
  overflow: hidden;
  color: #dfe5dc;
  background: #151a1d;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.metric-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.metric-row div {
  min-height: 88px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fffffb;
}

.metric-row span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 10px;
}

.metric-row strong {
  display: block;
  font-size: 20px;
}

.findings {
  display: grid;
  gap: 8px;
  min-height: 84px;
}

.finding { grid-template-columns: auto 1fr; align-items: start; }
.finding strong { display: block; margin-bottom: 3px; }
.finding[data-severity="block"] .badge { background: var(--danger); }
.finding[data-severity="warn"] .badge { background: var(--amber); color: #17120a; }
.finding[data-severity="ok"] .badge { background: var(--cut); }

.package-list {
  display: grid;
  gap: 9px;
  margin: 0;
  padding-left: 22px;
  color: var(--muted);
}

.archive-actions {
  display: grid;
  grid-template-columns: minmax(180px, auto) 1fr;
  gap: 12px;
  align-items: stretch;
  margin-bottom: 12px;
}

.archive-count {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fffffb;
}

.archive-count span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.archive-count strong { font-size: 16px; }

.search-hints {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 10px;
}

.search-hints button,
.archive-card button {
  border: 1px solid rgba(16, 20, 23, 0.16);
  border-radius: 999px;
  background: rgba(255, 255, 251, 0.84);
  color: var(--graphite);
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 900;
  transition: transform var(--fast), border-color var(--fast), background var(--fast), box-shadow var(--fast);
}

.search-hints button:hover,
.archive-card button:hover {
  transform: translateY(-1px);
  border-color: var(--cut);
  background: rgba(8, 122, 97, 0.1);
  box-shadow: 0 8px 18px rgba(16, 20, 23, 0.07);
}

.archive-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
  max-height: 430px;
  overflow: auto;
  padding-right: 3px;
}

.archive-card {
  display: grid;
  gap: 9px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fffffb;
  transition: transform var(--fast), border-color var(--fast), background var(--fast), box-shadow var(--fast);
}

.archive-card:first-child {
  border-color: rgba(90, 79, 207, 0.24);
}

.archive-title {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: start;
}

.archive-card.is-selected {
  border-color: rgba(8, 122, 97, 0.58);
  box-shadow: 0 0 0 3px rgba(8, 122, 97, 0.1), var(--shadow-soft);
}

.archive-composition {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.archive-composition span {
  min-width: 0;
  padding: 7px 8px;
  border: 1px solid rgba(16, 20, 23, 0.12);
  border-radius: 6px;
  background: rgba(47, 58, 61, 0.06);
  color: var(--muted);
  font-family: "Courier New", monospace;
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}

.archive-composition span.is-ok {
  border-color: rgba(8, 122, 97, 0.28);
  background: rgba(8, 122, 97, 0.1);
  color: var(--cut);
}

.archive-title strong,
.archive-title small {
  display: block;
  overflow-wrap: anywhere;
}

.archive-title small,
.archive-card p {
  color: var(--muted);
  font-size: 12px;
}

.archive-card p {
  margin: 0;
  line-height: 1.5;
}

.archive-files {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.archive-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.archive-tags span {
  max-width: 100%;
  overflow-wrap: anywhere;
  border-radius: 999px;
  padding: 5px 8px;
  color: var(--muted);
  background: rgba(47, 58, 61, 0.07);
  font-size: 12px;
  font-weight: 800;
}

.archive-card-actions {
  display: flex;
  gap: 7px;
  justify-content: flex-end;
}

.archive-files a {
  max-width: 100%;
  overflow-wrap: anywhere;
  border: 1px solid rgba(16, 20, 23, 0.16);
  border-radius: 999px;
  padding: 5px 8px;
  color: var(--graphite);
  background: rgba(8, 122, 97, 0.08);
  font-size: 12px;
  text-decoration: none;
  transition: border-color var(--fast), background var(--fast), transform var(--fast);
}

.archive-files a:hover {
  transform: translateY(-1px);
  border-color: var(--cut);
  background: rgba(8, 122, 97, 0.14);
}

.archive-empty {
  padding: 16px;
  border: 1px dashed rgba(16, 20, 23, 0.25);
  border-radius: 6px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.44);
  font-size: 13px;
}

.archive-focus {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid rgba(8, 122, 97, 0.22);
  border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(8, 122, 97, 0.08), rgba(36, 95, 186, 0.06)), #fffffb;
}

.archive-focus h2,
.archive-focus p {
  margin: 0;
}

.archive-focus h2 {
  font-size: 15px;
}

.archive-focus p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.archive-focus-files {
  display: grid;
  gap: 7px;
}

.archive-focus-files a {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 10px;
  color: var(--ink);
  background: rgba(255, 255, 251, 0.74);
  text-decoration: none;
  transition: transform var(--fast), border-color var(--fast), background var(--fast);
}

.archive-focus-files a:hover {
  transform: translateY(-1px);
  border-color: var(--cut);
  background: #fffffb;
}

.archive-focus-files strong,
.archive-focus-files span {
  overflow-wrap: anywhere;
}

.archive-focus-files span {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 12px;
}

.nc-output {
  display: grid;
  overflow: hidden;
  border: 1px solid rgba(240, 164, 42, 0.42);
  border-radius: var(--radius);
  background: #101518;
  color: #f6f7f3;
  box-shadow: 0 0 0 3px rgba(240, 164, 42, 0.10), var(--shadow-soft);
}

.nc-output[hidden] { display: none; }

.nc-output-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 14px;
  border-bottom: 1px solid rgba(246, 247, 243, 0.12);
  background: linear-gradient(90deg, rgba(240, 164, 42, 0.18), rgba(8, 122, 97, 0.10)), #111619;
}

.nc-output-head span,
.nc-output-head strong {
  display: block;
}

.nc-output-head span {
  color: #ffd27a;
  font-size: 12px;
  font-weight: 900;
}

.nc-output-head strong {
  margin-top: 3px;
  overflow-wrap: anywhere;
}

.download-action {
  flex: 0 0 auto;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #ffd27a;
  border-radius: 6px;
  padding: 0 13px;
  background: #f0a42a;
  color: #17120a;
  font-weight: 900;
  text-decoration: none;
  transition: transform var(--fast), background var(--fast), box-shadow var(--fast);
}

.download-action:hover {
  transform: translateY(-2px);
  background: #ffc45a;
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.24);
}

.nc-output pre {
  max-height: 260px;
  margin: 0;
  overflow: auto;
  padding: 14px;
  color: #dfe5dc;
  font-family: "Courier New", monospace;
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
}

.repository-view {
  gap: 18px;
}

.repository-hero {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(8, 122, 97, 0.10), transparent 46%),
    linear-gradient(315deg, rgba(36, 95, 186, 0.08), transparent 44%),
    #fffffb;
}

.repository-hero h2 {
  max-width: 840px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(24px, 2.3vw, 38px);
  line-height: 1.12;
  font-weight: 500;
}

.repository-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.repository-grid {
  display: grid;
  grid-template-columns: minmax(280px, 340px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.repository-search-panel,
.repository-results {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 251, 0.94);
  padding: 16px;
}

.repository-search-panel {
  display: grid;
  gap: 14px;
  position: sticky;
  top: 18px;
}

.folder-import-card {
  display: grid;
  gap: 11px;
  padding: 14px;
  border: 1px solid rgba(36, 95, 186, 0.22);
  border-radius: 6px;
  background:
    linear-gradient(135deg, rgba(36, 95, 186, 0.08), rgba(8, 122, 97, 0.06)),
    #fffffb;
}

.folder-import-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: start;
}

.folder-import-head strong,
.folder-import-head span {
  display: block;
}

.folder-import-head strong {
  color: var(--graphite);
  font-size: 14px;
}

.folder-import-head span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.folder-dropzone {
  min-height: 132px;
  place-items: center;
  border: 1px dashed rgba(36, 95, 186, 0.38);
  border-radius: 6px;
  background:
    linear-gradient(135deg, rgba(36, 95, 186, 0.12), transparent 46%),
    linear-gradient(315deg, rgba(8, 122, 97, 0.10), transparent 44%),
    rgba(255, 255, 251, 0.72);
  padding: 18px;
  text-align: center;
  transition: transform var(--fast), border-color var(--fast), background var(--fast), box-shadow var(--fast);
}

.folder-dropzone:hover,
.folder-dropzone.is-dragover {
  transform: translateY(-2px);
  border-color: var(--blue);
  box-shadow: inset 0 0 0 1px rgba(36, 95, 186, 0.2), var(--shadow-soft);
}

.folder-dropzone input {
  display: none;
}

.folder-icon {
  display: block;
  width: 42px;
  height: 32px;
  margin: 0 auto 10px;
  border: 2px solid var(--blue);
  border-radius: 4px;
  background: rgba(36, 95, 186, 0.08);
  position: relative;
}

.folder-icon::before {
  content: "";
  position: absolute;
  left: 5px;
  top: -9px;
  width: 18px;
  height: 9px;
  border: 2px solid var(--blue);
  border-bottom: 0;
  border-radius: 4px 4px 0 0;
  background: #fffffb;
}

.folder-dropzone strong,
.folder-dropzone small {
  display: block;
}

.folder-dropzone small {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.folder-import-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.folder-import-summary span {
  min-width: 0;
  padding: 7px 8px;
  border: 1px solid rgba(16, 20, 23, 0.12);
  border-radius: 6px;
  color: var(--muted);
  background: rgba(47, 58, 61, 0.06);
  font-family: "Courier New", monospace;
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}

.folder-import-summary span.is-ok {
  border-color: rgba(8, 122, 97, 0.28);
  background: rgba(8, 122, 97, 0.1);
  color: var(--cut);
}

.folder-save-action {
  width: 100%;
}

.folder-file-list {
  display: grid;
  gap: 6px;
  max-height: 210px;
  overflow: auto;
}

.folder-file-list span {
  display: grid;
  gap: 3px;
  padding: 8px 9px;
  border: 1px solid rgba(16, 20, 23, 0.10);
  border-radius: 6px;
  background: rgba(255, 255, 251, 0.72);
}

.folder-file-list strong,
.folder-file-list small {
  display: block;
  overflow-wrap: anywhere;
}

.folder-file-list strong {
  color: var(--graphite);
  font-size: 12px;
}

.folder-file-list small {
  color: var(--muted);
  font-size: 11px;
}

.repository-count {
  margin: 0;
}

.repository-search {
  grid-template-columns: 1fr;
}

.repository-rule {
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid rgba(8, 122, 97, 0.22);
  border-radius: 6px;
  background: rgba(8, 122, 97, 0.08);
}

.repository-rule strong {
  color: var(--cut);
  font-size: 13px;
}

.repository-rule span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.repository-toolbar {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.repository-toolbar strong {
  font-size: 17px;
}

.repository-toolbar span {
  color: var(--muted);
  font-size: 12px;
}

.repository-list {
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  max-height: none;
  overflow: visible;
  padding-right: 0;
}

@media (max-width: 1180px) {
  .workspace { grid-template-columns: 1fr; }
  .rail {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
  }
  .steps {
    grid-template-columns: repeat(8, minmax(108px, 1fr));
    overflow-x: auto;
  }
  .status-block {
    margin-top: 0;
    padding-top: 0;
    padding-left: 16px;
    border-top: 0;
    border-left: 1px solid rgba(247, 244, 236, 0.16);
  }
}

@media (max-width: 1040px) {
  .content-grid { grid-template-columns: 1fr; }
  .review-panel { position: static; }
}

@media (max-width: 720px) {
  .shell { padding: 12px; }
  .workspace { min-height: calc(100vh - 24px); }
  .main-panel, .rail { padding: 14px; }
  .rail { grid-template-columns: 1fr; }
  .status-block {
    padding-left: 0;
    padding-top: 14px;
    border-left: 0;
    border-top: 1px solid rgba(247, 244, 236, 0.16);
  }
  .topbar {
    align-items: stretch;
    flex-direction: column;
  }
  .topbar-actions,
  .repository-actions {
    justify-content: stretch;
  }
  .topbar-actions > *,
  .repository-actions > * {
    width: 100%;
  }
  .steps,
  .spec-grid,
  .search-grid,
  .nc-principle,
  .metric-row,
  .archive-actions,
  .save-grid,
  .repository-grid {
    grid-template-columns: 1fr;
  }
  .repository-hero {
    align-items: stretch;
    flex-direction: column;
  }
  .repository-search-panel {
    position: static;
  }
  .repository-list {
    grid-template-columns: 1fr;
  }
  h1 { font-size: 30px; }
  .module-head {
    align-items: stretch;
    flex-direction: column;
  }
  .file-row {
    grid-template-columns: auto minmax(0, 1fr) auto;
  }
  .file-row > small {
    grid-column: 2;
  }
  .file-remove {
    grid-column: 3;
    grid-row: 1 / span 2;
  }
  .preview-toolbar {
    align-items: stretch;
    flex-direction: column;
  }
  .conversion-bar {
    align-items: stretch;
    flex-direction: column;
  }
  .conversion-actions,
  .convert-action {
    width: 100%;
  }
  .conversion-actions {
    flex-direction: column;
  }
  .preview-tabs { max-width: 100%; }
  .preview-stage { min-height: 300px; }
  .preview-stats { grid-template-columns: 1fr; }
  .preview-empty, .cad-preview, .dwg-preview, .step-summary-stage, .step-geometry-stage { min-height: 300px; }
  .step-summary-stage,
  .step-geometry-stage {
    grid-template-columns: 1fr;
    padding: 16px;
  }
  .step-geometry-canvas {
    min-height: 300px;
  }
  .step-preview-actions {
    align-items: stretch;
    flex-direction: column;
  }
  .step-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .dwg-preview {
    grid-template-columns: 1fr;
    padding: 16px;
  }
  .dwg-sheet { min-height: 220px; }
  .archive-focus-files a {
    display: grid;
  }
  .nc-output-head {
    align-items: stretch;
    flex-direction: column;
  }
  .download-action {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    animation: none !important;
    scroll-behavior: auto !important;
  }
}
