/**
 * 고객 보고서·결과 UI 전용 디자인 시스템
 * @see docs/CUSTOMER_REPORT_DESIGN_SPEC.md
 * styles.css 와 분리 — 설치 희망자 결과·report-detail(meeting) 전용
 */

:root {
  --crd-bg-mesh-x: 50%;
  --crd-bg-mesh-y: 30%;
  --crd-bg-mesh-hue: 207;
  --crd-checklist-progress: 0;

  --brand-blue: #1963AC;
  --brand-blue-dark: #0E3D6C;
  --brand-blue-soft: #E7F0F8;
  --brand-orange: #F36F21;
  --brand-orange-dark: #C45312;
  --brand-orange-soft: #FEF3EB;
  --brand-gray: #58585A;
  --brand-gray-dark: #3A3A3C;
  --brand-gray-line: #D8D8D9;

  --crd-shadow-ambient: 0 24px 48px -12px rgba(14, 61, 108, 0.08);
  --crd-shadow-contact: 0 4px 12px -2px rgba(88, 88, 90, 0.1);
  --crd-shadow-rim: inset 0 1px 0 rgba(255, 255, 255, 0.65);
  --crd-shadow-focus: 0 0 0 3px rgba(25, 99, 172, 0.25);

  --crd-glow-ok: 0 2px 24px rgba(22, 163, 74, 0.14);
  --crd-glow-warn: 0 2px 24px rgba(243, 111, 33, 0.16);
  --crd-glow-bad: 0 2px 24px rgba(220, 38, 38, 0.14);
  --crd-glow-mute: 0 2px 16px rgba(88, 88, 90, 0.12);

  --crd-motion-fast: 150ms ease;
  --crd-motion-normal: 200ms ease;
}

/* ── Interactive backdrop (customer result only) ─────────────── */

body[data-role="customer"] .crd-backdrop-mesh,
body.report-detail:not(.embed) .crd-backdrop-mesh {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(
      ellipse 80% 60% at var(--crd-bg-mesh-x) var(--crd-bg-mesh-y),
      hsla(var(--crd-bg-mesh-hue), 70%, 55%, calc(0.04 + var(--crd-checklist-progress) * 0.03)) 0%,
      transparent 70%
    ),
    radial-gradient(
      ellipse 50% 40% at calc(100% - var(--crd-bg-mesh-x)) 80%,
      hsla(22, 90%, 54%, 0.05) 0%,
      transparent 65%
    );
  transition: background var(--crd-motion-normal);
}

body[data-role="customer"] .crd-backdrop-grid,
body.report-detail:not(.embed) .crd-backdrop-grid {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.35;
  background-image: radial-gradient(circle, rgba(88, 88, 90, 0.08) 1px, transparent 1px);
  background-size: 20px 20px;
}

body[data-role="staff"] .crd-backdrop-mesh,
body[data-role="staff"] .crd-backdrop-grid,
body.embed .crd-backdrop-mesh,
body.embed .crd-backdrop-grid {
  display: none;
}

body[data-role="customer"][data-result-status="approved"] {
  --crd-bg-mesh-hue: 145;
}

body[data-role="customer"][data-result-status="conditional"] {
  --crd-bg-mesh-hue: 38;
}

body[data-role="customer"][data-result-status="rejected"] {
  --crd-bg-mesh-hue: 215;
}

@media (prefers-reduced-motion: reduce) {
  .crd-backdrop-mesh {
    transition: none;
  }
}

@media print {
  .crd-backdrop-mesh,
  .crd-backdrop-grid {
    display: none !important;
  }
}

/* ── Elevation presets ───────────────────────────────────────── */

.crd-elevation-1 {
  box-shadow: var(--crd-shadow-ambient), var(--crd-shadow-contact);
}

.crd-elevation-2 {
  box-shadow: var(--crd-shadow-ambient), var(--crd-shadow-contact), var(--crd-shadow-rim);
}

.crd-elevation-3 {
  box-shadow: var(--crd-shadow-ambient), var(--crd-shadow-contact), var(--crd-shadow-rim), var(--crd-glow-mute);
}

body[data-result-status="approved"] .crd-elevation-3,
.customer-result-hero[data-status="approved"].crd-elevation-3 {
  box-shadow: var(--crd-shadow-ambient), var(--crd-shadow-contact), var(--crd-shadow-rim), var(--crd-glow-ok);
}

