:root {
  --bg: #f2f2f7;
  --surface: #fff;
  --surface-2: #f7f7fa;
  --fill: rgba(118,118,128,.12);
  --fill-strong: rgba(118,118,128,.2);
  --separator: rgba(60,60,67,.13);
  --label: #1c1c1e;
  --secondary: #636366;
  --tertiary: #8e8e93;
  --action: #1c1c1e;
  --green: #23864b;
  --red: #d33832;
  --yellow: #d49a08;
  --magenta: #d12c91;
  --radius-xl: 32px;
  --radius-lg: 24px;
  --radius-md: 16px;
  --shadow: 0 18px 55px rgba(0,0,0,.07);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { min-width: 320px; color-scheme: light; background: var(--bg); }
body {
  min-width: 320px;
  min-height: 100dvh;
  margin: 0;
  color: var(--label);
  background: var(--bg);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Apple SD Gothic Neo", "Pretendard", sans-serif;
  letter-spacing: -.018em;
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible, [tabindex]:focus-visible {
  outline: 3px solid rgba(28,28,30,.22);
  outline-offset: 3px;
}
.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0,0,0,0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.app-shell { min-height: 100dvh; background: radial-gradient(circle at 50% -180px, rgba(255,255,255,.96), transparent 520px), var(--bg); }
.launch-screen {
  position: fixed;
  z-index: 1000;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 16px;
  background: var(--bg);
}
.launch-screen > span { width: 72px; height: 72px; display: grid; place-items: center; border-radius: 22px; background: var(--action); color: #fff; box-shadow: 0 18px 48px rgba(0,0,0,.14); font-size: 28px; font-weight: 760; }
.launch-screen p { margin: 0; color: var(--secondary); font-size: 14px; font-weight: 620; }
.app-shell[aria-busy="true"] > :not(.launch-screen) { visibility: hidden; }

.app-header { position: sticky; z-index: 80; top: 0; height: 72px; border-bottom: 1px solid rgba(60,60,67,.08); background: rgba(247,247,249,.84); backdrop-filter: saturate(180%) blur(24px); -webkit-backdrop-filter: saturate(180%) blur(24px); }
.header-inner { width: min(1120px, calc(100% - 32px)); height: 100%; margin: 0 auto; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 20px; }
.wordmark { min-height: 48px; width: max-content; padding: 0; display: flex; align-items: center; gap: 10px; border: 0; background: transparent; color: var(--label); }
.wordmark strong { font-size: 15px; font-weight: 680; letter-spacing: -.035em; }
.brand-mark { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 11px; background: var(--action); color: #fff; font-size: 16px; font-weight: 760; }
.tabbar { min-height: 44px; padding: 4px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 3px; border-radius: 14px; background: var(--fill); }
.tabbar button { min-width: 82px; min-height: 36px; padding: 0 13px; display: flex; align-items: center; justify-content: center; gap: 7px; border: 0; border-radius: 11px; background: transparent; color: var(--secondary); font-size: 13px; font-weight: 620; }
.tabbar button.active { color: var(--label); background: #fff; box-shadow: 0 2px 7px rgba(0,0,0,.08); }
.tabbar svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.85; stroke-linecap: round; stroke-linejoin: round; }
.system-state { min-height: 44px; margin-left: auto; display: flex; align-items: center; gap: 7px; color: var(--secondary); font-size: 12px; }
.system-state b { color: var(--label); font-weight: 650; }

.status { width: 9px; height: 9px; display: inline-block; flex: none; border-radius: 50%; background: var(--tertiary); }
.status.normal { background: var(--green); }
.status.fault { background: var(--red); }
.status.suspect { background: var(--yellow); }
.status.unknown { background: var(--tertiary); }
.line { width: 28px; height: 3px; display: inline-block; border-radius: 99px; background: #111; }
.line.digital { background: var(--magenta); }

.app-content { min-height: calc(100dvh - 72px); }
.view { display: none; }
.view.active { display: block; animation: view-in .2s ease; }
@keyframes view-in { from { opacity: .45; transform: translateY(5px); } }
.primary, .secondary, .danger-button { min-height: 48px; padding: 0 18px; border-radius: 15px; font-size: 14px; font-weight: 680; letter-spacing: -.02em; }
.primary { border: 1px solid var(--action); background: var(--action); color: #fff; }
.primary:hover { background: #333336; }
.primary:disabled { border-color: #d1d1d6; background: #d1d1d6; color: #fff; }
.secondary { border: 1px solid var(--separator); background: var(--surface); color: var(--label); }
.secondary:hover { background: var(--surface-2); }
.danger-button { border: 1px solid var(--red); background: var(--red); color: #fff; }
.danger-button:hover { background: #ad2824; }

/* 장애: 첫 화면은 하나의 질문만 남긴다. */
.diagnosis-view { width: min(960px, calc(100% - 40px)); margin: 0 auto; padding: 68px 0 120px; }
.diagnosis-hero { width: min(790px, 100%); margin: 0 auto; text-align: center; }
.hero-meta { min-height: 44px; margin-bottom: 20px; display: flex; align-items: center; justify-content: center; gap: 14px; color: var(--secondary); font-size: 13px; font-weight: 600; }
.hero-meta p { margin: 0; display: flex; align-items: center; gap: 8px; }
.hero-meta > span::before { content: ""; width: 1px; height: 13px; margin-right: 14px; display: inline-block; vertical-align: -2px; background: var(--separator); }
.diagnosis-hero h1 { margin: 0; color: var(--label); font-size: clamp(58px,8.3vw,92px); font-weight: 700; line-height: .92; letter-spacing: -.045em; opacity: 1; transform: translateY(0); transition: opacity .36s ease, transform .36s ease; }
.diagnosis-hero h1.is-changing { opacity: 0; transform: translateY(8px); }
.diagnosis-hero h1 .hero-greeting-primary { color: var(--label); font-weight: 700; letter-spacing: -.045em; }
.diagnosis-hero h1 .hero-greeting-secondary { color: var(--tertiary); font-weight: 760; letter-spacing: -.075em; }
.diagnosis-hero > p { margin: 26px auto 30px; color: var(--secondary); font-size: 17px; line-height: 1.65; word-break: keep-all; }
.question-bar { width: min(720px,100%); min-height: 72px; margin: 0 auto; padding: 7px 8px 7px 24px; display: grid; grid-template-columns: minmax(0,1fr) 112px; align-items: center; gap: 10px; border: 1px solid rgba(60,60,67,.08); border-radius: 24px; background: var(--surface); box-shadow: 0 16px 48px rgba(0,0,0,.09); }
.question-bar:focus-within { border-color: rgba(28,28,30,.22); box-shadow: 0 18px 54px rgba(0,0,0,.11); }
.question-bar input { width: 100%; min-height: 56px; padding: 0; border: 0; outline: 0; background: transparent; color: var(--label); font-size: 17px; }
.question-bar input::placeholder { color: #9a9a9f; }
.question-bar button { width: 112px; height: 56px; border: 0; border-radius: 18px; background: var(--action); color: #fff; font-size: 14px; font-weight: 650; }
.question-bar button:disabled { background: #d1d1d6; }
.question-bar.has-answer button:not(:disabled) { background: var(--fill); color: var(--label); }
.quick-questions { margin-top: 13px; display: flex; justify-content: center; gap: 8px; }
.quick-questions button { min-height: 44px; padding: 0 14px; flex: none; border: 0; border-radius: 999px; background: var(--fill); color: var(--secondary); font-size: 13px; font-weight: 590; }
.quick-questions button:hover { color: var(--label); background: var(--fill-strong); }
.setup-callout { width: min(720px,100%); min-height: 70px; margin: 26px auto 0; padding: 10px 12px 10px 18px; display: flex; align-items: center; justify-content: space-between; gap: 16px; border-radius: 20px; background: rgba(255,255,255,.68); }
.setup-callout > div { min-width: 0; display: flex; align-items: center; gap: 11px; }
.setup-callout p { margin: 0; display: grid; gap: 2px; text-align: left; }
.setup-callout b { font-size: 14px; }
.setup-callout small { color: var(--secondary); font-size: 12px; }
.setup-callout button { min-height: 44px; padding: 0 15px; flex: none; border: 0; border-radius: 14px; background: var(--fill); color: var(--label); font-size: 13px; font-weight: 660; }
.answer-card { width: min(760px,100%); margin: 30px auto 0; overflow: hidden; border-radius: var(--radius-xl); background: var(--surface); box-shadow: var(--shadow); }
.answer-card > header { padding: 30px 30px 24px; border-bottom: 1px solid var(--separator); }
.answer-card > header > span { min-height: 28px; padding: 0 10px; display: inline-flex; align-items: center; border-radius: 999px; background: var(--fill); color: var(--secondary); font-size: 12px; font-weight: 650; }
.answer-card > header p { margin: 15px 0 8px; color: var(--secondary); font-size: 14px; }
.answer-card > header h2 { margin: 0 0 7px; font-size: 30px; letter-spacing: -.04em; }
.answer-card > header strong { color: var(--secondary); font-size: 15px; font-weight: 520; line-height: 1.55; }
.first-check, .needed { padding: 22px 30px; border-bottom: 1px solid var(--separator); }
.first-check > p, .needed h3 { margin: 0 0 10px; color: var(--secondary); font-size: 13px; font-weight: 650; }
.first-check button { width: 100%; min-height: 66px; padding: 10px 0; display: grid; grid-template-columns: 38px minmax(0,1fr) auto 18px; align-items: center; gap: 10px; border: 0; background: transparent; color: var(--label); text-align: left; }
.first-check button > span { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 11px; background: var(--action); color: #fff; font-size: 13px; font-weight: 700; }
.first-check button b { font-size: 16px; }
.first-check button em { color: var(--secondary); font-size: 12px; font-style: normal; }
.first-check button i { color: var(--tertiary); font-size: 22px; font-style: normal; }
.needed div { display: grid; gap: 9px; }
.needed p { margin: 0; display: flex; align-items: flex-start; gap: 10px; color: var(--secondary); font-size: 14px; line-height: 1.5; }
.needed p::before { content: ""; width: 6px; height: 6px; margin-top: 7px; flex: none; border-radius: 50%; background: var(--tertiary); }
.answer-actions { padding: 18px 30px; display: flex; gap: 9px; border-bottom: 1px solid var(--separator); }
.answer-actions .primary { flex: 1; }
.disclosure { border-top: 1px solid var(--separator); }
.disclosure:first-child { border-top: 0; }
.disclosure > summary { min-height: 56px; padding: 0 30px; display: flex; align-items: center; justify-content: space-between; cursor: pointer; list-style: none; font-size: 14px; font-weight: 640; }
.disclosure > summary::-webkit-details-marker { display: none; }
.disclosure > summary::after { content: "›"; color: var(--tertiary); font-size: 24px; transition: transform .18s ease; }
.disclosure[open] > summary::after { transform: rotate(90deg); }
.disclosure-body, .safety-copy, .work-log-form { padding: 0 30px 24px; }
.disclosure-body { display: grid; gap: 18px; }
.disclosure-body h3 { margin: 0 0 6px; font-size: 14px; }
.disclosure-body p { margin: 0; color: var(--secondary); font-size: 14px; line-height: 1.55; }
.safety-copy { display: grid; gap: 15px; }
.safety-copy p { margin: 0; display: grid; grid-template-columns: 150px 1fr; gap: 14px; font-size: 13px; line-height: 1.5; }
.safety-copy span, .safety-copy small { color: var(--secondary); }
.work-log-form { display: grid; gap: 14px; }
.work-log-form label, .apply-fields label, .sheet-modal > form > label { display: grid; gap: 7px; color: var(--secondary); font-size: 13px; font-weight: 620; }
.work-log-form input, .work-log-form textarea, .apply-fields input, .sheet-modal > form > label input { width: 100%; min-height: 48px; padding: 11px 13px; border: 0; border-radius: 14px; background: var(--surface-2); color: var(--label); font-size: 16px; }
.work-log-form textarea { min-height: 92px; resize: vertical; }

/* 공통 큰 제목 */
.page-title { min-height: 126px; display: flex; align-items: flex-end; justify-content: space-between; gap: 28px; }
.page-title p, .setup-hero > p, .review-top > div:first-child > p { margin: 0 0 7px; color: var(--secondary); font-size: 14px; font-weight: 650; }
.page-title h1, .setup-hero h1, .review-top h1 { margin: 0; font-size: clamp(44px,5.4vw,60px); font-weight: 760; line-height: .96; letter-spacing: -.06em; }
.page-title span, .setup-hero > span, .review-top > div:first-child > span { display: block; margin-top: 10px; color: var(--secondary); font-size: 16px; line-height: 1.55; }

/* 설비 */
.map-view { width: min(1040px,calc(100% - 40px)); margin: 0 auto; padding: 46px 0 120px; }
.map-card { position: relative; margin-top: 28px; overflow: hidden; border-radius: var(--radius-xl); background: var(--surface); box-shadow: var(--shadow); }
.map-head { min-height: 110px; padding: 22px 26px 18px; display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; border-bottom: 1px solid var(--separator); }
.map-head span { color: var(--secondary); font-size: 12px; font-weight: 620; }
.map-head h2 { margin: 2px 0 4px; font-size: 28px; }
.map-head p { margin: 0; color: var(--secondary); font-size: 13px; }
.map-count { display: flex; gap: 8px; }
.map-count span { min-height: 36px; padding: 0 11px; display: flex; align-items: center; gap: 5px; border-radius: 12px; background: var(--fill); }
.map-count b { color: var(--label); }
.location-tabs { padding: 12px 18px; display: flex; gap: 7px; overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid var(--separator); }
.location-tabs::-webkit-scrollbar, .quick-questions::-webkit-scrollbar { display: none; }
.location-tabs button { min-height: 44px; padding: 0 15px; flex: none; border: 0; border-radius: 999px; background: transparent; color: var(--secondary); font-size: 13px; font-weight: 620; }
.location-tabs button.active { background: var(--action); color: #fff; }
.map-surface { min-height: 520px; margin: 10px; overflow: auto; border-radius: 24px; background: #f7f7f9; }
.map-world { position: relative; width: 100%; min-width: 720px; height: 520px; transform-origin: center; transition: transform .18s ease; }
.map-lines { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.map-lines path { fill: none; stroke: #111; stroke-width: 3; }
.map-lines path.digital { stroke: var(--magenta); }
.map-lines path.hit { stroke: transparent; stroke-width: 18; marker-end: none; pointer-events: stroke; }
.map-lines marker path { fill: #111; stroke: none; }
.map-lines marker[id^="arrowDigital"] path { fill: var(--magenta); }
.map-lines g { cursor: pointer; pointer-events: auto; }
.map-lines g.selected path:not(.hit) { stroke-width: 7; }
.map-lines g:focus-visible path:not(.hit) { stroke-width: 7; }
.map-node { position: absolute; width: 150px; min-height: 82px; padding: 12px; transform: translate(-50%,-50%); display: grid; grid-template-columns: 10px 1fr; gap: 9px; align-items: start; border: 2px solid rgba(28,28,30,.18); border-radius: 18px; background: rgba(255,255,255,.96); box-shadow: 0 8px 24px rgba(0,0,0,.08); color: var(--label); text-align: left; }
.map-node.selected { border-color: var(--label); box-shadow: 0 0 0 3px rgba(28,28,30,.12), 0 12px 30px rgba(0,0,0,.12); }
.map-node b { display: block; overflow-wrap: anywhere; font-size: 13px; line-height: 1.3; }
.map-node small { display: block; margin-top: 5px; color: var(--secondary); font-size: 11px; }
.map-node.offpage { border-style: dashed; background: #fafafa; }
.map-footer { min-height: 66px; padding: 9px 18px 12px; display: flex; align-items: center; justify-content: space-between; gap: 18px; border-top: 1px solid var(--separator); }
.map-footer details > summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; color: var(--secondary); font-size: 13px; font-weight: 620; }
.legend { padding: 5px 0 10px; display: flex; flex-wrap: wrap; gap: 12px; }
.legend span { display: inline-flex; align-items: center; gap: 7px; color: var(--secondary); font-size: 12px; }
.map-controls { display: flex; align-items: center; gap: 7px; }
.map-controls > span { min-width: 100px; color: var(--secondary); font-size: 12px; text-align: right; }
.map-controls button { min-width: 44px; height: 44px; border: 0; border-radius: 13px; background: var(--fill); color: var(--label); }
.map-controls b { min-width: 45px; color: var(--secondary); font-size: 12px; text-align: center; }
.detail-sheet { position: absolute; z-index: 12; top: 12px; right: 12px; bottom: 78px; width: min(360px,calc(100% - 24px)); padding: 20px; overflow-y: auto; border-radius: 24px; background: rgba(255,255,255,.96); box-shadow: 0 24px 80px rgba(0,0,0,.18); backdrop-filter: blur(20px); }
.sheet-head { min-height: 44px; display: flex; align-items: center; justify-content: space-between; }
.sheet-head span { color: var(--secondary); font-size: 12px; font-weight: 620; }
.sheet-head button { width: 44px; height: 44px; border: 0; border-radius: 50%; background: var(--fill); color: var(--label); font-size: 22px; }
.detail-sheet h3 { margin: 14px 0 3px; font-size: 24px; }
.detail-sheet .state-line { display: flex; align-items: center; gap: 7px; color: var(--secondary); font-size: 13px; }
.detail-section { padding: 18px 0; border-top: 1px solid var(--separator); }
.detail-section h4 { margin: 0 0 6px; font-size: 14px; }
.detail-section p { margin: 0; color: var(--secondary); font-size: 14px; line-height: 1.55; }
.technical-info summary { min-height: 44px; cursor: pointer; color: var(--secondary); font-size: 13px; }
.technical-info code { display: block; margin: 5px 0; overflow-wrap: anywhere; color: var(--tertiary); font-size: 11px; }

/* 검수 시작 */
.review-view { width: min(1040px,calc(100% - 40px)); margin: 0 auto; padding: 54px 0 130px; }
#reviewIntro { width: min(700px,100%); margin: 0 auto; }
.setup-hero { text-align: center; }
.setup-hero h1 { font-size: clamp(48px,7vw,70px); }
.setup-hero > span { max-width: 500px; margin: 18px auto 0; }
.protected-note { min-height: 70px; margin: 28px auto 0; padding: 13px 18px; display: flex; align-items: center; gap: 12px; border-radius: 20px; background: rgba(255,255,255,.68); }
.protection-mark { width: 28px; height: 28px; display: grid; flex: none; place-items: center; border-radius: 9px; background: var(--fill); color: var(--label); font-size: 13px; font-style: normal; font-weight: 740; }
.protected-note p { margin: 0; display: grid; gap: 3px; }
.protected-note b { font-size: 14px; }
.protected-note small { color: var(--secondary); font-size: 12px; }
.setup-steps { margin: 18px 0 0; padding: 0 20px; overflow: hidden; border-radius: var(--radius-lg); background: var(--surface); list-style: none; }
.setup-steps li { min-height: 86px; display: grid; grid-template-columns: 42px 1fr; align-items: center; gap: 13px; border-bottom: 1px solid var(--separator); }
.setup-steps li:last-child { border-bottom: 0; }
.setup-steps li > b { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 12px; background: var(--fill); color: var(--secondary); font-size: 13px; }
.setup-steps strong { display: block; font-size: 16px; }
.setup-steps span { display: block; margin-top: 4px; color: var(--secondary); font-size: 13px; }
.setup-actions { margin-top: 18px; display: grid; gap: 9px; }
.technical-contract { margin-top: 18px; overflow: hidden; border: 0; border-radius: 20px; background: rgba(255,255,255,.55); }
.technical-contract p { margin: 0; padding: 0 30px 22px; color: var(--secondary); font-size: 13px; line-height: 1.55; }

/* 자료 첨부 */
.intake-title { margin-bottom: 22px; }
.stage-line { width: min(620px,100%); min-height: 48px; margin: 0 auto 18px; padding: 0 10px; display: flex; align-items: center; justify-content: center; gap: 9px; color: var(--secondary); }
.stage-line b { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 9px; background: var(--fill); font-size: 12px; }
.stage-line b:first-child { background: var(--action); color: #fff; }
.stage-line span { font-size: 12px; font-weight: 620; }
.stage-line i { width: 24px; height: 1px; background: var(--separator); }
.dropzone { min-height: 330px; padding: 34px 22px; display: grid; place-content: center; justify-items: center; border: 0; border-radius: var(--radius-xl); background: var(--surface); box-shadow: var(--shadow); text-align: center; transition: transform .18s ease, background .18s ease; }
.dropzone.dragging { transform: scale(.992); background: #ececef; }
.dropzone input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.file-icon { width: 70px; height: 70px; display: grid; place-items: center; border-radius: 22px; background: var(--fill); color: var(--label); font-size: 32px; font-weight: 300; }
.dropzone strong { margin-top: 20px; font-size: 22px; }
.dropzone p { margin: 8px 0 0; color: var(--secondary); font-size: 14px; }
.dropzone small { margin-top: 6px; color: var(--tertiary); font-size: 12px; }
.dropzone em { min-height: 46px; margin-top: 20px; padding: 0 18px; display: inline-flex; align-items: center; border-radius: 14px; background: var(--action); color: #fff; font-size: 14px; font-style: normal; font-weight: 660; }
.batch-status { min-height: 56px; margin-top: 14px; padding: 0 18px; display: flex; align-items: center; border-radius: 18px; background: rgba(255,255,255,.66); color: var(--secondary); font-size: 14px; }
.file-card { margin-top: 14px; overflow: hidden; border-radius: var(--radius-lg); background: var(--surface); }
#intakeStage.has-files .intake-title,
#intakeStage.has-files .stage-line,
#intakeStage.has-files .dropzone,
#intakeStage.has-files .batch-status,
#intakeStage.has-files .intake-details,
#intakeStage.has-files .product-upload-status { display: none !important; }
#intakeStage.has-files .file-card { margin-top: 0; }
.file-card > header { min-height: 62px; padding: 0 20px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--separator); }
.file-card h2 { margin: 0; font-size: 17px; }
.file-card header span { color: var(--secondary); font-size: 13px; }
.file-row { min-height: 74px; margin: 0 20px; display: grid; grid-template-columns: 44px minmax(0,1fr) auto; align-items: center; gap: 13px; border-bottom: 1px solid var(--separator); }
.file-row:last-child { border-bottom: 0; }
.file-row > span { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 13px; background: var(--fill); color: var(--secondary); font-size: 10px; font-weight: 700; }
.file-row b { display: block; overflow-wrap: anywhere; font-size: 14px; }
.file-row small { display: block; margin-top: 3px; color: var(--secondary); font-size: 12px; }
.file-row em { padding: 6px 9px; border-radius: 9px; background: var(--fill); color: var(--secondary); font-size: 11px; font-style: normal; }
.file-row > div:last-child { display: grid; justify-items: end; gap: 6px; }
.file-row > div:last-child button { min-height: 44px; padding: 0 8px; border: 0; background: transparent; color: var(--red); font-size: 12px; }
.intake-details { margin-top: 14px; overflow: hidden; border: 0; border-radius: 20px; background: rgba(255,255,255,.62); }
.intake-details > div { padding: 0 22px 20px; display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; }
.intake-details p { margin: 0; padding: 14px; border-radius: 16px; background: rgba(255,255,255,.75); }
.intake-details b, .intake-details span { display: block; }
.intake-details b { font-size: 13px; }
.intake-details span { margin-top: 5px; color: var(--secondary); font-size: 12px; line-height: 1.5; }
.flow-footer, .review-footer { position: fixed; z-index: 60; left: 0; right: 0; bottom: 0; min-height: 82px; padding: 11px max(20px,calc((100vw - 1040px)/2)); display: flex; align-items: center; justify-content: space-between; gap: 18px; border-top: 1px solid var(--separator); background: rgba(248,248,250,.91); backdrop-filter: saturate(180%) blur(24px); }
.flow-footer p { color: var(--secondary); font-size: 13px; }

/* AI 분석 진행 */
.analysis-stage { width: min(820px,100%); margin: 0 auto; padding: 58px 0 24px; text-align: center; }
.analysis-hero > p { margin: 0 0 12px; color: var(--secondary); font-size: 15px; font-weight: 650; }
.analysis-hero h1 { margin: 0; font-size: clamp(42px,5vw,56px); font-weight: 760; line-height: 1.02; letter-spacing: -.055em; }
.analysis-hero > span { display: block; margin-top: 20px; color: var(--secondary); font-size: 16px; line-height: 1.55; }
.analysis-card { width: min(720px,100%); margin: 38px auto 0; padding: 38px 52px 12px; border-radius: var(--radius-xl); background: var(--surface); box-shadow: var(--shadow); text-align: left; }
.analysis-count { min-height: 86px; display: flex; align-items: center; gap: 36px; }
.analysis-count p { margin: 0; display: flex; align-items: baseline; gap: 12px; }
.analysis-count strong { color: var(--label); font-size: 58px; font-weight: 760; line-height: 1; letter-spacing: -.055em; }
.analysis-count span { color: var(--label); font-size: 24px; font-weight: 700; }
.analysis-count b { font: inherit; }
.analysis-spinner { width: 50px; height: 50px; flex: none; border: 7px dotted #c7c7cc; border-top-color: var(--secondary); border-radius: 50%; animation: analysis-spin 1.1s linear infinite; }
.analysis-track { height: 9px; margin: 2px 0 32px; overflow: hidden; border-radius: 99px; background: var(--fill-strong); }
.analysis-track > i { width: 0; height: 100%; display: block; border-radius: inherit; background: var(--action); transition: width .5s ease; }
.analysis-steps { margin: 0; padding: 0; list-style: none; }
.analysis-steps li { min-height: 76px; display: grid; grid-template-columns: 44px minmax(0,1fr) auto; align-items: center; gap: 14px; border-top: 1px solid var(--separator); }
.analysis-steps li > i { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; background: var(--fill); font-style: normal; }
.analysis-steps li > b { font-size: 16px; }
.analysis-steps li > span { color: var(--secondary); font-size: 15px; font-weight: 620; }
.analysis-steps li.is-complete > i::after { content: "✓"; color: var(--label); font-size: 17px; font-weight: 760; }
.analysis-steps li.is-active > i { border: 4px dotted #a8a8ad; background: transparent; animation: analysis-spin 1.1s linear infinite; }
.analysis-steps li.is-waiting > i::after { content: ""; width: 16px; height: 16px; border-radius: 50%; background: #c7c7cc; }
.analysis-guard { margin: 34px auto 0; display: flex; align-items: center; justify-content: center; gap: 12px; color: var(--label); }
.analysis-guard svg { width: 25px; height: 25px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.analysis-guard p { margin: 0; text-align: left; }
.analysis-guard b, .analysis-guard span { display: block; }
.analysis-guard b { font-size: 14px; }
.analysis-guard span { margin-top: 7px; color: var(--tertiary); font-size: 13px; text-align: center; }
.analysis-test-actions { margin-top: 42px; display: flex; align-items: center; justify-content: center; gap: 10px; }
.analysis-test-actions .primary { min-width: 124px; }
.analysis-cancel { min-height: 44px; padding: 0 16px; border: 0; background: transparent; color: var(--secondary); font-size: 14px; font-weight: 620; }
@keyframes analysis-spin { to { transform: rotate(360deg); } }

/* AI 위치 분류 결과 */
.location-classification-stage { width: min(720px,100%); margin: 0 auto; padding: 58px 0 118px; }
.classification-hero { text-align: center; }
.classification-hero > p { margin: 0 0 12px; color: var(--secondary); font-size: 14px; font-weight: 650; }
.classification-hero h1 { margin: 0; font-size: clamp(40px,5vw,54px); font-weight: 760; line-height: 1.04; letter-spacing: -.055em; }
.classification-hero > span { display: block; margin-top: 18px; color: var(--secondary); font-size: 15px; line-height: 1.6; }
.ios-location-sheet { margin-top: 36px; overflow: hidden; border-radius: 24px; background: var(--surface); box-shadow: var(--shadow); }
.ios-location-sheet > header { min-height: 54px; padding: 10px 18px 6px 22px; display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--secondary); font-size: 12px; font-weight: 650; }
.ios-location-sheet > header > div { display: flex; align-items: center; gap: 4px; }
.ios-location-sheet > header button { min-height: 44px; padding: 0 4px 0 12px; border: 0; background: transparent; color: #007aff; font-size: 13px; font-weight: 650; }
.ios-location-row { min-height: 72px; margin-left: 20px; padding: 10px 18px 10px 0; display: grid; grid-template-columns: 44px minmax(0,1fr) auto; align-items: center; gap: 13px; border-bottom: 1px solid var(--separator); }
.ios-location-row.is-managing { margin-left: 16px; grid-template-columns: 44px 44px minmax(0,1fr) auto; gap: 11px; }
.ios-location-row:last-child { border-bottom: 0; }
.ios-location-row > .remove-location { width: 44px; min-height: 44px; padding: 0; display: grid; place-items: center; border: 0; border-radius: 50%; background: #ff3b30; color: #fff; font-size: 22px; font-weight: 500; line-height: 1; }
.ios-location-row > i { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 13px; background: var(--fill); color: var(--label); font-size: 18px; font-style: normal; }
.ios-location-row.root > i { background: var(--action); color: #fff; }
.ios-location-row h3 { margin: 0; font-size: 17px; font-weight: 680; }
.ios-location-row .edit-location { min-height: 44px; padding: 0 4px 0 12px; border: 0; background: transparent; color: #007aff; font-size: 13px; font-weight: 620; }
.ios-location-row .confirm-remove-location { min-height: 44px; padding: 0 14px; border: 0; border-radius: 10px; background: #ff3b30; color: #fff; font-size: 13px; font-weight: 680; }
.ios-location-row .location-name-field { width: 100%; min-height: 44px; padding: 0 12px; border: 1px solid rgba(0,122,255,.7); border-radius: 11px; background: var(--surface); color: var(--label); font-size: 16px; font-weight: 680; }
.classification-note { margin: 20px 0 0; color: var(--secondary); font-size: 13px; text-align: center; }
.classification-footer .classification-later { min-height: 44px; padding: 0 10px; border: 0; background: transparent; color: var(--secondary); font-size: 13px; font-weight: 620; }
.classification-footer > .primary { min-width: 138px; }

/* AI 초안에서 사람이 판단할 내용만 확인 */
.draft-stage { width: min(720px,100%); margin: 0 auto; padding: 58px 0 118px; }
.draft-hero { text-align: center; }
.draft-hero > p { margin: 0; color: var(--secondary); font-size: 14px; font-weight: 650; }
.draft-hero h1 { margin: 9px 0 0; font-size: clamp(42px,5vw,58px); font-weight: 760; line-height: 1; letter-spacing: -.055em; }
.draft-hero > span { display: block; margin-top: 15px; color: var(--secondary); font-size: 15px; line-height: 1.55; }
.draft-result-card { margin-top: 34px; overflow: hidden; border-radius: var(--radius-xl); background: var(--surface); box-shadow: var(--shadow); }
.draft-result-summary { min-height: 92px; padding: 18px 22px; display: flex; align-items: center; justify-content: space-between; gap: 20px; border-bottom: 1px solid var(--separator); }
.draft-result-summary span, .draft-result-summary strong { display: block; }
.draft-result-summary span { color: var(--secondary); font-size: 12px; }
.draft-result-summary strong { margin-top: 5px; font-size: 18px; }
.draft-result-summary p { margin: 0; color: var(--secondary); font-size: 12px; }
.draft-result-summary i { width: 24px; height: 24px; margin-right: 5px; display: inline-grid; place-items: center; border-radius: 50%; background: var(--fill); color: var(--label); font-style: normal; }
.draft-question-list { display: grid; }
.draft-question-list:empty::before { content: "중요한 충돌 확인을 마쳤어요."; min-height: 92px; padding: 22px; display: grid; place-items: center; color: var(--secondary); font-size: 14px; }
.draft-question-card { padding: 24px 22px 22px; }
.draft-question-card + .draft-question-card { border-top: 1px solid var(--separator); }
.draft-question-card > header { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.draft-question-card > header span { color: var(--secondary); font-size: 12px; font-weight: 650; }
.draft-question-card h2 { margin: 5px 0 0; font-size: 23px; letter-spacing: -.025em; }
.draft-question-card > header > b { flex: none; color: var(--secondary); font-size: 12px; }
.draft-question-card > p { margin: 14px 0 0; color: var(--secondary); font-size: 14px; line-height: 1.55; }
.draft-comparison { margin-top: 18px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.draft-comparison > span { min-height: 70px; padding: 13px 14px; display: grid; align-content: center; gap: 5px; border-radius: 15px; background: var(--surface-2); }
.draft-comparison small { color: var(--secondary); font-size: 11px; }
.draft-comparison b { font-size: 15px; }
.draft-comparison em { overflow-wrap: anywhere; color: var(--secondary); font-size: 10px; font-style: normal; line-height: 1.35; }
.draft-answer-options { margin-top: 18px; display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }
.draft-answer-options button { min-height: 48px; padding: 0 14px; border: 0; border-radius: 14px; background: var(--fill); color: var(--label); font-size: 14px; font-weight: 650; }
.draft-answer-options button:hover, .draft-answer-options button:focus-visible, .draft-answer-options button.selected, .draft-answer-options button.active { background: var(--action); color: #fff; }
.draft-manual-entry { margin-top: 12px; padding: 14px; border-radius: 16px; background: var(--surface-2); }
.draft-manual-entry label { display: block; margin-bottom: 8px; color: var(--secondary); font-size: 12px; font-weight: 650; }
.draft-manual-entry > div { display: grid; grid-template-columns: minmax(0,1fr) auto auto; gap: 8px; }
.draft-manual-entry input { min-width: 0; min-height: 46px; padding: 0 13px; border: 1px solid rgba(0,122,255,.55); border-radius: 12px; background: var(--surface); color: var(--label); font-size: 15px; outline: 0; }
.draft-manual-entry button { min-height: 46px; padding: 0 14px; border: 0; border-radius: 12px; background: var(--fill); color: var(--label); font-size: 13px; font-weight: 680; }
.draft-manual-entry button[type="submit"] { background: var(--action); color: #fff; }
.draft-footer .draft-later { min-height: 44px; padding: 0 10px; border: 0; background: transparent; color: var(--secondary); font-size: 13px; font-weight: 620; }
.draft-footer > .primary { min-width: 158px; }

/* 읽기 전용 도면 보기와 명시적 수정 모드 */
.diagram-workspace { min-height: 700px; padding-bottom: 118px; }
.diagram-editor-shell { position: relative; overflow: visible; border-radius: var(--radius-xl); background: var(--surface); box-shadow: var(--shadow); }
.diagram-editor-head { min-height: 104px; padding: 20px 22px; display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; gap: 18px; border-bottom: 1px solid var(--separator); }
.diagram-editor-head p { margin: 0 0 5px; color: var(--secondary); font-size: 12px; font-weight: 650; }
.diagram-editor-head h1, .diagram-editor-head h2 { margin: 0; font-size: 28px; letter-spacing: -.045em; }
.diagram-editor-head > div:last-child { display: flex; align-items: center; gap: 8px; }
.diagram-editor-head label { display: flex; align-items: center; gap: 7px; color: var(--secondary); font-size: 12px; font-weight: 650; }
.diagram-editor-head button, .diagram-editor-head select { min-height: 44px; padding: 0 14px; border: 0; border-radius: 13px; background: var(--fill); color: var(--label); font-size: 13px; font-weight: 650; }
.diagram-editor-head button.primary { background: var(--action); color: #fff; }
.diagram-editor-toolbar { position: sticky; z-index: 35; top: 82px; min-height: 64px; padding: 10px 14px; display: flex; align-items: center; gap: 8px; overflow-x: auto; border-bottom: 1px solid var(--separator); background: rgba(250,250,251,.92); backdrop-filter: saturate(180%) blur(22px); }
.diagram-editor-toolbar::after { content: ""; min-width: 2px; flex: 1; }
.editor-create-actions, .editor-history-actions { display: flex; flex: none; gap: 7px; }
.editor-history-actions { padding-left: 2px; border-left: 1px solid var(--separator); }
.diagram-editor-toolbar button { min-height: 44px; padding: 0 14px; flex: none; border: 0; border-radius: 13px; background: var(--fill); color: var(--label); font-size: 13px; font-weight: 650; }
.diagram-editor-toolbar button.create-equipment { background: var(--label); color: var(--surface); }
.diagram-editor-toolbar button[data-tool="ai-arrange"] { background: rgba(0,122,255,.12); color: var(--action); }
.diagram-editor-toolbar #toggleSelectionMode.active { background: var(--action); color: #fff; }
.diagram-editor-toolbar button:disabled { opacity: .35; }
.diagram-editor-toolbar > span { flex: none; margin-left: auto; color: var(--tertiary); font-size: 11px; }
.connection-coach { min-height: 50px; padding: 0 18px; display: flex; align-items: center; gap: 13px; border-bottom: 1px solid var(--separator); background: #fff; }
.connection-coach b { flex: none; font-size: 13px; }
.connection-coach span { color: var(--secondary); font-size: 12px; }
.connection-coach i { width: 22px; height: 22px; margin: 0 3px; display: inline-grid; place-items: center; border-radius: 50%; background: var(--fill); color: var(--label); font-size: 11px; font-style: normal; font-weight: 750; }
.connection-coach.active { background: rgba(0,122,255,.08); }
.connection-coach.active i { background: var(--action); color: #fff; }
.connection-coach button { min-width: 44px; min-height: 44px; margin-left: auto; border: 0; background: transparent; color: var(--action); font-weight: 680; }
.diagram-editor-layout, .review-map-wrap { position: relative; }
.review-map-wrap { overflow: auto; border-radius: 0 0 var(--radius-xl) var(--radius-xl); }
.editor-canvas { position: relative; min-width: 860px; min-height: 650px; overflow: visible; transform-origin: top left; background-color: #f7f7f9; background-image: radial-gradient(circle,rgba(60,60,67,.12) 1px,transparent 1px); background-size: 24px 24px; }
.editor-canvas.is-readonly { background-image: none; }
.selection-marquee { position: absolute; z-index: 60; border: 1px solid #007aff; border-radius: 8px; background: rgba(0,122,255,.12); pointer-events: none; }
.editor-area { position: absolute; z-index: 0; min-width: 90px; min-height: 70px; border: 1px dashed rgba(60,60,67,.28); border-radius: 24px; background: rgba(255,255,255,.38); touch-action: none; user-select: none; }
.editor-area.is-selected { border-color: var(--action); box-shadow: inset 0 0 0 1px var(--action),0 0 0 3px rgba(0,122,255,.1); }
.editor-area > header { min-height: 44px; padding: 0 16px; display: flex; align-items: center; color: var(--secondary); font-size: 13px; font-weight: 700; cursor: move; }
.region-resize-handle { position: absolute; right: 5px; bottom: 5px; width: 44px; height: 44px; border: 0; border-radius: 12px; background: rgba(118,118,128,.13); cursor: nwse-resize; }
.region-resize-handle::before, .region-resize-handle::after { content: ""; position: absolute; right: 7px; bottom: 7px; width: 9px; height: 1px; background: var(--secondary); transform: rotate(-45deg); transform-origin: right center; }
.region-resize-handle::after { right: 11px; bottom: 7px; width: 5px; }
.editor-equipment { position: absolute; z-index: 2; width: 168px; min-height: 102px; padding: 14px; border: 1px solid var(--separator); border-radius: 17px; background: rgba(255,255,255,.97); box-shadow: 0 8px 24px rgba(0,0,0,.07); color: var(--label); cursor: grab; touch-action: none; user-select: none; }
.editor-canvas.is-readonly .editor-equipment { cursor: pointer; }
.editor-equipment:active { cursor: grabbing; }
.editor-equipment.is-selected { box-shadow: 0 0 0 3px rgba(28,28,30,.18),0 12px 30px rgba(0,0,0,.12); }
.editor-equipment h3 { margin: 0; font-size: 15px; line-height: 1.25; }
.editor-equipment p { margin: 5px 0 0; color: var(--secondary); font-size: 11px; }
.equipment-card-title { display: flex; align-items: flex-start; justify-content: space-between; gap: 6px; }
.equipment-card-title h3 { min-width: 0; overflow-wrap: anywhere; }
.equipment-card-title em { flex: none; padding: 3px 6px; border-radius: 999px; background: var(--fill); color: var(--secondary); font-size: 9px; font-style: normal; font-weight: 750; }
.equipment-card-title em.temporary { background: rgba(255,149,0,.12); color: #a45d00; }
.equipment-card-title em.grouped { background: rgba(0,122,255,.11); color: var(--action); }
.editor-equipment .ports { margin-top: 12px; display: grid; gap: 7px; }
.editor-equipment .port { min-height: 44px; padding: 0; display: flex; align-items: center; justify-content: space-between; gap: 8px; border: 0; background: transparent; color: var(--secondary); font-size: 11px; text-align: left; }
.editor-equipment .port:hover, .editor-equipment .port:focus-visible, .editor-equipment .port.active { color: var(--action); }
.editor-equipment .port i { width: 14px; height: 14px; flex: none; border: 3px solid var(--surface); border-radius: 50%; background: var(--action); box-shadow: 0 0 0 1px var(--separator); }
.editor-equipment .port.is-digital i { background: #e4339a; }
.editor-inspector { position: absolute; z-index: 44; top: 118px; right: 18px; width: min(340px,calc(100% - 36px)); max-height: calc(100% - 146px); padding: 20px; overflow: auto; border: 1px solid var(--separator); border-radius: 24px; background: rgba(255,255,255,.96); box-shadow: 0 20px 55px rgba(0,0,0,.16); backdrop-filter: blur(22px); }
.editor-inspector[hidden] { display: none; }
.editor-inspector > header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.editor-inspector h2 { margin: 0; font-size: 20px; }
.inspector-close { min-width: 44px; min-height: 44px; padding: 0 8px; border: 0; background: transparent; color: #007aff; font-size: 13px; font-weight: 680; }
.editor-inspector label { margin-top: 14px; display: grid; gap: 7px; color: var(--secondary); font-size: 12px; font-weight: 650; }
.editor-inspector input, .editor-inspector select, .editor-inspector textarea { width: 100%; min-height: 46px; padding: 10px 12px; border: 0; border-radius: 13px; background: var(--surface-2); color: var(--label); font-size: 15px; }
.editor-inspector > p { color: var(--secondary); font-size: 12px; line-height: 1.5; }
.editor-inspector > .danger-button { width: 100%; margin-top: 16px; }
.temporary-label { display: block; margin-top: 5px; color: #a45d00; font-size: 11px; font-weight: 680; }
.layout-location-note { margin-top: 14px; padding: 12px; border-radius: 13px; background: rgba(0,122,255,.08); }
.layout-location-note b, .layout-location-note span { display: block; }
.layout-location-note b { font-size: 12px; }
.layout-location-note span { margin-top: 3px; color: var(--secondary); font-size: 11px; line-height: 1.4; }
.selection-actions { margin-top: 14px; display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.selection-actions button { min-height: 44px; border: 0; border-radius: 12px; background: var(--fill); color: var(--label); font-weight: 680; }
.equipment-attachments { margin-top: 12px; border-radius: 13px; background: var(--surface-2); }
.equipment-attachments summary { min-height: 44px; padding: 0 12px; display: flex; align-items: center; cursor: pointer; color: var(--secondary); font-size: 12px; font-weight: 680; }
.equipment-attachments p { margin: 0; padding: 8px 12px; border-top: 1px solid var(--separator); color: var(--secondary); font-size: 11px; overflow-wrap: anywhere; }
.connection-summary { display: grid; gap: 5px; padding: 14px; border-radius: 14px; background: var(--surface-2); }
.connection-summary b { color: var(--label); font-size: 14px; }
.connection-summary span { color: var(--secondary); font-size: 12px; }
.inspector-signal-types { margin-top: 16px; }
.inspector-signal-types h3 { margin: 0 0 9px; font-size: 14px; }
.inspector-signal-types > div { display: grid; grid-template-columns: repeat(2,1fr); gap: 7px; }
.inspector-signal-types button { min-height: 44px; border: 0; border-radius: 11px; background: var(--fill); color: var(--label); font-size: 12px; font-weight: 680; }
.inspector-signal-types button.active { background: var(--action); color: #fff; }
.region-size-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.region-precision { margin-top: 12px; border-radius: 13px; background: var(--surface-2); }
.region-precision summary { min-height: 44px; padding: 0 12px; display: flex; align-items: center; cursor: pointer; color: var(--secondary); font-size: 12px; font-weight: 650; }
.region-precision .region-size-fields { padding: 0 10px 10px; }
.inspector-ports { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--separator); }
.inspector-ports > h3 { margin: 0 0 12px; font-size: 15px; }
.inspector-port-group + .inspector-port-group { margin-top: 14px; }
.inspector-port-group > header { min-height: 44px; display: flex; align-items: center; justify-content: space-between; }
.inspector-port-group > header span { color: var(--secondary); font-size: 11px; font-weight: 700; }
.inspector-port-group > header button { min-height: 44px; padding: 0 7px; border: 0; background: transparent; color: #007aff; font-size: 12px; font-weight: 650; }
.inspector-port-row { display: grid; grid-template-columns: minmax(0,1fr) 44px; align-items: center; gap: 7px; margin-top: 6px; }
.inspector-port-row > button { width: 44px; height: 44px; border: 0; border-radius: 50%; background: #ff3b30; color: #fff; font-size: 22px; line-height: 1; }
.connection-signal-picker { position: absolute; z-index: 70; left: 50%; bottom: 86px; width: min(480px,calc(100% - 28px)); padding: 18px; transform: translateX(-50%); border: 1px solid var(--separator); border-radius: 22px; background: rgba(255,255,255,.97); box-shadow: 0 18px 48px rgba(0,0,0,.18); backdrop-filter: saturate(180%) blur(22px); }
.connection-signal-picker .sheet-grabber { width: 38px; height: 5px; margin: -8px auto 12px; display: block; border-radius: 999px; background: rgba(60,60,67,.22); }
.connection-signal-picker > small { display: block; margin-bottom: 5px; color: var(--secondary); font-size: 11px; }
.connection-signal-picker > b { display: block; font-size: 17px; }
.connection-signal-picker > div { margin-top: 12px; display: grid; grid-template-columns: repeat(4,1fr); gap: 7px; }
.connection-signal-picker button { min-height: 44px; padding: 0 10px; border: 0; border-radius: 12px; background: var(--fill); color: var(--label); font-size: 12px; font-weight: 680; }
.connection-signal-picker [data-connection-signal="analog"] { background: #1c1c1e; color: #fff; }
.connection-signal-picker [data-connection-signal="digital"] { background: #e4339a; color: #fff; }
.connection-signal-picker [data-connection-signal="network"] { background: #0a84ff; color: #fff; }
.connection-signal-picker [data-connection-signal="control"] { background: #ff9f0a; color: #fff; }
.connection-signal-picker > [data-cancel-connection] { width: 100%; margin-top: 8px; background: transparent; color: var(--secondary); }
.diagram-editor-footer { min-height: 78px; padding: 12px 16px; display: flex; align-items: center; justify-content: flex-end; gap: 8px; border-top: 1px solid var(--separator); }
.diagram-editor-footer button { min-height: 46px; padding: 0 18px; border: 0; border-radius: 14px; background: var(--fill); color: var(--label); font-size: 14px; font-weight: 680; }
.diagram-editor-footer button.primary { background: var(--action); color: #fff; }
.diagram-ai-bar { position: sticky; z-index: 42; bottom: 98px; width: min(680px,calc(100% - 28px)); margin: -76px auto 16px; padding: 7px; display: grid; grid-template-columns: 34px minmax(0,1fr) auto; align-items: center; border: 1px solid var(--separator); border-radius: 18px; background: rgba(255,255,255,.94); box-shadow: 0 14px 36px rgba(0,0,0,.12); backdrop-filter: saturate(180%) blur(22px); }
.diagram-ai-bar > span { display: grid; place-items: center; color: var(--action); font-size: 18px; }
.diagram-ai-bar input { min-width: 0; min-height: 48px; padding: 0 14px; border: 0; outline: 0; background: transparent; color: var(--label); font-size: 16px; }
.diagram-ai-bar button { min-width: 80px; min-height: 48px; border: 0; border-radius: 13px; background: var(--action); color: #fff; font-size: 13px; font-weight: 680; }
.bulk-change-list { margin: 0 30px 20px; padding: 12px; border-radius: 14px; background: var(--surface-2); }
.bulk-change-list > strong { display: block; margin-bottom: 7px; font-size: 13px; }
.bulk-change-list p { margin: 0; padding: 6px 0; display: grid; grid-template-columns: 48px minmax(0,1fr); gap: 8px; border-top: 1px solid var(--separator); color: var(--secondary); font-size: 12px; }
.bulk-change-list p span { color: var(--label); font-weight: 680; }
.bulk-change-list small { display: block; margin-top: 7px; color: var(--secondary); }

/* 장비는 이름을 몰라도 자료만으로 먼저 만들 수 있다. */
.equipment-create-dialog { width: min(620px,calc(100% - 28px)); }
.equipment-create-lead { margin: 0; padding: 18px 24px 0; color: var(--secondary); font-size: 14px; line-height: 1.55; }
.equipment-create-fields { padding: 18px 24px; display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.equipment-create-fields label { display: grid; gap: 7px; color: var(--label); font-size: 12px; font-weight: 680; }
.equipment-create-fields label > span { color: var(--secondary); font-size: 10px; font-weight: 550; }
.equipment-create-fields input, .equipment-create-fields select { width: 100%; min-height: 46px; box-sizing: border-box; padding: 0 12px; border: 0; border-radius: 13px; background: var(--surface-2); color: var(--label); font: inherit; }
.equipment-create-fields .equipment-attachment-field { grid-column: 1 / -1; padding: 14px; border: 1px dashed rgba(60,60,67,.24); border-radius: 16px; background: rgba(120,120,128,.055); }
.equipment-create-fields .equipment-attachment-field input { padding: 10px; background: transparent; }
.equipment-create-note { margin: 0 24px 18px; padding: 13px; display: flex; align-items: center; gap: 11px; border-radius: 14px; background: rgba(0,122,255,.08); }
.equipment-create-note > i { width: 36px; height: 36px; flex: none; display: grid; place-items: center; border-radius: 11px; background: var(--action); color: #fff; font-size: 22px; font-style: normal; }
.equipment-create-note b, .equipment-create-note span { display: block; }
.equipment-create-note b { font-size: 12px; }
.equipment-create-note span { margin-top: 3px; color: var(--secondary); font-size: 11px; line-height: 1.4; }

/* 기록 */
.history-view { width: min(920px,calc(100% - 40px)); margin: 0 auto; padding: 52px 0 120px; }
.history-view .page-title { margin-bottom: 24px; }
.history-empty { min-height: 440px; padding: 38px 24px; display: grid; place-content: center; justify-items: center; border-radius: var(--radius-xl); background: var(--surface); text-align: center; }
.history-empty > span { width: 64px; height: 64px; display: grid; place-items: center; border-radius: 20px; background: var(--fill); color: var(--secondary); font-size: 34px; }
.history-empty h2 { margin: 20px 0 6px; font-size: 24px; }
.history-empty p { max-width: 360px; margin: 0; color: var(--secondary); font-size: 15px; line-height: 1.6; }
.history-empty button { margin-top: 18px; }
.quarantine-note { display: flex; gap: 8px 16px; align-items: center; justify-content: space-between; margin: 0 auto 16px; padding: 14px 16px; border-radius: 16px; background: rgba(212,154,8,.12); color: var(--label); }
.quarantine-note span { color: var(--secondary); font-size: 13px; }
.history-list { padding: 0 20px; overflow: hidden; border-radius: var(--radius-lg); background: var(--surface); }
.history-list > header { min-height: 62px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--separator); }
.history-list > header h2 { margin: 0; font-size: 17px; }
.history-list > header span { color: var(--secondary); font-size: 13px; }
.version-row { padding: 20px 0; border-bottom: 1px solid var(--separator); }
.version-row:last-child { border-bottom: 0; }
.version-title { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.version-title h3 { margin: 0 0 5px; font-size: 17px; }
.version-title p { margin: 0; color: var(--secondary); font-size: 13px; }
.version-title button { min-height: 44px; padding: 0 14px; flex: none; border: 0; border-radius: 13px; background: var(--fill); color: var(--label); font-size: 13px; font-weight: 660; }
.current-badge { min-height: 30px; padding: 0 10px; display: inline-flex; align-items: center; border-radius: 999px; background: var(--action); color: #fff; font-size: 12px; font-weight: 680; }
.version-metrics { margin-top: 14px; display: flex; flex-wrap: wrap; gap: 8px; }
.version-metrics span { padding: 7px 9px; border-radius: 10px; background: var(--fill); color: var(--secondary); font-size: 12px; }
.version-tech summary { min-height: 44px; display: flex; align-items: center; color: var(--secondary); font-size: 13px; cursor: pointer; }
.version-tech code { display: block; overflow-wrap: anywhere; color: var(--tertiary); font-size: 11px; }
.history-rules { margin-top: 14px; overflow: hidden; border: 0; border-radius: 20px; background: rgba(255,255,255,.64); }
.history-rules ol { margin: 0; padding: 0 22px 5px 46px; color: var(--secondary); font-size: 13px; line-height: 1.8; }
.history-rules p { margin: 0; padding: 10px 22px 20px; color: var(--secondary); font-size: 13px; }

/* 모달 */
.sheet-modal { width: min(620px,calc(100% - 28px)); max-height: min(86dvh,820px); padding: 0; overflow: auto; border: 0; border-radius: 30px; background: var(--surface); color: var(--label); box-shadow: 0 30px 100px rgba(0,0,0,.25); }
.sheet-modal::backdrop { background: rgba(20,20,22,.36); backdrop-filter: blur(14px); }
.sheet-modal form { padding: 24px; }
.sheet-modal header { min-height: 64px; display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.sheet-modal header p { margin: 0 0 5px; color: var(--secondary); font-size: 12px; font-weight: 650; }
.sheet-modal header h2 { margin: 0; font-size: 25px; letter-spacing: -.04em; }
.sheet-modal header > button { width: 44px; height: 44px; flex: none; border: 0; border-radius: 50%; background: var(--fill); color: var(--label); font-size: 22px; }
.gate-status, .truth-note { margin: 14px 0; padding: 16px; display: flex; align-items: flex-start; gap: 11px; border-radius: 18px; background: var(--surface-2); }
.gate-status > span { width: 34px; height: 34px; display: grid; place-items: center; flex: none; border-radius: 11px; background: var(--fill); font-weight: 740; }
.gate-status b, .gate-status p, .truth-note b, .truth-note span { display: block; }
.gate-status p, .truth-note p { margin: 0; }
.gate-status p, .truth-note span { margin-top: 4px; color: var(--secondary); font-size: 13px; line-height: 1.5; }
.change-summary { padding: 0 30px 20px; display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; }
.change-summary span { min-height: 54px; padding: 8px; display: grid; place-content: center; text-align: center; border-radius: 13px; background: var(--fill); color: var(--secondary); font-size: 11px; }
.change-summary b { color: var(--label); font-size: 15px; }
.apply-fields { margin-top: 14px; display: grid; gap: 14px; }
.check-row { min-height: 52px; padding: 12px; display: grid !important; grid-template-columns: 24px 1fr; align-items: start; gap: 10px !important; border-radius: 15px; background: var(--surface-2); color: var(--label) !important; line-height: 1.5; }
.check-row input { width: 22px !important; height: 22px; min-height: 0 !important; margin: 0; accent-color: var(--action); }
.check-row.critical { background: #fff8e8; }
.sheet-modal footer { margin-top: 20px; display: grid; grid-template-columns: .8fr 1.2fr; gap: 9px; }
.sheet-modal > form > label { margin-top: 18px; }

.toast { position: fixed; z-index: 200; top: calc(88px + env(safe-area-inset-top)); left: 50%; max-width: min(520px,calc(100% - 28px)); min-height: 52px; padding: 11px 18px; transform: translateX(-50%); border-radius: 17px; background: rgba(28,28,30,.94); color: #fff; box-shadow: 0 16px 42px rgba(0,0,0,.2); font-size: 14px; font-weight: 620; }

@media (max-width: 820px) {
  .app-shell { padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
  .app-header { position: fixed; inset: auto 0 0; height: calc(70px + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); border-top: 1px solid rgba(60,60,67,.11); border-bottom: 0; background: rgba(249,249,251,.9); }
  .header-inner { width: 100%; display: block; }
  .wordmark, .system-state { display: none; }
  .tabbar { width: 100%; height: 70px; padding: 6px max(14px,env(safe-area-inset-right)) 4px max(14px,env(safe-area-inset-left)); gap: 4px; border-radius: 0; background: transparent; }
  .tabbar button { min-width: 0; min-height: 58px; padding: 4px; flex-direction: column; gap: 2px; border-radius: 15px; font-size: 11px; }
  .tabbar button.active { background: transparent; box-shadow: none; color: var(--label); font-weight: 720; }
  .tabbar button:not(.active) { color: #9a9a9f; }
  .tabbar svg { width: 25px; height: 25px; padding: 2px; stroke-width: 1.7; }
  .app-content { min-height: 100dvh; }
  .diagnosis-view, .map-view, .review-view, .history-view { width: auto; margin-left: max(14px,env(safe-area-inset-left)); margin-right: max(14px,env(safe-area-inset-right)); }
  .diagnosis-view { padding: calc(36px + env(safe-area-inset-top)) 0 42px; }
  .hero-meta { margin-bottom: 14px; }
  .diagnosis-hero h1 { font-size: clamp(48px,15.3vw,68px); line-height: .94; }
  .diagnosis-hero > p { margin: 22px auto 25px; font-size: 15px; }
  .question-bar { min-height: 64px; padding: 5px 6px 5px 18px; grid-template-columns: minmax(0,1fr) 102px; border-radius: 21px; }
  .question-bar input { min-height: 52px; font-size: 16px; }
  .question-bar button { width: 102px; height: 52px; border-radius: 17px; }
  .quick-questions { justify-content: flex-start; overflow-x: auto; scrollbar-width: none; }
  .setup-callout { margin-top: 22px; padding-left: 15px; }
  .answer-card { margin-top: 24px; border-radius: 26px; }
  .answer-card > header, .first-check, .needed { padding-inline: 20px; }
  .answer-card > header { padding-top: 23px; }
  .answer-card > header h2 { font-size: 26px; }
  .answer-actions, .disclosure > summary, .disclosure-body, .safety-copy, .work-log-form { padding-inline: 20px; }
  .safety-copy p { grid-template-columns: 1fr; gap: 3px; }
  .page-title { min-height: auto; align-items: flex-start; flex-direction: column; gap: 18px; }
  .page-title h1, .review-top h1 { font-size: 43px; }
  .page-title .primary { width: 100%; }
  .map-view { padding: calc(28px + env(safe-area-inset-top)) 0 38px; }
  .map-card { margin-top: 24px; border-radius: 26px; }
  .map-head { min-height: 96px; padding: 20px 20px 14px; }
  .map-head h2 { font-size: 23px; }
  .map-count { display: none; }
  .map-surface { min-height: 450px; margin: 8px; border-radius: 20px; }
  .map-world { min-width: 680px; height: 450px; }
  .map-footer { align-items: flex-start; flex-direction: column; }
  .map-controls { width: 100%; justify-content: flex-end; }
  .detail-sheet { position: fixed; z-index: 100; top: auto; left: max(10px,env(safe-area-inset-left)); right: max(10px,env(safe-area-inset-right)); bottom: calc(78px + env(safe-area-inset-bottom)); width: auto; max-height: min(68dvh,620px); border-radius: 28px; }
  .review-view { padding: calc(36px + env(safe-area-inset-top)) 0 130px; }
  .setup-hero { text-align: left; }
  .setup-hero h1 { font-size: clamp(46px,13vw,60px); }
  .setup-hero > span { margin-left: 0; }
  .intake-title { flex-direction: row; }
  .intake-title .secondary { width: auto; }
  .stage-line { overflow-x: auto; justify-content: flex-start; }
  .stage-line span { white-space: nowrap; }
  .dropzone { min-height: 290px; padding: 26px 18px; }
  .intake-details > div { grid-template-columns: 1fr; }
  .analysis-stage { padding: calc(28px + env(safe-area-inset-top)) 0 28px; }
  .analysis-hero h1 { font-size: clamp(38px,10vw,50px); }
  .analysis-card { margin-top: 28px; padding: 28px 22px 8px; border-radius: 26px; }
  .analysis-count { gap: 20px; }
  .analysis-count strong { font-size: 48px; }
  .analysis-count span { font-size: 19px; }
  .analysis-spinner { width: 42px; height: 42px; border-width: 6px; }
  .analysis-guard { align-items: flex-start; }
  .analysis-guard span { text-align: left; }
  .analysis-test-actions { margin-top: 28px; }
  .location-classification-stage { padding: calc(30px + env(safe-area-inset-top)) 0 160px; }
  .classification-hero { padding-top: 0; }
  .classification-hero h1 { font-size: clamp(38px,11vw,48px); }
  .classification-hero > span br { display: none; }
  .ios-location-sheet { margin-top: 28px; border-radius: 22px; }
  .ios-location-sheet > header { padding-inline: 18px; }
  .ios-location-row { margin-left: 16px; padding-right: 14px; grid-template-columns: 42px minmax(0,1fr) auto; gap: 11px; }
  .ios-location-row.is-managing { margin-left: 12px; grid-template-columns: 44px 42px minmax(0,1fr) auto; gap: 9px; }
  .classification-footer { align-items: center; flex-direction: row; }
  .classification-footer .classification-later { width: auto; }
  .classification-footer > .primary { width: auto; min-width: 138px; }
  .flow-footer { bottom: calc(70px + env(safe-area-inset-bottom)); padding-left: max(14px,env(safe-area-inset-left)); padding-right: max(14px,env(safe-area-inset-right)); }
  .flow-footer p { display: none; }
  .flow-footer button { width: 100%; }
  .draft-stage { padding: calc(30px + env(safe-area-inset-top)) 0 160px; }
  .draft-hero h1 { font-size: clamp(38px,11vw,48px); }
  .draft-hero > span br { display: none; }
  .draft-result-card { margin-top: 28px; border-radius: 24px; }
  .draft-result-summary { align-items: flex-start; flex-direction: column; gap: 10px; }
  .draft-question-card { padding-inline: 18px; }
  .draft-footer { align-items: center; flex-direction: row; }
  .draft-footer .draft-later { width: auto; }
  .draft-footer > .primary { width: auto; min-width: 158px; }
  .diagram-workspace { padding: calc(24px + env(safe-area-inset-top)) 0 150px; }
  .diagram-editor-shell { border-radius: 24px; }
  .diagram-editor-head { min-height: 96px; padding: 16px 18px; grid-template-columns: minmax(0,1fr); }
  .diagram-editor-head > div:last-child { overflow-x: auto; }
  .diagram-editor-head h1, .diagram-editor-head h2 { font-size: 25px; }
  .diagram-editor-toolbar { top: calc(8px + env(safe-area-inset-top)); }
  .diagram-editor-toolbar::after { display: none; }
  .diagram-editor-toolbar #reviewZoomOut, .diagram-editor-toolbar #reviewZoomIn, .diagram-editor-toolbar > span { display: none; }
  .connection-coach { overflow-x: auto; white-space: nowrap; }
  .editor-canvas { min-width: 760px; min-height: 600px; }
  .editor-inspector { position: fixed; z-index: 80; top: auto; left: max(10px,env(safe-area-inset-left)); right: max(10px,env(safe-area-inset-right)); bottom: calc(154px + env(safe-area-inset-bottom)); width: auto; max-height: min(54dvh,520px); border-radius: 28px; }
  .connection-signal-picker { position: fixed; z-index: 90; left: max(10px,env(safe-area-inset-left)); right: max(10px,env(safe-area-inset-right)); bottom: calc(82px + env(safe-area-inset-bottom)); width: auto; transform: none; border-radius: 28px; }
  .diagram-ai-bar { bottom: calc(82px + env(safe-area-inset-bottom)); }
  .history-view { padding: calc(28px + env(safe-area-inset-top)) 0 42px; }
  .history-view .page-title { margin-bottom: 22px; }
  .version-title { align-items: flex-start; flex-direction: column; }
  .sheet-modal { margin-bottom: max(14px,env(safe-area-inset-bottom)); }
  .equipment-create-fields { grid-template-columns: 1fr; padding-inline: 18px; }
  .equipment-create-fields .equipment-attachment-field { grid-column: auto; }
  .equipment-create-lead { padding-inline: 18px; }
  .equipment-create-note { margin-inline: 18px; }
  .toast { top: calc(14px + env(safe-area-inset-top)); }
}

@media (max-width: 430px) {
  .hero-meta { justify-content: flex-start; }
  .diagnosis-hero { text-align: left; }
  .diagnosis-hero h1 { font-size: clamp(50px,16vw,64px); }
  .diagnosis-hero > p { margin-left: 0; }
  .setup-callout small { white-space: normal; }
  .first-check button { grid-template-columns: 34px minmax(0,1fr) 14px; }
  .first-check button em { display: none; }
  .answer-actions { flex-direction: column; }
  .map-controls > span, .map-controls b { display: none; }
  .file-row { grid-template-columns: 42px minmax(0,1fr) auto; }
  .file-row > div:last-child { grid-column: auto; justify-self: end; justify-items: end; }
  .draft-answer-options { grid-template-columns: 1fr; }
  .draft-comparison { grid-template-columns: 1fr; }
  .draft-manual-entry > div { grid-template-columns: 1fr 1fr; }
  .draft-manual-entry input { grid-column: 1 / -1; }
  .connection-signal-picker > div { grid-template-columns: repeat(2,1fr); }
  .diagram-editor-footer { align-items: stretch; flex-direction: column-reverse; }
  .diagram-editor-footer button { width: 100%; }
  .change-summary { grid-template-columns: repeat(2,1fr); }
  .sheet-modal footer { grid-template-columns: 1fr; }
}

@media (orientation: landscape) and (max-height: 500px) {
  .diagnosis-view { padding-top: max(18px,env(safe-area-inset-top)); }
  .diagnosis-hero h1 { font-size: 46px; }
  .diagnosis-hero > p { margin-block: 12px; }
  .hero-meta { margin-bottom: 5px; }
  .detail-sheet { max-height: calc(100dvh - 92px); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
