:root {
  color-scheme: light;
  font-family:
    Pretendard,
    "Noto Sans KR",
    Inter,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  color: #17221c;
  background: #e8eeea;
  font-synthesis: none;
  --ink: #17221c;
  --muted: #66746b;
  --paper: #fbfcfa;
  --paper-strong: #ffffff;
  --canvas: #f3f7f4;
  --line: #d5ded7;
  --green-950: #10251b;
  --green-850: #17432f;
  --green-700: #286447;
  --green-600: #347c58;
  --green-200: #bad7c5;
  --green-100: #dfede4;
  --blueprint: #1e6f78;
  --warning: #9a5b22;
  --error: #a33a32;
  --shadow: 0 14px 36px rgb(28 55 40 / 8%);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
}

body {
  min-width: 320px;
  background:
    radial-gradient(circle at 50% -12%, rgb(255 255 255 / 95%), transparent 38rem),
    #e8eeea;
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

button:focus-visible,
input:focus-visible,
a:focus-visible {
  outline: 3px solid #82c8a1;
  outline-offset: 2px;
}

.app-header {
  min-height: 74px;
  padding: 11px clamp(15px, 2.7vw, 42px);
  display: grid;
  grid-template-columns: max-content max-content 1fr;
  align-items: center;
  gap: 24px;
  border-bottom: 1px solid rgb(30 73 52 / 10%);
  background: rgb(251 252 250 / 92%);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  justify-self: start;
  gap: 11px;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  color: white;
  background: var(--green-850);
  font-size: 0.78rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  box-shadow: 0 8px 20px rgb(23 67 47 / 22%);
}

.brand-copy strong,
.brand-copy small {
  display: block;
}

.brand-copy strong {
  font-size: 0.95rem;
  letter-spacing: -0.02em;
}

.brand-copy small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.64rem;
  letter-spacing: 0.02em;
}

.stage-heading {
  padding: 7px 16px 7px 8px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid #cfe0d5;
  border-radius: 999px;
  background: var(--green-100);
  justify-self: start;
}

.stage-number {
  width: 35px;
  height: 35px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: white;
  background: var(--green-850);
  font-size: 0.72rem;
  font-weight: 850;
}

.stage-heading small,
.stage-heading strong {
  display: block;
}

.stage-heading small {
  color: var(--green-700);
  font-size: 0.55rem;
  font-weight: 800;
  letter-spacing: 0.1em;
}

.stage-heading strong {
  margin-top: 1px;
  font-size: 0.83rem;
}

.header-status {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 700;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #d69344;
  box-shadow: 0 0 0 5px rgb(214 147 68 / 12%);
}

.section-tabs {
  min-height: 66px;
  padding: 9px clamp(15px, 2.7vw, 42px) 6px;
  border-bottom: 1px solid rgb(30 73 52 / 10%);
  background: var(--paper-strong);
}

.section-tablist {
  display: flex;
  align-items: center;
  gap: 0;
  overflow-x: auto;
  scrollbar-width: thin;
}

.section-tab {
  min-width: max-content;
  min-height: 38px;
  padding: 8px 13px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid #d6e1d9;
  border-radius: 9px;
  background: #f8faf8;
  cursor: pointer;
}

.section-tab span {
  color: var(--green-600);
  font-size: 0.68rem;
  font-weight: 850;
}

.section-tab strong {
  color: var(--muted);
  font-size: 0.75rem;
}

.section-tab:hover {
  border-color: #bcd1c3;
  background: #f0f6f2;
}

.section-tab[aria-selected="true"] {
  border-color: #b7d0c0;
  background: var(--green-100);
  box-shadow: inset 0 -2px 0 var(--green-600);
}

.section-tab[aria-selected="true"] strong {
  color: var(--green-950);
}

.wizard-separator {
  flex: 0 0 24px;
  color: #8fa097;
  font-size: 1.1rem;
  font-weight: 700;
  text-align: center;
}

.tab-order-note {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.58rem;
  text-align: right;
}

.workspace {
  max-width: 1920px;
  min-height: calc(100vh - 178px);
  margin: 0 auto;
  padding: clamp(12px, 1.4vw, 22px);
  display: grid;
  grid-template-columns: minmax(250px, .78fr) minmax(520px, 2fr) minmax(235px, .72fr);
  align-items: start;
  gap: clamp(11px, 1.1vw, 18px);
}

.panel {
  min-width: 0;
  border: 1px solid rgb(30 73 52 / 12%);
  border-radius: 19px;
  background: rgb(251 252 250 / 96%);
  box-shadow: var(--shadow);
}

.parameter-panel,
.progress-panel {
  padding: clamp(17px, 1.45vw, 24px);
}

.parameter-panel {
  align-self: stretch;
}