body[data-result-status="conditional"] .crd-elevation-3,
.customer-result-hero[data-status="conditional"].crd-elevation-3 {
  box-shadow: var(--crd-shadow-ambient), var(--crd-shadow-contact), var(--crd-shadow-rim), var(--crd-glow-warn);
}

body[data-result-status="rejected"] .crd-elevation-3,
.customer-result-hero[data-status="rejected"].crd-elevation-3 {
  box-shadow: var(--crd-shadow-ambient), var(--crd-shadow-contact), var(--crd-shadow-rim), var(--crd-glow-bad);
}

/* ── Hero enhancement (layers on existing styles.css hero) ───── */

body[data-role="customer"] .customer-result-hero.crd-elevation-3 {
  position: relative;
  z-index: 1;
}

body[data-role="customer"] #resultTabSummary .customer-result-summary-grid {
  position: relative;
  z-index: 1;
}

/* ── Needs Checklist widget (.cnc-*) ─────────────────────────── */

.cnc-widget {
  padding: 1.1rem 1.25rem 1.25rem;
  border-radius: var(--radius-lg, 14px);
  border: 1px solid var(--border-light, #D8D8D9);
  background: var(--panel, #fff);
}

.cnc-widget--compact {
  padding: 0.85rem 1rem;
}

.cnc-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  margin-bottom: 0.85rem;
}

.cnc-title {
  margin: 0;
  font-size: var(--text-subtitle, 1.125rem);
  font-weight: 700;
  color: var(--ink, #3A3A3C);
  letter-spacing: -0.02em;
}

.cnc-subtitle {
  margin: 0.15rem 0 0;
  font-size: var(--font-sm, 0.75rem);
  color: var(--muted, #58585A);
}

.cnc-trust-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1rem;
  font-size: var(--font-xs, 0.6875rem);
  color: var(--muted, #58585A);
}

.cnc-trust-legend span {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.cnc-trust-dot {
  width: 8px;
  height: 8px;
  border-radius: 9999px;
  background: #D8D8D9;
}

.cnc-trust-dot--live {
  background: var(--ok, #059669);
}

.cnc-trust-dot--estimate {
  background: var(--warn, #d97706);
}

.cnc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 0.65rem;
}

.cnc-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--border-light, #D8D8D9);
  border-radius: var(--radius-md, 10px);
  background: var(--muted-bg, #f1f5f9);
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition:
    transform var(--crd-motion-fast),
    box-shadow var(--crd-motion-normal),
    border-color var(--crd-motion-fast),
    background var(--crd-motion-fast);
  box-shadow: var(--crd-shadow-contact);
}

.cnc-row:hover {
  transform: translateY(-1px);
  border-color: rgba(37, 99, 235, 0.25);
  background: #fff;
  box-shadow: var(--crd-shadow-ambient), var(--crd-shadow-contact), var(--crd-shadow-rim);
}

.cnc-row:focus-visible {
  outline: none;
  box-shadow: var(--crd-shadow-contact), var(--crd-shadow-focus);
}

.cnc-row[data-state="done"] {
  border-color: rgba(5, 150, 105, 0.25);
  background: linear-gradient(180deg, #fff 0%, #f0fdf4 100%);
}

.cnc-row[data-state="partial"] {
  border-color: rgba(217, 119, 6, 0.28);
  background: linear-gradient(180deg, #fff 0%, #fffbeb 100%);
}

.cnc-row[data-state="blocked"] {
  border-color: rgba(220, 38, 38, 0.22);
  background: linear-gradient(180deg, #fff 0%, #fef2f2 100%);
}

.cnc-row[data-state="pending"] {
  opacity: 0.88;
}

.cnc-row-icon {
  flex-shrink: 0;
  width: 1.75rem;
  height: 1.75rem;
  display: grid;
  place-items: center;
  border-radius: 9999px;
  font-size: 0.85rem;
  font-weight: 700;
  background: #D8D8D9;
  color: #58585A;
}

.cnc-row[data-state="done"] .cnc-row-icon {
  background: #dcfce7;
  color: #15803d;
}

.cnc-row[data-state="partial"] .cnc-row-icon {
  background: #fef3c7;
  color: #b45309;
}

.cnc-row[data-state="blocked"] .cnc-row-icon {
  background: #fee2e2;
  color: #b91c1c;
}

.cnc-row-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.cnc-row-label {
  font-size: var(--font-sm, 0.75rem);
  font-weight: 600;
  color: var(--muted, #58585A);
}

.cnc-row-value {
  font-size: var(--font-md-plus, 0.875rem);
  font-weight: 700;
  color: var(--ink, #3A3A3C);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cnc-row-trust {
  flex-shrink: 0;
  padding: 0.15rem 0.45rem;
  border-radius: 9999px;
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.cnc-row-trust--live {
  background: var(--ok-soft, #dcfce7);
  color: #166534;
}

.cnc-row-trust--estimate {
  background: var(--warn-soft, #fef3c7);
  color: #92400e;
}

.cnc-row-trust--unknown {
  background: #f1f5f9;
  color: #58585A;
}

.cnc-row-chevron {
  flex-shrink: 0;
  color: #94a3b8;
  font-size: 1.1rem;
  line-height: 1;
}

.cnc-next-steps {
  margin-top: 1rem;
  padding: 0.85rem 1rem;
  border-radius: var(--radius-md, 10px);
  border: 1px solid var(--border-light, #D8D8D9);
  background: linear-gradient(180deg, #fff 0%, var(--muted-bg, #f1f5f9) 100%);
  box-shadow: var(--crd-shadow-contact);
}

.cnc-next-headline {
  margin: 0 0 0.55rem;
  font-size: var(--font-md-plus, 0.875rem);
  font-weight: 600;
  color: var(--ink-secondary, #58585A);
  line-height: 1.5;
}

.cnc-next-list {
  margin: 0;
  padding-left: 1.15rem;
  color: var(--muted, #58585A);
  font-size: var(--font-sm, 0.75rem);
  line-height: 1.55;
}

.cnc-next-list li + li {
  margin-top: 0.25rem;
}

/* customer-brief → checklist next-steps 로 흡수 */
body[data-role="customer"] .customer-brief,
body[data-role="customer"] .crh-next-steps,
body[data-role="customer"] #resultTabSummary > #customerGuidedMessage {
  display: none !important;
}

.cnc-footer {
  margin-top: 1rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border-light, #D8D8D9);
}

.cnc-progress {
  height: 6px;
  border-radius: 9999px;
  background: #D8D8D9;
  overflow: hidden;
}

.cnc-progress-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #1963AC, #F36F21);
  transition: width var(--crd-motion-normal);
}

.cnc-progress-label {
  margin: 0.45rem 0 0.75rem;
  font-size: var(--font-sm, 0.75rem);
  font-weight: 600;
  color: var(--ink-secondary, #58585A);
}

.cnc-cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.cnc-cta {
  padding: 0.55rem 1rem;
  border-radius: var(--radius-md, 10px);
  border: 1px solid var(--border, #D8D8D9);
  background: #fff;
  font-size: var(--font-md-plus, 0.875rem);
  font-weight: 600;
  cursor: pointer;
  transition: filter var(--crd-motion-fast), transform var(--crd-motion-fast);
}

.cnc-cta:hover {
  filter: brightness(1.03);
}

.cnc-cta--primary {
  border-color: #C45312;
  background: linear-gradient(135deg, #C45312 0%, #F36F21 100%);
  color: #fff;
}

.cnc-cta--secondary {
  color: var(--ink-secondary, #58585A);
}

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

  .cnc-footer {
    position: sticky;
    bottom: 0;
    z-index: 5;
    margin-left: -0.25rem;
    margin-right: -0.25rem;
    padding: 0.75rem 0.25rem 0;
    background: linear-gradient(to top, #F3F6F9 80%, transparent);
  }

  .cnc-cta-row {
    flex-direction: column;
  }

  .cnc-cta {
    width: 100%;
    text-align: center;
  }
}

/* ── Collapsed profit viz (Phase 4) ──────────────────────────── */

/* 요약 행 오른쪽 슬롯에서는 항상 펼침 — 하단 앵커 스크롤용 접힘은 미사용 */
body[data-role="customer"] .customer-result-summary-grid > #monthlyProfitViz.crd-viz-collapsed:not(.crd-viz-expanded):not(.hidden) {
  display: flex;
  flex-direction: column;
}

/* ── Report cover checklist (meeting mode) ───────────────────── */

.section-cover .cnc-widget {
  background: #ffffff;
  border-color: var(--brand-gray-line, #D8D8D9);
  box-shadow: var(--crd-shadow-contact);
}

.section-cover .cnc-title,
.section-cover .cnc-row-value {
  color: var(--brand-blue, #1963AC);
}

.section-cover .cnc-subtitle,
.section-cover .cnc-row-label,
.section-cover .cnc-trust-legend,
.section-cover .cnc-progress-label {
  color: var(--brand-gray, #58585A);
}

.section-cover .cnc-row {
  background: var(--brand-blue-soft, #E7F0F8);
  border-color: rgba(25, 99, 172, 0.16);
  box-shadow: none;
}

.section-cover .cnc-row:hover {
  background: #ffffff;
}

.section-cover .cnc-progress {
  background: #D8D8D9;
}

.section-cover .cnc-footer {
  border-top-color: #D8D8D9;
}

.cover-why-item--highlight {
  outline: 2px solid rgba(243, 111, 33, 0.55);
  border-radius: 8px;
}

.cnc-section-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.1rem 0.45rem;
  margin-left: 0.35rem;
  border-radius: 9999px;
  font-size: 0.625rem;
  font-weight: 700;
  background: #E7F0F8;
  color: #1963AC;
  vertical-align: middle;
}

@media print {
  .cnc-widget {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .cnc-row {
    box-shadow: none;
  }
}

/* ── Unified widget shell (report §1–10 + staff §1–9) ──────── */

.crd-widget-shell {
  border: 1px solid var(--border-light, #D8D8D9);
  border-radius: var(--radius-md, 10px);
  background: var(--panel, #fff);
  box-shadow: var(--crd-shadow-ambient), var(--crd-shadow-contact);
}

.crd-widget-shell--nested {
  border-color: var(--border-light, #D8D8D9);
  border-radius: var(--radius-md, 10px);
  background: var(--panel-soft, #F7F8F9);
  box-shadow: var(--crd-shadow-contact);
}

.crd-trust-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.45rem;
  border-radius: 9999px;
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.2;
}

.crd-trust-badge--live {
  background: var(--ok-soft, #dcfce7);
  color: #166534;
}

.crd-trust-badge--estimate {
  background: var(--warn-soft, #fef3c7);
  color: #92400e;
}

.crd-trust-badge--unknown {
  background: #f1f5f9;
  color: #58585A;
}

/* Report detail — 10 sections (section0 cover + section1–8, section9) */

body.report-detail .section:not(.section-cover) {
  border-color: var(--border-light, #D8D8D9);
  box-shadow: var(--crd-shadow-ambient), var(--crd-shadow-contact), var(--crd-shadow-rim);
}

body.report-detail .section-head {
  border-bottom-color: rgba(37, 99, 235, 0.14);
}

body.report-detail .section-head h2 {
  font-size: var(--text-subtitle, 1.125rem);
  letter-spacing: -0.02em;
}

body.report-detail .panel,
body.report-detail .energy-chart-block,
body.report-detail .energy-gen-block {
  border-color: var(--border-light, #D8D8D9);
  border-radius: var(--radius-md, 10px);
  box-shadow: var(--crd-shadow-contact);
}

body.report-detail .panel h3,
body.report-detail .energy-chart-block h3,
body.report-detail .energy-gen-block h3 {
  font-size: var(--font-md-plus, 0.875rem);
  font-weight: 700;
  color: var(--ink-secondary, #58585A);
}

body.report-detail .live-data-card {
  border-radius: var(--radius-md, 10px);
  box-shadow: var(--crd-shadow-contact);
  transition:
    border-color var(--crd-motion-fast),
    box-shadow var(--crd-motion-normal);
}

body.report-detail .live-data-card.is-live {
  border-color: rgba(5, 150, 105, 0.28);
  background: linear-gradient(180deg, #fff 0%, #f0fdf4 100%);
  box-shadow: var(--crd-shadow-contact), var(--crd-glow-ok);
}

body.report-detail .live-data-card:not(.is-live) {
  border-color: rgba(217, 119, 6, 0.22);
  background: linear-gradient(180deg, #fff 0%, #fffbeb 100%);
}

body.report-detail .live-data-card-badge {
  display: inline-flex;
  margin-top: 0.35rem;
  padding: 0.15rem 0.45rem;
  border-radius: 9999px;
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

body.report-detail .live-data-card.is-live .live-data-card-badge {
  background: var(--ok-soft, #dcfce7);
  color: #166534;
}

body.report-detail .live-data-card:not(.is-live) .live-data-card-badge {
  background: var(--warn-soft, #fef3c7);
  color: #92400e;
}

body.report-detail .live-data-summary-bar {
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--border-light, #D8D8D9);
  border-radius: var(--radius-md, 10px);
  background: var(--muted-bg, #f1f5f9);
  box-shadow: var(--crd-shadow-contact);
}

body.report-detail .cover-kpi {
  border-radius: var(--radius-md, 10px);
  box-shadow: var(--crd-shadow-contact);
}

/* Staff flow — 9 steps */

body[data-role="staff"] #staffFlow .staff-flow-card,
body[data-role="staff"] #staffFlow .staff-profit-panel,
body[data-role="staff"] #staffFlow .staff-scenario-card,
body[data-role="staff"] #staffFlow .staff-step9-live-data,
body[data-role="staff"] #staffFlow .staff-step9-live-card,
body[data-role="staff"] #staffFlow .staff-flow-page1-landuse-aside,
body[data-role="staff"] #staffFlow .staff-widget {
  border-color: var(--border-light, #D8D8D9);
  box-shadow: var(--crd-shadow-ambient), var(--crd-shadow-contact);
}

body[data-role="staff"] #staffFlow .staff-step9-live-card,
body[data-role="staff"] #staffFlow .staff-scenario-card {
  box-shadow: var(--crd-shadow-contact);
}

body[data-role="staff"] #staffFlow .staff-flow-card__title,
body[data-role="staff"] #staffFlow .staff-profit-panel h5,
body[data-role="staff"] #staffFlow .staff-step9-live-data__title,
body[data-role="staff"] #staffFlow .staff-step9-live-card-title,
body[data-role="staff"] #staffFlow .staff-widget-title {
  font-size: var(--font-md-plus, 0.875rem);
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--ink-secondary, #58585A);
}

body[data-role="staff"] #staffFlow .staff-step9-energy-badge,
body[data-role="staff"] #staffFlow .staff-widget-datasource-badge {
  padding: 0.15rem 0.45rem;
  border-radius: 9999px;
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  border: none;
}

body[data-role="staff"] #staffFlow .staff-step9-energy-badge--ok,
body[data-role="staff"] #staffFlow .staff-widget-datasource-badge--live,
body[data-role="staff"] #staffFlow .staff-widget--data-live {
  background: var(--ok-soft, #dcfce7);
  color: #166534;
  border-color: rgba(5, 150, 105, 0.28);
  box-shadow: var(--crd-shadow-contact), var(--crd-glow-ok);
}

body[data-role="staff"] #staffFlow .staff-step9-energy-badge--warn,
body[data-role="staff"] #staffFlow .staff-widget-datasource-badge--estimate,
body[data-role="staff"] #staffFlow .staff-widget--data-estimate {
  background: var(--warn-soft, #fef3c7);
  color: #92400e;
  border-color: rgba(217, 119, 6, 0.28);
  box-shadow: var(--crd-shadow-contact);
}

body[data-role="staff"] #staffFlow .staff-step9-energy-badge--error,
body[data-role="staff"] #staffFlow .staff-widget-datasource-badge--not_reflected,
body[data-role="staff"] #staffFlow .staff-widget--data-not-reflected {
  background: #fee2e2;
  color: #b91c1c;
  border-color: rgba(220, 38, 38, 0.22);
  box-shadow: var(--crd-shadow-contact);
}

body[data-role="staff"] #staffFlow .staff-flow-card--ordinance,
body[data-role="staff"] #staffFlow .staff-flow-card--distance,
body[data-role="staff"] #staffFlow .staff-flow-card--criteria,
body[data-role="staff"] #staffFlow .staff-flow-card--legal-rag {
  box-shadow: var(--crd-shadow-ambient), var(--crd-shadow-contact), var(--crd-shadow-rim);
}

@media print {
  body.report-detail .section,
  body.report-detail .panel,
  body.report-detail .live-data-card,
  body[data-role="staff"] #staffFlow .staff-flow-card,
  body[data-role="staff"] #staffFlow .staff-profit-panel {
    box-shadow: none;
  }
}

/* ── Full-width web layout (report §1–10 + staff §1–9) ─────── */

@media (min-width: 1024px) {
  /* 공통: 결과·보고서 캔버스 폭 */
  body.report-detail:not(.embed) {
    padding: 0.75rem clamp(0.75rem, 1.5vw, 1.25rem) 1.5rem;
  }

  body.report-detail main.report-shell,
  body.view-all-sections main.report-shell {
    width: 100%;
    max-width: min(calc(100vw - 1.5rem), 180rem);
    margin-left: auto;
    margin-right: auto;
    padding-left: 0;
    padding-right: 0;
  }

  body.report-detail .grid.two {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  body.report-detail .grid.two .panel.full {
    grid-column: 1 / -1;
  }

  body.report-detail .layout-map-wrap {
    aspect-ratio: 16 / 10;
    max-height: min(56vh, 640px);
    height: auto;
  }

  body.report-detail .energy-bar-chart {
    height: clamp(220px, 32vh, 360px);
  }

  body.report-detail .live-data-cards {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  }

  body.view-result[data-role="staff"] {
    padding-left: clamp(0.5rem, 1vw, 0.75rem);
    padding-right: clamp(0.5rem, 1vw, 0.75rem);
  }

  body[data-role="staff"].view-result #resultView .layout,
  body[data-role="staff"] #staffFlow,
  body[data-role="staff"] #staffFlow .staff-flow-layout,
  body[data-role="staff"] #staffFlow .staff-flow-main,
  body[data-role="staff"] #staffFlow .staff-flow-page,
  body[data-role="staff"] #staffFlow .staff-flow-section,
  body[data-role="staff"] #staffFlow .staff-flow-body {
    width: 100%;
    max-width: none;
  }

  body[data-role="staff"] #staffFlow .staff-flow-page.active {
    min-height: calc(100vh - 17rem);
    display: flex;
    flex-direction: column;
  }

  body[data-role="staff"] #staffFlow .staff-flow-page.active .staff-flow-section {
    flex: 1;
    min-height: 0;
  }

  body[data-role="staff"] #staffFlow .staff-flow-page.active .staff-flow-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
  }

  body[data-role="staff"] .staff-sticky-actions {
    width: min(calc(100vw - 1rem), 180rem);
  }

  body[data-role="staff"] .staff-page-dots {
    justify-content: stretch;
    gap: 0.35rem;
  }

  body[data-role="staff"] .staff-page-dot {
    flex: 1 1 0;
    min-width: 0;
  }

  /* 1단계 — 지도 + 용도지역 */
  body[data-role="staff"] .staff-flow-page1-map-landuse-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(280px, 18vw);
    flex: 1;
    min-height: 0;
    align-items: stretch;
  }

  body[data-role="staff"] .staff-flow-page1-landuse-aside {
    width: auto;
    max-width: none;
    flex: none;
  }

  body[data-role="staff"] .staff-flow-map-frame,
  body[data-role="staff"] .staff-step2-map-frame,
  body[data-role="staff"] .staff-page5-map-frame {
    height: clamp(380px, 52vh, 720px);
  }

  /* 2단계 — 지도 | 한전 50:50 */
  body[data-role="staff"] .staff-step2-map-kepco-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    flex: 1;
    min-height: 0;
  }

  body[data-role="staff"] .staff-step2-map-kepco-row .staff-step2-map-wrap,
  body[data-role="staff"] .staff-step2-map-kepco-row .staff-step2-kepco-panel {
    flex: unset;
    max-width: none;
    max-height: min(72vh, 720px);
    height: 100%;
  }

  /* 3단계 — 행위제한 요약 | 원문 2열 */
  body[data-role="staff"] #staffFlowPage3 .staff-step3-landuse-stack {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
    flex: 1;
    align-content: start;
  }

  body[data-role="staff"] #staffFlowPage3 .staff-step3-landuse-heading,
  body[data-role="staff"] #staffFlowPage3 .staff-step3-parcel-pick-notice,
  body[data-role="staff"] #staffFlowPage3 .staff-step3-zone-names,
  body[data-role="staff"] #staffFlowPage3 .staff-step3-landuse-toolbar {
    grid-column: 1 / -1;
  }

  body[data-role="staff"] #staffFlowPage3 .staff-step3-landuse-panel {
    min-height: min(48vh, 520px);
    overflow: auto;
  }

  /* 4·8단계 — 2열 그리드 전폭 */
  body[data-role="staff"] #staffFlowPage4 .staff-flow-body,
  body[data-role="staff"] #staffFlowPage8 .staff-flow-body {
    flex: 1;
    align-content: start;
  }

  body[data-role="staff"] #staffFlowPage4 .staff-step4-legal-pair-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  /* 5단계 — 상단 2열 + 축척 평면도 세로 확장 */
  body[data-role="staff"] .staff-page5-top-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  body[data-role="staff"] #staffFlowPage5 .staff-page5-plan-block {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
  }

  body[data-role="staff"] .staff-page5-plan-drawings-row {
    flex: 1;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "opt"
      "canvas";
    min-height: 0;
    align-items: start;
  }

  body[data-role="staff"] .staff-page5-plan-drawings-row.staff-page5-plan-drawings-row--with-widgets {
    grid-template-columns: minmax(0, 1fr) minmax(220px, 18rem);
    grid-template-areas:
      "opt widgets"
      "canvas widgets";
    align-items: start;
  }

  body[data-role="staff"] .staff-page5-plan-main-row.staff-page5-plan-main-row--stacked {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
  }

  body[data-role="staff"] .staff-page5-drawing-col--plan .staff-page5-plan-wrap,
  body[data-role="staff"] .staff-page5-plan-canvas-col .staff-page5-plan-wrap {
    width: 100%;
    max-width: none;
    min-height: min(62vh, 780px);
  }

  body[data-role="staff"] .staff-page5-drawing-col--plan .staff-page5-plan-svg {
    max-height: min(72vh, 820px);
    margin-left: 0;
    margin-right: auto;
  }

  body[data-role="staff"] .staff-page5-drawing-col--context .staff-page5-layout-map-inner {
    aspect-ratio: auto;
    width: 100%;
    max-width: none;
    height: min(68vh, 780px);
    max-height: none;
    min-height: min(420px, 42vw);
  }

  body[data-role="staff"] #staffFlowPage5 .staff-page5-layout-map-wrap:not(.hidden) {
    min-height: min(360px, 42vw);
  }

  /* 6단계 — 비용 표·부대비 전폭 */
  body[data-role="staff"] #staffFlowPage6 .staff-step6-cost-table-wrap,
  body[data-role="staff"] #staffStep6CostDetailDialog .staff-step6-cost-table-wrap,
  body[data-role="staff"] #staffStep6IncidentalDetailDialog .staff-step6-cost-table-wrap {
    width: 100%;
    overflow-x: auto;
  }

  body[data-role="staff"] #staffFlowPage6 .staff-step6-default-costs-mount,
  body[data-role="staff"] #staffStep6IncidentalDetailDialog .staff-step6-default-costs-mount {
    display: block;
    width: 100%;
  }

  body[data-role="staff"] #staffStep6IncidentalDetailDialog .staff-step6-cost-table-wrap,
  body[data-role="staff"] #staffStep6IncidentalDetailDialog .staff-step6-default-cost-table {
    width: 100%;
  }

  /* 7단계 — 입력 + 맥락 배치도 확장 */
  body[data-role="staff"] #staffFlowPage7 .staff-step-inline-edit-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  body[data-role="staff"] .staff-page7-layout-map-wrap {
    aspect-ratio: 16 / 9;
    max-height: min(56vh, 640px);
    height: auto;
  }

  /* 9단계 — KPI·패널 전폭 */
  body[data-role="staff"] .staff-profit-kpis {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  body[data-role="staff"] .staff-profit-dashboard {
    flex: 1;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  body[data-role="staff"] .staff-step9-live-grid {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
  }
}

@media (min-width: 1024px) and (max-width: 1279px) {
  body[data-role="staff"] .staff-page-dot {
    min-width: 4.6rem;
    padding-inline: 0.45rem;
  }

  body[data-role="staff"] .staff-step-label {
    font-size: 0.55rem;
  }
}