.panel-heading,
.drawing-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--green-600);
  font-size: 0.61rem;
  font-weight: 850;
  letter-spacing: 0.13em;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1,
h2 {
  margin-bottom: 0;
  color: var(--green-950);
  font-size: clamp(1.05rem, 1.2vw, 1.28rem);
  letter-spacing: -0.035em;
}

h3 {
  margin-bottom: 7px;
  font-size: 0.85rem;
}

.contract-badge {
  padding: 5px 7px;
  border: 1px solid #e4c69e;
  border-radius: 999px;
  color: var(--warning);
  background: #fff7eb;
  font-size: 0.58rem;
  font-weight: 800;
  white-space: nowrap;
}

.contract-badge.is-ready {
  border-color: var(--green-200);
  color: var(--green-700);
  background: #eef7f1;
}

.panel-description {
  margin: 13px 0 15px;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.55;
}

.definition-notice {
  margin: 0 0 16px;
  padding: 12px 13px;
  border: 1px solid #e4d2b8;
  border-radius: 11px;
  color: #775027;
  background: #fff9f0;
}

.definition-notice strong {
  font-size: 0.7rem;
}

.definition-notice p {
  margin: 4px 0 0;
  font-size: 0.63rem;
  line-height: 1.5;
}

.definition-notice.is-ready {
  border-color: var(--green-200);
  color: var(--green-850);
  background: #f0f8f3;
}

.definition-notice.is-error {
  border-color: #e4b9b5;
  color: #7f2d27;
  background: #fff3f2;
}

#parameter-form {
  display: grid;
  gap: 12px;
}

.parameter-field {
  display: grid;
  gap: 6px;
}

.parameter-field label {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
}

.parameter-field label span {
  color: var(--green-950);
  font-size: 0.72rem;
  font-weight: 750;
}

.parameter-field label small {
  max-width: 52%;
  color: var(--muted);
  font-size: 0.56rem;
  line-height: 1.35;
  text-align: right;
}

.pending-control {
  height: 38px;
  padding: 0 10px;
  display: flex;
  align-items: center;
  border: 1px dashed #c7d1c9;
  border-radius: 9px;
  background: #f5f7f5;
}

.parameter-control {
  height: 40px;
  padding: 0 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid #bfcfc4;
  border-radius: 9px;
  background: var(--paper-strong);
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

.parameter-control:focus-within {
  border-color: var(--green-600);
  box-shadow: 0 0 0 3px rgb(52 124 88 / 10%);
}

.parameter-control.has-error {
  border-color: var(--error);
  box-shadow: 0 0 0 3px rgb(163 58 50 / 9%);
}

.parameter-control input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  color: var(--green-950);
  background: transparent;
  font-size: 0.74rem;
  font-weight: 720;
}

.parameter-control span {
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 700;
  white-space: nowrap;
}

.field-error {
  color: var(--error);
  font-size: 0.58rem;
  line-height: 1.4;
}

.lane-width-controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.lane-width-item {
  min-width: 0;
}

.lane-width-item > label {
  margin: 0 0 4px;
  display: block;
  color: var(--muted);
  font-size: 0.58rem;
  font-weight: 750;
}

.lane-width-control {
  height: 36px;
}

.pending-control input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  color: #89928c;
  background: transparent;
  font-size: 0.69rem;
}

.pending-control span {
  color: var(--muted);
  font-size: 0.6rem;
}

.drawing-panel {
  overflow: hidden;
}

.drawing-heading {
  min-height: 72px;
  padding: 16px 19px 13px;
  align-items: center;
  border-bottom: 1px solid var(--line);
}

.layer-key {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 9px;
  color: var(--muted);
  font-size: 0.59rem;
}

.layer-key span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.key-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #a7b5ac;
}

.key-dot.current {
  background: var(--green-600);
}

.svg-stage {
  position: relative;
  min-height: 455px;
  height: clamp(470px, calc(100vh - 285px), 720px);
  overflow: hidden;
  background-color: var(--canvas);
  background-image:
    linear-gradient(rgb(30 73 52 / 4.5%) 1px, transparent 1px),
    linear-gradient(90deg, rgb(30 73 52 / 4.5%) 1px, transparent 1px),
    linear-gradient(rgb(30 73 52 / 2.5%) 1px, transparent 1px),
    linear-gradient(90deg, rgb(30 73 52 / 2.5%) 1px, transparent 1px);
  background-size: 40px 40px, 40px 40px, 10px 10px, 10px 10px;
}

#section-svg {
  width: 100%;
  height: 100%;
  display: block;
}

.centerline,
.datum-line {
  stroke: #8da095;
  stroke-width: 1;
  stroke-dasharray: 8 7;
}

.datum-line {
  stroke-dasharray: 3 4;
}

.section-layer {
  color: #8aa096;
  opacity: 0.18;
  transition: opacity 160ms ease;
}

.section-layer.is-active {
  color: var(--green-700);
  opacity: 1;
}

.section-layer[data-layer="clearance"].is-active {
  color: #72529a;
}

.section-layer[data-layer="ventilation"].is-active {
  color: #426b9b;
}

.section-layer[data-layer="utility"].is-active {
  color: #9a6333;
}

.section-layer[data-layer="lining"].is-active {
  color: #247666;
}

.section-layer[data-layer="drainage"].is-active {
  color: #347997;
}

.layer-line,
.fan-mark,
.lane-mark {
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
}

.layer-line.heavy {
  stroke-width: 4;
}

.layer-line.dashed {
  stroke-dasharray: 9 7;
}

.layer-fill {
  fill: currentColor;
  fill-opacity: 0.09;
  stroke: currentColor;
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
}

.road-slab {
  fill-opacity: 0.16;
}

.lane-mark {
  stroke-width: 1.4;
}

.dimension-preview {
  display: none;
}

.section-layer.is-active .dimension-preview {
  display: block;
}

#section-svg.has-road-model > .concept-reference {
  display: none;
}

.road-layer-shape {
  stroke: currentColor;
  stroke-width: 1.8;
  vector-effect: non-scaling-stroke;
}

.road-pavement-shape {
  fill: rgb(40 100 71 / 22%);
}

.road-filter-shape {
  fill: rgb(30 111 120 / 15%);
  stroke: var(--blueprint);
}

.road-top-line,
.road-lane-boundary {
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  vector-effect: non-scaling-stroke;
}

.road-lane-boundary {
  stroke-width: 1.1;
  stroke-dasharray: 5 4;
}

.road-model-centerline {
  stroke-width: 1.2;
  stroke-dasharray: 9 6;
  vector-effect: non-scaling-stroke;
}

.road-model-centerline.road-center {
  stroke: var(--green-700);
}

.road-model-centerline.tunnel-center {
  stroke: var(--blueprint);
}

.center-point {
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
}

.center-point.road-center {
  fill: var(--paper-strong);
  stroke: var(--green-700);
}

.center-point.tunnel-center {
  fill: var(--paper-strong);
  stroke: var(--blueprint);
}

.centerline-head {
  color: var(--green-700);
}

.centerline-head.tunnel-center {
  color: var(--blueprint);
}

.centerline-head circle {
  fill: var(--paper-strong);
  stroke: currentColor;
  stroke-width: 1.4;
  vector-effect: non-scaling-stroke;
}

.centerline-head text {
  fill: currentColor !important;
  font-size: 7.5px !important;
  font-weight: 850;
  letter-spacing: -0.3px;
}

.centerline-name {
  fill: var(--green-850) !important;
  font-size: 9px !important;
  font-weight: 800;
}

.centerline-name.tunnel-center {
  fill: var(--blueprint) !important;
}

.road-side-label,
.derived-value-label {
  font-weight: 750;
}

.road-side-label {
  fill: var(--muted) !important;
  font-size: 9px !important;
}

.derived-value-label {
  fill: var(--blueprint) !important;
  font-size: 9px !important;
}

.road-dimension {
  color: var(--green-700);
}

.svg-dim-control {
  width: max-content;
  max-width: 100%;
  height: 26px;
  padding: 2px 4px;
  display: grid;
  grid-template-columns: max-content 30px max-content;
  align-items: center;
  gap: 3px;
  border: 1px solid var(--green-600);
  border-radius: 7px;
  color: var(--green-950);
  background: rgb(255 255 255 / 96%);
  box-shadow: 0 3px 8px rgb(28 55 40 / 10%);
  font-family: inherit;
}

.svg-dim-control.has-error {
  border-color: var(--error);
  background: #fff3f2;
}

.svg-dim-control span,
.svg-dim-control b {
  font-size: 8px;
  white-space: nowrap;
}

.svg-dim-control b {
  color: var(--muted);
}

.svg-dim-control input {
  width: 30px;
  min-width: 30px;
  padding: 2px 1px;
  border: 0;
  border-bottom: 1px solid #a9bdb0;
  border-radius: 0;
  outline: 0;
  color: var(--green-950);
  background: transparent;
  font-size: 9px;
  font-weight: 800;
  text-align: center;
}

.lane-dim-control {
  grid-template-columns: max-content 27px max-content;
}

.lane-dim-control input {
  width: 27px;
  min-width: 27px;
}

.svg-dim-control input:focus {
  border-bottom-color: var(--green-600);
}

.dimension-line,
.extension-line {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.2;
  vector-effect: non-scaling-stroke;
}

.dimension-line {
  marker-start: url(#dimension-arrow);
  marker-end: url(#dimension-arrow);
}

.extension-line {
  stroke-dasharray: 3 3;
  opacity: 0.7;
}

.dimension-box {
  fill: var(--paper-strong);
  stroke: currentColor;
  stroke-width: 1;
}

#section-svg text {
  fill: var(--ink);
  font-family: inherit;
  font-size: 11px;
}

.axis-label {
  fill: var(--muted) !important;
  font-size: 10px !important;
}

.drawing-empty-state {
  position: absolute;
  left: 50%;
  bottom: 18px;
  translate: -50% 0;
  min-width: min(360px, calc(100% - 28px));
  padding: 10px 13px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid rgb(30 73 52 / 13%);
  border-radius: 11px;
  background: rgb(255 255 255 / 88%);
  box-shadow: 0 7px 18px rgb(31 57 42 / 9%);
  backdrop-filter: blur(8px);
}

.empty-icon {
  width: 38px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 1px solid var(--green-200);
  border-radius: 7px;
  color: var(--green-700);
  background: var(--green-100);
  font-size: 0.57rem;
  font-weight: 900;
  letter-spacing: 0.06em;
}

.drawing-empty-state strong,
.drawing-empty-state small {
  display: block;
}

.drawing-empty-state strong {
  font-size: 0.7rem;
}

.drawing-empty-state small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.58rem;
}

.drawing-footer {
  min-height: 39px;
  padding: 9px 16px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.59rem;
}

.progress-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.progress-list li {
  border-top: 1px solid var(--line);
}

.progress-list li:last-child {
  border-bottom: 1px solid var(--line);
}

.progress-list button {
  width: 100%;
  padding: 11px 3px;
  display: grid;
  grid-template-columns: 34px 1fr auto;
  align-items: center;
  gap: 8px;
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.progress-list button:hover {
  background: #f2f7f3;
}

.progress-number {
  color: var(--green-600);
  font-size: 0.66rem;
  font-weight: 850;
}

.progress-list strong,
.progress-list small {
  display: block;
}

.progress-list strong {
  font-size: 0.7rem;
}

.progress-list small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.54rem;
}

.progress-state {
  color: #9aa69e;
  font-size: 0.52rem;
  font-weight: 850;
  letter-spacing: 0.06em;
}

.progress-list li.is-active button {
  margin: 6px 0;
  padding-inline: 8px;
  border-radius: 9px;
  background: var(--green-100);
}

.progress-list li.is-active .progress-state {
  color: var(--green-700);
}

.next-decision {
  margin-top: 18px;
  padding: 14px;
  border: 1px solid #cfdad2;
  border-radius: 12px;
  background: #f3f7f4;
}

.next-decision p:last-child {
  margin: 0;
  color: var(--muted);
  font-size: 0.63rem;
  line-height: 1.5;
}

.app-footer {
  min-height: 40px;
  padding: 0 clamp(15px, 2.7vw, 42px) 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  color: var(--muted);
  font-size: 0.59rem;
}

@media (max-width: 1180px) {
  .workspace {
    grid-template-columns: minmax(235px, 0.76fr) minmax(480px, 1.7fr);
  }

  .progress-panel {
    grid-column: 1 / -1;
  }

  .progress-list {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 820px) {
  .app-header {
    grid-template-columns: max-content max-content;
    justify-content: start;
  }

  .header-status {
    display: none;
  }

  .workspace {
    grid-template-columns: minmax(0, 1fr);
  }

  .parameter-panel {
    grid-row: 2;
    grid-column: auto;
  }

  .drawing-panel {
    grid-row: 1;
  }

  .progress-panel {
    grid-row: 3;
    grid-column: auto;
  }

  .svg-stage {
    height: 430px;
    min-height: 430px;
  }
}

@media (max-width: 580px) {
  .app-header {
    padding-block: 10px;
    align-items: start;
  }

  .brand-copy small {
    display: none;
  }

  .stage-heading {
    padding-right: 10px;
  }

  .stage-heading small {
    display: none;
  }

  .stage-number {
    width: 30px;
    height: 30px;
  }

  .section-tabs {
    padding-inline: 10px;
  }

  .tab-order-note {
    text-align: left;
  }

  .workspace {
    padding: 10px;
  }

  .panel {
    border-radius: 15px;
  }

  .drawing-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .layer-key {
    justify-content: flex-start;
  }

  .svg-stage {
    min-height: 340px;
    height: 340px;
    overflow-x: auto;
    overflow-y: hidden;
  }

  #section-svg {
    width: 520px;
    min-width: 520px;
  }

  .drawing-footer {
    align-items: flex-start;
    flex-direction: column;
  }

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

  .app-footer {
    align-items: flex-start;
    flex-direction: column;
  }
}

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