/* (주)선선 무인방제기 셀프설치 상담 챗봇 스타일시트
   모던 대화형 AI 인터페이스(ChatGPT·Claude·Perplexity 스타일) + 농민 모바일 고가독성 UI
   - 입력창: 1줄 시 텍스트-버튼 세로 완벽 정렬, 여러 줄 시 하단 우측 버튼 고정
   - 첫 화면: 입력창 중심 설계 + 즉시 질의 추천 질문 칩
   - 대화창: 메신저형 말풍선, 봇 아바타, 답변 카드, 타이핑 애니메이션
   - 접근성: 글자 대비 4.5:1 이상, 키보드 포커스 링, prefers-reduced-motion
   - 360px 모바일 가로스크롤 제로, 인라인 스타일/스크립트 일체 없음 (CSP 완벽 준수)
*/

:root {
  /* 색상 시스템 */
  --bg: #f8fafc;           /* slate-50 */
  --surface: #ffffff;
  --surface-alt: #f1f5f9;   /* slate-100 */
  --surface-hover: #e2e8f0; /* slate-200 */
  --line: #e2e8f0;          /* slate-200 */
  --line-strong: #cbd5e1;   /* slate-300 */

  /* 텍스트 (초고대비) */
  --text: #0f172a;          /* slate-900 */
  --text-2: #334155;        /* slate-700 */
  --text-3: #526075;        /* slate-500 */

  /* 선선 홈페이지(sunsun.kr) 파랑 계열(11-12). 홈페이지 하늘색 #4faae0은 흰 글씨가 잘 안 읽혀(2.6:1)
     단추·글씨는 같은 계열을 진하게 쓰고(흰 글씨 5.4:1), 하늘색은 밑줄·띠 같은 꾸밈에만 쓴다 */
  --brand-sky: #4faae0;
  --accent: #1c6fa8;
  --accent-hover: #175d8d;
  --accent-press: #0f3f60;
  --accent-soft: #eef7fd;   /* 위 진한 파랑 글씨 대비 5.0:1 */
  --accent-border: #cfe7f6;

  /* 안전·경고·성공 */
  --danger: #dc2626;        /* red-600 */
  --danger-soft: #fef2f2;   /* red-50 */
  --danger-border: #fecaca; /* red-200 */
  --danger-text: #991b1b;   /* red-800 */

  --warn: #d97706;          /* amber-600 */
  --warn-soft: #fffbeb;     /* amber-50 */
  --warn-border: #fde68a;   /* amber-200 */
  --warn-text: #92400e;     /* amber-800 */

  --success: #15803d;       /* green-700, contrast >= 4.5:1 */
  --success-soft: #f0fdf4;  /* green-50 */

  /* 곡률 */
  --radius: 18px;
  --radius-s: 12px;
  --radius-pill: 9999px;

  /* 그림자 */
  --shadow-sm: 0 1px 3px 0 rgba(15, 23, 42, 0.05);
  --shadow-md: 0 4px 12px -2px rgba(15, 23, 42, 0.08), 0 2px 6px -1px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 10px 20px -3px rgba(15, 23, 42, 0.1), 0 4px 8px -2px rgba(15, 23, 42, 0.05);
  --shadow-composer: 0 4px 20px -2px rgba(15, 23, 42, 0.1), 0 2px 6px -1px rgba(15, 23, 42, 0.06);
}

/* ── 초기화 및 기본 스타일 ─────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}
html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  line-height: 1.6;
  letter-spacing: -0.015em;
  word-break: keep-all;
  overflow-wrap: anywhere;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* 링크 */
a {
  color: var(--accent);
  text-decoration: none;
}
a:active {
  text-decoration: underline;   /* 투명도로 흐리면 글씨 대비가 4.5:1 밑으로 내려가서(Codex 11-12) */
}

/* 포커스 링 */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* 아이콘 */
.sprite { position: absolute; }
.icon {
  width: 22px;
  height: 22px;
  flex: none;
  display: inline-block;
  vertical-align: middle;
}
[hidden] { display: none !important; }

/* 스크린리더 전용 */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ── 상단 앱바 (Appbar) ─────────────────────────────────── */
.appbar {
  position: sticky;
  top: 0;
  z-index: 30;
  width: 100%;
  height: 56px;
  display: grid;
  grid-template-columns: 52px 1fr 52px;   /* 뒤로 가기와 같은 폭을 오른쪽에 둬 제목이 가운데에 온다 */
  align-items: center;
  max-width: 480px;
  margin: 0 auto;
  padding: 0 10px;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
}
.appbar-back {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  color: var(--text);
  border-radius: var(--radius-pill);
  transition: background-color 0.15s;
}
.appbar-back:active {
  background: var(--surface-alt);
}
.appbar-title {
  text-align: center;
  font-weight: 700;
  font-size: 1.0625rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.02em;
}
.appbar-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 0 12px;
  color: var(--text-2);
  font-size: 0.8125rem;
  font-weight: 600;
  background: var(--surface-alt);
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  white-space: nowrap;
  transition: all 0.15s;
}
.appbar-link:active {
  background: var(--surface-hover);
  color: var(--text);
}

/* 홈 앱바 */
.brand-group {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.brand {
  display: inline-flex;
  align-items: center;
  font-weight: 800;
  font-size: 1.25rem;
  color: var(--text);
  letter-spacing: -0.03em;
}
.brand small, .brand-badge {
  margin-left: 8px;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  letter-spacing: -0.01em;
  vertical-align: middle;
}

/* 대화창 앱바 */
.chat-page .appbar {
  grid-template-columns: 72px 1fr 72px;   /* 오른쪽 "새 대화" 버튼 폭만큼 왼쪽도 비워 제목을 가운데에 둔다 */
  padding: 0 10px;
}
.chat-header-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.chat-header-title {
  text-align: center;
  font-weight: 800;
  font-size: 1rem;
  color: var(--text);
  letter-spacing: -0.02em;
}
.chat-header-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 6px;
}
.chat-reset {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 0 10px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-pill);
  color: var(--text-2);
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: all 0.15s;
}
.chat-reset:active {
  background: var(--surface-alt);
}

/* 관리자 앱바 */
.admin .appbar {
  grid-template-columns: 1fr auto;
  padding: 0 16px;
}

/* ── 본문 기본 레이아웃 ──────────────────────────────────── */
.page {
  max-width: 480px;
  margin: 0 auto;
  padding: 8px 16px 36px;
  background: var(--bg);
  min-height: calc(100vh - 56px);
}
.has-bar .page {
  padding-bottom: calc(76px + 32px + env(safe-area-inset-bottom));
}

/* ── 타이포그래피 ────────────────────────────────────────── */
h1, h2, h3, .title, legend, .layout-title, summary, .section-label, .prompts-label {
  text-wrap: balance;
  word-break: keep-all;
}
p, .lead, .hint, .answer, .greeting-desc, .sub, .row-sub, .mode-body, .steps li, .bullets li {
  text-wrap: pretty;
  word-break: keep-all;
}
h1, .title {
  font-size: 1.625rem;
  line-height: 1.35;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text);
  margin: 16px 0 8px;
}
h2 {
  font-size: 1.1875rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
  margin: 22px 0 10px;
}
h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}
p {
  margin: 8px 0;
}
.lead {
  color: var(--text-2);
  font-size: 1.0625rem;
  line-height: 1.55;
  margin-top: 0;
}
.hint {
  color: var(--text-3);
  font-size: 0.875rem;
  line-height: 1.5;
  margin: 6px 0;
}
.section-label {
  color: var(--text-2);
  font-size: 0.875rem;
  font-weight: 800;
  margin: 24px 4px 8px;
  letter-spacing: -0.01em;
}

/* ── [해결 1] 입력창 정렬 및 멀티라인 레이아웃 ────────────── */
/* 첫 화면과 대화 화면 모두 동일한 규격의 컴포저를 공유 */
.search {
  width: 100%;
  margin: 0;
}
.search-row {
  display: flex;
  align-items: flex-end; /* 여러 줄일 때 버튼이 우측 하단에 고정 */
  gap: 8px;
  padding: 6px 6px 6px 16px;
  background: var(--surface);
  border: 1.5px solid var(--line-strong);
  border-radius: 26px;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s, box-shadow 0.15s, background-color 0.15s;
}
.search-row:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3.5px rgba(29, 78, 216, 0.15);
  background: #ffffff;
}

/* 1줄일 때 텍스트 높이(24px) + 상하 패딩(8px*2) = 40px
   버튼 높이 40px과 세로 중심선이 20px로 완벽 일치 */
.search-row textarea {
  display: block;
  flex: 1;
  min-width: 0;
  box-sizing: border-box;
  margin: 0;
  padding: 8px 0;
  background: transparent;
  border: 0;
  font-family: inherit;
  font-size: 1rem;       /* 16px: 모바일 브라우저 자동 줌 방지 */
  line-height: 24px;      /* 정확한 행 높이 */
  min-height: 40px;      /* 1줄 시 40px */
  max-height: 136px;     /* 최대 약 5줄 후 내부 스크롤 */
  color: var(--text);
  resize: none;
  overflow-y: auto;
  outline: 0;
  field-sizing: content;
  box-shadow: none !important;
}
.search-row textarea::placeholder {
  color: #64748b;
  font-size: 0.9688rem;
}

/* 보내기 버튼 (원형 40px) */
.search-row button {
  flex: none;
  width: 40px;
  height: 40px;
  min-height: 40px;
  max-height: 40px;
  padding: 0;
  margin: 0;
  border-radius: var(--radius-pill);
  background: var(--accent);
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(29, 78, 216, 0.3);
  transition: transform 0.1s, background-color 0.15s;
}
.search-row button:active {
  transform: scale(0.92);
  background: var(--accent-press);
}
.search-row button .icon {
  width: 20px;
  height: 20px;
}

/* ── [해결 2] 첫 화면 (Home): 입력창 중심 설계 ───────────── */
.home-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-top: 4px;
}

/* Hero */
.hero {
  margin: 12px 0 4px;
  padding: 22px 18px 20px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, #2b3640, #1f262d);
  color: #ffffff;
  text-align: center;
}
.hero-tag {
  display: inline-block;
  margin-bottom: 8px;
  padding: 2px 10px;
  background: var(--brand-sky);
  color: #0b2233;           /* 하늘색 위 흰 글씨는 안 읽혀 진한 남색(6.4:1) */
  font-size: 0.8125rem;
  font-weight: 700;
}
.hero h1 {
  margin: 0;
  color: #ffffff;
  font-size: 1.25rem;
  font-weight: 800;
  line-height: 1.35;
  letter-spacing: -0.02em;
}
.hero p {
  margin: 6px 0 0;
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.875rem;
}

/* 입력창 주인공 카드 (Composer Hero Card) */
.main-composer-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-composer);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* 추천 질문 칩 (Quick Prompts) */
.quick-prompts {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 4px;
}
.prompts-label {
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--text-3);
  letter-spacing: -0.01em;
}
.prompts-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}
@media (min-width: 400px) {
  .prompts-grid {
    grid-template-columns: 1fr 1fr;
  }
}
.prompt-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--surface-alt);
  border: 1px solid var(--line);
  border-radius: var(--radius-s);
  color: var(--text);
  font-size: 0.9063rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: all 0.15s;
  line-height: 1.4;
  min-height: 48px;
  max-width: 100%;
  justify-content: flex-start;
  white-space: normal;      /* 공통 버튼의 nowrap을 풀어 칩 안에서 줄바꿈한다 */
  word-break: keep-all;
  overflow-wrap: anywhere;
}
.prompt-chip:active {
  background: var(--accent-soft);
  border-color: var(--accent-border);
  color: var(--accent);
  transform: scale(0.98);
}
.prompt-form {
  margin: 0;
  min-width: 0;
}
.prompts-grid .prompt-chip {
  width: 100%;
  height: 100%;
}
.prompt-chip .prompt-icon {
  width: 18px;
  height: 18px;
  flex: none;
  color: var(--accent);
}
.prompt-chip .prompt-text {
  flex: 1;
  min-width: 0;
}

/* 서브 메뉴: 차분하고 덜 눈에 띄는 디자인 */
.sub-menu-section, .chat-section {
  display: flex;
  flex-direction: column;
  gap: 8px;   /* 카드끼리, 안내 카드 격자(.guide-grid)와 같은 간격 */
  margin-top: 6px;
}
.sub-menu-section .section-label, .chat-section .section-label {
  margin: 8px 4px 0;
}

/* 필요 자재 계산 카드 */
.calc-card, .feature {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--surface);
  border: 1.5px solid var(--accent-border);
  border-radius: var(--radius);
  padding: 16px 18px;
  color: var(--text);
  box-shadow: var(--shadow-sm);
  transition: all 0.15s;
}
.calc-card:active, .feature:active {
  background: var(--accent-soft);
  transform: scale(0.985);
}
.calc-card-icon, .feature .icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-s);
  background: var(--accent-soft);
  color: var(--accent);
  flex: none;
}
.calc-card-body, .feature .grow {
  flex: 1;
  min-width: 0;
}
.calc-card-body strong, .feature strong {
  display: block;
  font-size: 1.0625rem;
  font-weight: 800;
  color: var(--text);
}
.calc-card-body span, .feature span {
  display: block;
  font-size: 0.875rem;
  color: var(--text-2);
  margin-top: 2px;
  line-height: 1.4;
}

/* 가이드 2열 그리드 */
.guide-grid, .list {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  padding: 0;
  margin: 0;
  list-style: none;
  background: transparent;
  border: 0;
  box-shadow: none;
}
.guide-card, .list-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-s);
  padding: 12px 14px;
  color: var(--text);
  box-shadow: var(--shadow-sm);
  transition: all 0.15s;
  min-height: 60px;
}
.guide-card:active, .list-row:active {
  background: var(--surface-alt);
  transform: scale(0.98);
}
.guide-icon-wrap, .list-row .icon-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--surface-alt);
  color: var(--text-2);
  flex: none;
}
.guide-grid {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}
.guide-card-body, .list-row .grow {
  flex: 1;
  min-width: 0;
}
.guide-title {
  display: block;
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
}
.guide-sub, .list-row .sub {
  display: block;
  font-size: 0.75rem;
  color: var(--text-3);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── [해결 3] 대화 화면 (/chat): 모던 메신저 챗봇 UI ──────── */
.chat-page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  background: #f1f5f9; /* 메신저 대화 배경 */
}
.chat-page .page {
  flex: 1;
  min-height: 0;
  padding: 16px 14px 16px;
  background: #f1f5f9;
}
.chat-log, .chat-turns, .turn {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.chat-log {
  margin-bottom: 12px;
}
.chat-turns:empty {
  display: none;
}

/* 말풍선 공통 */
.msg {
  scroll-margin-top: 72px;
  display: flex;
  gap: 10px;
}

/* 사용자 말풍선 (우측 정렬) */
.msg.user {
  align-self: flex-end;
  max-width: 82%;
  padding: 12px 18px;
  background: var(--accent);
  color: #ffffff;
  border-radius: 20px 20px 4px 20px;
  font-size: 1.0625rem;
  line-height: 1.5;
  white-space: pre-wrap;
  box-shadow: 0 2px 8px rgba(28, 111, 168, 0.25);
  font-weight: 500;
}
.msg.user.pending {
  box-shadow: none;   /* 보내는 중: 그림자만 뺀다. 글씨까지 흐리면 대비가 3.7:1로 떨어졌다(Codex 11-12) */
}

/* 봇 말풍선 (좌측 정렬) */
.msg.bot {
  align-self: flex-start;
  width: 100%;
  max-width: 95%;
  flex-direction: column;
  gap: 10px;
}

/* 봇 웰컴 카드 */
.msg.bot.greeting {
  flex-direction: row;
  gap: 10px;
}
.bot-avatar-wrap {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent);
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  box-shadow: 0 2px 6px rgba(29, 78, 216, 0.25);
  margin-top: 2px;
}
.bot-avatar-wrap img { display: block; width: 100%; height: 100%; object-fit: contain; border-radius: inherit; background: #ffffff; }
.bot-avatar-wrap .icon {
  width: 20px;
  height: 20px;
}
.msg.bot.greeting .msg-bubble {
  flex: 1;
  min-width: 0;
}

/* 봇 카드 공통 */
.msg.bot .card {
  margin: 0;
  padding: 18px 20px;
  border-radius: 4px 20px 20px 20px;
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.msg.bot .card + .card,
.msg.bot h2 + .card,
.msg.bot .hint + .card {
  border-radius: 18px;
}

/* 확정 베스트 답변 카드 (위험 신호 및 안전 안내 포함 - 크기 및 강조도 유지) */
.msg.bot .card.best {
  border-left: 4.5px solid var(--accent);
  box-shadow: var(--shadow-md);
}
.msg.bot .card.best h2 {
  font-size: 1.1875rem; /* 19px */
  line-height: 1.45;
  margin: 0 0 10px;
  color: var(--text);
  font-weight: 800;
}

/* 대화창 내부 섹션 소제목 ("관련 질문", "이런 안내가 있어요") */
.msg.bot > h2 {
  font-size: 0.9375rem; /* 15px (대화 본문 17px보다 작고 가벼움) */
  font-weight: 700;
  color: var(--text-2); /* #334155, 대비 7.5:1 */
  margin: 14px 4px 6px;
  letter-spacing: -0.01em;
}
.msg.bot > .hint {
  font-size: 0.8125rem; /* 13px */
  color: var(--text-3);
  margin: 0 4px 6px;
}

/* 웰컴 텍스트 */
.greeting-lead {
  font-size: 1.0625rem;
  line-height: 1.5;
  color: var(--text);
  margin: 0 0 4px;
}
.greeting-desc {
  font-size: 0.9375rem;
  color: var(--text-2);
  line-height: 1.55;
  margin: 0 0 12px;
}

/* 1. 대화창 내부 추천 질문 칩 (.chat-prompt-chips .prompt-chip) */
.chat-prompt-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0 12px;
}
.chat-prompt-chips .prompt-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 5px 11px;
  font-size: 0.8125rem; /* 13px */
  line-height: 1.35;
  border-radius: var(--radius-pill);
  min-height: 32px;
  height: 32px;
  box-sizing: border-box;
  font-weight: 600;
  color: var(--text-2); /* #334155, 대비 7.5:1 */
  white-space: nowrap;
}
.chat-prompt-chips .prompt-chip:active {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: var(--accent-border);
}

/* 2. 대화창 내부 태그 알약 (.tags .tag) */
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0 0;
}
.tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 5px 11px;
  min-height: 32px;
  height: 32px;
  border-radius: var(--radius-pill);
  background: var(--surface-alt);
  color: var(--text-2); /* #334155, 대비 7.5:1 */
  border: 1px solid var(--line);
  font-size: 0.8125rem; /* 13px */
  font-weight: 600;
  line-height: 1.35;
  white-space: nowrap;
  box-sizing: border-box;
  transition: all 0.15s;
}
.tag:active {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: var(--accent-border);
}

/* 3. 답변 아래의 접힌 유사 질문 (.msg.bot details.card summary: 가볍고 얇은 목록 스타일) */
.msg.bot details.card {
  padding: 0;
  margin: 4px 0 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: none;
  overflow: hidden;
}
.msg.bot details.card + details.card {
  margin-top: 6px;
}
.msg.bot details.card summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 38px;
  padding: 9px 14px;
  font-weight: 600;
  font-size: 0.9063rem; /* 14.5px */
  line-height: 1.4;
  color: var(--text);
  transition: background-color 0.15s;
}
.msg.bot details.card summary:active {
  background: var(--surface-alt);
}
.msg.bot details.card summary::-webkit-details-marker {
  display: none;
}
.msg.bot details.card summary::after {
  content: "";
  width: 7px;
  height: 7px;
  border-right: 1.8px solid var(--text-3);
  border-bottom: 1.8px solid var(--text-3);
  transform: rotate(45deg);
  margin-top: -2px;
  flex: none;
  transition: transform 0.15s;
}
.msg.bot details.card[open] summary::after {
  transform: rotate(-135deg);
  margin-top: 3px;
}
.msg.bot details.card .answer {
  padding: 6px 14px 14px;
  border-top: 1px solid var(--line);
}

/* 봇 답변 본문 문단 (크기 그대로 유지) */
.msg.bot .answer p {
  margin: 8px 0;
  font-size: 1.0625rem;
  line-height: 1.65;
  color: var(--text);
}

/* 6. 답변 안의 작은 링크 버튼 (.msg.bot .answer .links a) */
.msg.bot .answer .links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}
.msg.bot .answer .links a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  max-width: 100%;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  background: var(--accent-soft);
  color: var(--accent); /* #1c6fa8: 대비 5.0:1 on #eef7fd */
  border: 1px solid var(--accent-border);
  font-size: 0.8125rem; /* 13px */
  font-weight: 600;
  line-height: 1.35;
  box-sizing: border-box;
  transition: all 0.15s;
}
.msg.bot .answer .links a:active {
  background: var(--accent);
  color: #ffffff;
}
.msg.bot .answer .hint {
  margin: 8px 0 0;
  font-size: 0.8125rem;
  color: var(--text-3);
}

/* 4. "도움이 안 됐어요" 버튼: 말풍선 우측 하단에 작게 (.msg.bot .no-answer button) */
.msg.bot .answer-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 6px;
  margin-top: 10px;
}
.msg.bot .answer-foot .links {
  margin-top: 0;
}
.msg.bot .no-answer {
  margin: 6px 0 0;
  text-align: right;
}
.msg.bot .answer-foot .no-answer {
  margin: 0 0 0 auto;
}
.msg.bot .no-answer button,
.msg.bot .no-answer button.secondary {
  min-height: 26px;
  height: 26px;
  padding: 0 9px;
  font-size: 0.75rem; /* 12px */
  font-weight: 500;
  color: var(--text-3);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  box-shadow: none;
  cursor: pointer;
  transition: all 0.15s;
}
.msg.bot .no-answer button:active,
.msg.bot .no-answer button.secondary:active {
  background: var(--surface-alt);
  color: var(--text);
}

/* 답변 중 (Typing Indicator) */
.msg.typing {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: 6px;
  width: auto;
  padding: 14px 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 4px 18px 18px 18px;
  box-shadow: var(--shadow-sm);
}
.msg.typing span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.35;
  animation: typingBounce 1.2s infinite ease-in-out;
}
.msg.typing span:nth-child(2) { animation-delay: 0.18s; }
.msg.typing span:nth-child(3) { animation-delay: 0.36s; }
@keyframes typingBounce {
  0%, 60%, 100% { opacity: 0.25; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-5px); }
}

/* 하단 고정 대화 도크 (Chat Dock) */
.chat-dock {
  position: sticky;
  bottom: 0;
  z-index: 25;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--line);
  box-shadow: 0 -4px 16px rgba(15, 23, 42, 0.05);
}

/* ── 버튼 컴포넌트 ──────────────────────────────────────── */
button, .button {
  font: inherit;
  font-weight: 700;
  font-size: 1.0625rem;
  min-height: 52px;
  border-radius: var(--radius-s);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 20px;
  border: 0;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: all 0.15s ease-in-out;
}
button:active, .button:active {
  transform: scale(0.985);
}
.primary, button.primary {
  background: var(--accent);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(29, 78, 216, 0.25);
}
.primary:active {
  background: var(--accent-press);
}
.secondary, button.secondary {
  background: var(--surface-alt);
  color: var(--text-2);
  border: 1px solid var(--line-strong);
}
.secondary:active {
  background: var(--surface-hover);
  color: var(--text);
}
.ghost {
  background: transparent;
  color: var(--text-2);
  min-height: 44px;
  padding: 0 12px;
}
button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none !important;
}
.block {
  width: 100%;
}

/* ── 하단 고정 바 (Bottom Bar) ─────────────────────────── */
.bottom-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--line);
  box-shadow: 0 -4px 16px rgba(15, 23, 42, 0.05);
}
.bottom-bar-inner {
  max-width: 448px;
  margin: 0 auto;
  display: flex;
  gap: 10px;
}
.bottom-bar-inner > .primary {
  flex: 1;
}
.bottom-bar-inner > .secondary {
  flex: none;
  padding: 0 18px;
}

/* ── 자재 계산기 (Wizard Form) ───────────────────────────── */
.calc fieldset {
  border: 0;
  padding: 0;
  margin: 0 0 32px;
  min-width: 0;
}
.calc legend {
  font-size: 1.375rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.4;
  padding: 0;
  margin: 8px 0 6px;
  color: var(--text);
}
.calc .step-no {
  display: inline-block;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  font-size: 0.8125rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  margin-bottom: 8px;
}
.wizard .calc fieldset {
  display: none;
  margin: 0;
}
.wizard .calc fieldset.current {
  display: block;
}
.progress {
  height: 6px;
  background: var(--line);
  border-radius: 3px;
  margin: 6px 0 20px;
  overflow: hidden;
  display: none;
}
.wizard .progress {
  display: block;
}
.progress span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--accent);
  border-radius: 3px;
  transition: width 0.25s ease-out;
}
.wizard .calc .submit-row {
  display: none;
}

/* 선택지 라디오 카드 */
.choices {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}
.choices.inline {
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}
.choices.two {
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
.choice {
  position: relative;
  display: flex !important;
  align-items: center;
  gap: 12px;
  min-height: 58px;
  padding: 14px 16px;
  border-radius: var(--radius-s);
  background: var(--surface);
  cursor: pointer;
  font-size: 1.0625rem;
  font-weight: 600;
  color: var(--text);
  border: 1.5px solid var(--line);
  box-shadow: var(--shadow-sm);
  transition: all 0.15s;
}
.choices.inline .choice,
.choices.two .choice {
  justify-content: center;
  text-align: center;
  padding: 14px 6px;
}
.choice input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  min-height: 0;
  pointer-events: none;
}
/* :has() 미지원 브라우저 대비 */
.choice input:checked + span {
  color: var(--accent);
  font-weight: 800;
}
.choice input:focus-visible + span {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
/* :has() 지원 모던 브라우저 */
.choice:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 800;
  box-shadow: 0 0 0 1.5px var(--accent);
}
.choice:has(input:focus-visible) {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.choice small {
  display: block;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-3);
  margin-top: 2px;
}

/* 1단계 하우스 행 */
#houses {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}
.house {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  align-items: end;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  position: relative;
  box-shadow: var(--shadow-sm);
}
.house label {
  font-size: 0.875rem;
  color: var(--text-2);
  font-weight: 700;
}
.house label input,
.house label select {
  margin-top: 5px;
}
.house label:first-child {
  grid-column: 1 / -1;
  padding-right: 58px;
}
.line-steppers {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.line-stepper > span {
  display: block;
  margin-bottom: 5px;
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--text-2);
}
.line-stepper-row { display: flex; align-items: center; gap: 4px; }
.line-stepper-row input {
  flex: 1 1 0;
  width: 0;
  min-width: 0;
  height: 38px;
  min-height: 38px;
  padding: 0;
  font-weight: 800;
  text-align: center;
}
.line-step {
  flex: none;
  width: 38px;
  min-width: 38px;
  height: 38px;
  min-height: 38px;
  padding: 0;
  font-size: 1.125rem;
  color: var(--accent);
  background: var(--surface);
  border: 1px solid var(--accent-border);
  border-radius: 50%;
  box-shadow: none;
}
.line-step:active:not(:disabled) { background: var(--accent-soft); }
.house .remove {
  position: absolute;
  top: 12px;
  right: 12px;
  min-height: 32px;
  height: 32px;
  padding: 0 10px;
  background: var(--danger-soft);
  color: var(--danger);
  border-radius: var(--radius-s);
  font-size: 0.8125rem;
  font-weight: 700;
}
.house .remove:disabled {
  display: none;
}
#add-house {
  margin-top: 12px;
  width: 100%;
  min-height: 52px;
  background: var(--surface);
  color: var(--accent);
  border: 2px dashed var(--accent-border);
  border-radius: var(--radius-s);
  font-weight: 700;
  font-size: 1.0625rem;
  transition: all 0.15s;
}
#add-house:active {
  background: var(--accent-soft);
  border-color: var(--accent);
}
.help {
  margin-top: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-s);
  padding: 0 16px;
  box-shadow: var(--shadow-sm);
}
.help summary {
  min-height: 50px;
  display: flex;
  align-items: center;
  color: var(--text-2);
  font-weight: 700;
  cursor: pointer;
}
.help ul {
  margin: 0 0 14px;
  padding-left: 18px;
  color: var(--text-2);
  line-height: 1.6;
}

/* 4단계 주관 다이어그램 */
.layout-choices {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}
.layout {
  position: relative;
  display: grid !important;
  grid-template-columns: 1fr;
  gap: 4px;
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: all 0.15s;
}
/* :has() 미지원 브라우저 분리 */
.layout.on {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 0 0 1.5px var(--accent);
}
.layout:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 0 0 1.5px var(--accent);
}
.layout:has(input:focus-visible) {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.layout input:focus-visible + .diagram {   /* :has()를 모르는 브라우저에서도 키보드 위치가 보이게 */
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.layout input:checked ~ .layout-title {
  color: var(--accent);
}
.layout input:focus-visible ~ .layout-title {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.layout input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  min-height: 0;
  pointer-events: none;
}
.layout .diagram {
  width: 100%;
  max-width: 240px;
  height: auto;
  margin-bottom: 8px;
}
.layout-title {
  font-weight: 800;
  font-size: 1.0625rem;
  color: var(--text);
}
.layout .hint {
  margin: 0;
}
.diagram .house {
  fill: #ffffff;
  stroke: var(--line-strong);
  stroke-width: 1.4;
}
.diagram .pump {
  fill: var(--accent);
}
.diagram .pipe {
  stroke: var(--text);
  stroke-width: 3.5;
  fill: none;
  stroke-linecap: round;
}
.diagram .pipe.thin {
  stroke-width: 2;
  stroke: var(--text-3);
}
.diagram .cap {
  fill: var(--danger);
}

/* 5단계 주관 길이 모드 */
.length-modes {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}
.mode-body {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-s);
  padding: 4px 16px 14px;
  margin-top: -4px;
  box-shadow: var(--shadow-sm);
}
.mode-body label {
  font-size: 0.875rem;
  color: var(--text-2);
  font-weight: 700;
  margin: 10px 0;
}
.mode-body label input {
  margin-top: 6px;
}

/* 일반 인풋 및 셀렉트 */
input, select, textarea {
  font: inherit;
  font-size: 1.0625rem;
  color: var(--text);
  width: 100%;
  min-height: 52px;
  padding: 12px 16px;
  border-radius: var(--radius-s);
  border: 1.5px solid var(--line-strong);
  background: var(--surface);
  -webkit-appearance: none;
  appearance: none;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s, background-color 0.15s;
}
input:focus, select:focus {
  border-color: var(--accent);
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.12);
}
input::placeholder {
  color: #64748b;
}
select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24'%3E%3Cpath d='M6 9l6 6 6-6' fill='none' stroke='%23475569' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 40px;
  cursor: pointer;
}

/* ── 견적 결과 화면 (/q/{id}) ───────────────────────────── */
.summary {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px 20px;
  margin: 14px 0;
  box-shadow: var(--shadow-md);
}
.summary .label {
  color: var(--text-2);
  font-size: 0.9375rem;
  font-weight: 700;
}
.summary .amount {
  font-size: 2.125rem;
  font-weight: 900;
  letter-spacing: -0.03em;
  color: var(--text);
  margin: 2px 0 4px;
  font-variant-numeric: tabular-nums;
}
.summary .sub {
  color: var(--text-3);
  font-size: 0.9063rem;
  font-weight: 500;
}
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 14px;
}
.chip {
  background: var(--surface-alt);
  color: var(--text-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 5px 10px;
  font-size: 0.8125rem;
  font-weight: 600;
}
.chip.warn {
  background: var(--warn-soft);
  color: var(--warn-text);
  border-color: var(--warn-border);
}
.group {
  color: var(--text-2);
  font-size: 0.9063rem;
  font-weight: 800;
  margin: 24px 4px 8px;
  letter-spacing: -0.01em;
}
.rows {
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0;
  margin: 0;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.row {
  padding: 14px 18px;
}
.row + .row {
  border-top: 1px solid var(--line);
}
.row-main {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
}
.row-main .opt {
  font-weight: 700;
  font-size: 1.0625rem;
  color: var(--text);
}
.row-main .qty {
  font-weight: 800;
  font-size: 1.0625rem;
  color: var(--accent);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.row-sub {
  color: var(--text-3);
  font-size: 0.875rem;
  margin-top: 3px;
  line-height: 1.45;
}
.row-sub strong {
  color: var(--text);
  font-weight: 700;
}
.row.excluded .qty {
  color: var(--warn-text);
}
.note {
  color: var(--warn-text);
  font-weight: 700;
  margin-left: 4px;
}
.notices ul,
.input-summary ul {
  padding-left: 18px;
  margin: 0;
  color: var(--text-2);
  line-height: 1.6;
}
.notices li,
.input-summary li {
  margin: 6px 0;
}
.total {
  background: var(--surface);
  border: 1.5px solid var(--accent-border);
  box-shadow: var(--shadow-sm);
}
.total p:first-child {
  font-size: 1.1875rem;
  margin: 0 0 6px;
  color: var(--text);
}
.total strong {
  font-size: 1.375rem;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  margin-left: 4px;
}

/* ── 가이드 & 폴드 ──────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin: 12px 0;
  box-shadow: var(--shadow-sm);
}
.card h2 {
  margin: 0 0 8px;
}
details.fold {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin: 12px 0;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
details.fold summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 56px;
  padding: 14px 18px;
  font-weight: 700;
  font-size: 1.0625rem;
  color: var(--text);
}
details.fold summary::-webkit-details-marker {
  display: none;
}
details.fold summary::after {
  content: "";
  width: 8px;
  height: 8px;
  border-right: 2.2px solid var(--text-3);
  border-bottom: 2.2px solid var(--text-3);
  transform: rotate(45deg);
  margin-top: -3px;
  flex: none;
  transition: transform 0.15s;
}
details.fold[open] summary::after {
  transform: rotate(-135deg);
  margin-top: 4px;
}
details.fold > div {
  padding: 0 18px 16px;
}
.steps {
  list-style: none;
  counter-reset: step;
  padding: 0;
  margin: 8px 0 0;
}
.steps li {
  counter-increment: step;
  position: relative;
  padding: 0 0 18px 42px;
  font-size: 1.0625rem;
  line-height: 1.6;
}
.steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 1px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid var(--accent-border);
  font-weight: 800;
  font-size: 0.875rem;
  display: grid;
  place-items: center;
}
.steps li:last-child {
  padding-bottom: 0;
}
.bullets {
  padding-left: 20px;
  margin: 8px 0 0;
}
.bullets li {
  margin: 8px 0;
  font-size: 1.0625rem;
  line-height: 1.6;
}
.bullets li::marker {
  color: var(--accent);
}
.guide-images {
  margin-top: 14px;
}
.guide-images figure {
  margin: 0;
}
.guide-images img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-s);
  background: #ffffff;
}
.guide-images figcaption {
  margin-top: 6px;
  font-size: 0.8125rem;
  line-height: 1.45;
  color: var(--text-2);
  word-break: keep-all;
}
/* 여러 장은 옆으로 넘겨 본다. 다음 사진이 살짝 보여 더 있는 것을 알 수 있다 */
.guide-images.many {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 6px;
}
.guide-images.many figure {
  flex: 0 0 86%;
  scroll-snap-align: start;
}
/* 높이를 맞춰 넘길 때 글자 위치가 튀지 않게 한다. 누르면 큰 그림이 열린다 */
.guide-images.many img {
  height: 340px;
  object-fit: contain;
}
.video-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  font-weight: 700;
  font-size: 0.9688rem;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid var(--accent-border);
  padding: 10px 14px;
  border-radius: var(--radius-s);
}
.video-link .icon {
  width: 20px;
  height: 20px;
}

/* ── 오류·경고 박스 ─────────────────────────────────────── */
.errors {
  background: var(--danger-soft);
  color: var(--danger-text);
  border: 1px solid var(--danger-border);
  border-radius: var(--radius-s);
  padding: 14px 16px;
  margin: 14px 0;
}
.errors ul {
  margin: 6px 0 0;
  padding-left: 18px;
}
.reasons {
  background: var(--warn-soft);
  color: var(--warn-text);
  border: 1px solid var(--warn-border);
  border-radius: var(--radius-s);
  padding: 14px 16px 14px 34px;
  margin: 14px 0;
}

/* ── 푸터 (Footer) ──────────────────────────────────────── */
.footer {
  max-width: 480px;
  margin: 0 auto;
  padding: 16px 16px 48px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 4px 8px;
  color: var(--text-3);
  font-size: 0.875rem;
  line-height: 1.6;
}
.footer-row {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-2);
  font-weight: 700;
  min-height: 44px;
  white-space: nowrap;
}
.footer-row .icon {
  width: 18px;
  height: 18px;
  color: var(--accent);
}
.footer-actions {
  display: flex;
  flex: none;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}
.footer-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 8px;
  color: var(--text-2);
  font-size: 0.8125rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}
.footer-actions .footer-link:last-child { margin-right: -8px; }
.chat-entry {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 10px;
}
.chat-entry .icon {
  width: 18px;
  height: 18px;
}

/* ── 문의하기 & 관리자 (/ask, /admin) ──────────────────── */
/* 관리자 로그인 */
.login-form {
  margin-top: 24px;
}
.login-form label {
  display: block;
  font-weight: 700;
  font-size: 0.9688rem;
  color: var(--text-2);
  margin-bottom: 20px;
}
.login-form label input {
  margin-top: 8px;
}
.ask textarea {
  min-height: 140px;
  resize: vertical;
  line-height: 1.55;
  font-size: 1.0625rem;
}
.ask label, .faq-form label {
  margin: 16px 0 6px;
  font-weight: 700;
  font-size: 0.9688rem;
  color: var(--text-2);
}
.ask label input, .ask label textarea, .faq-form input, .faq-form textarea, .faq-form select {
  margin-top: 6px;
  font-weight: 400;
  color: var(--text);
}
.consent {
  display: flex !important;
  align-items: flex-start;
  gap: 10px;
  font-weight: 600 !important;
  color: var(--text-2);
  margin-top: 14px;
}
.consent input {
  width: 22px;
  height: 22px;
  min-height: 0;
  margin-top: 2px;
  flex: none;
  padding: 0;
  -webkit-appearance: checkbox;
  appearance: auto;
  accent-color: var(--accent);
  cursor: pointer;
}
.track-link {
  word-break: break-all;
  background: var(--surface-alt);
  border: 1px solid var(--line);
  border-radius: var(--radius-s);
  padding: 12px 14px;
  font-size: 0.9063rem;
  font-family: monospace;
}
.admin-nav, .tabs {
  display: flex;
  gap: 8px;
  margin: 14px 0;
  flex-wrap: wrap;
}
.admin-nav a, .tabs a {
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--text-2);
  font-weight: 700;
  font-size: 0.9063rem;
  border: 1px solid var(--line);
  transition: all 0.15s;
}
.admin-nav a.on, .tabs a.on {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
}
.logout { margin-left: auto; }
.list-row.off { background: var(--surface-alt); border-style: dashed; }
.saved {
  background: var(--success-soft);
  color: #0f6b3a;
  border: 1px solid #bbf7d0;
  border-radius: var(--radius-s);
  padding: 12px 16px;
  margin: 12px 0;
  font-weight: 600;
}
.warn {
  color: var(--warn-text);
  background: var(--warn-soft);
  border: 1px solid var(--warn-border);
  border-radius: var(--radius-s);
  padding: 10px 14px;
}
.search-rows {
  list-style: none;
  margin: 0 0 16px;
  padding: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-s);
}
.search-rows li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}
.search-rows li[id] {
  scroll-margin-top: 80px;
}
.search-rows li:last-child {
  border-bottom: 0;
}
.search-row-text {
  flex: 1;
  min-width: 0;
}
.search-q {
  margin: 0 0 4px;
  font-weight: 600;
  overflow-wrap: anywhere;
}
.search-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 10px;
  margin: 0;
  font-size: 0.8125rem;
  color: var(--text-2);
}
.search-meta span {
  white-space: nowrap;
}
.search-rows form {
  flex: none;
  margin: 0;
}
.search-rows button {
  width: auto;
  min-height: 36px;
  padding: 6px 14px;
  font-size: 0.875rem;
  white-space: nowrap;
}
.search-rows .icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  padding: 0;
  color: var(--text-2);
}
.ai-state {
  display: inline-block;
  margin-left: 6px;
  font-weight: 600;
  color: var(--text-2);
}
.ai-state.done { color: var(--success, #15803d); }
.ai-state.held { color: var(--warn-text); }
.search-trash {
  margin-top: 24px;
}
.search-trash .search-rows {
  margin: 0 14px 14px;
}
.search-trash .hint {
  margin: 0 18px 14px;
}
/* 분류 칸에서 "직접 입력"을 골랐을 때만 보인다(:has를 모르는 브라우저에서는 늘 보인다) */
@supports selector(:has(a)) {
  .category-custom {
    display: none;
  }
  label:has(option[value="__custom__"]:checked) + .category-custom {
    display: block;
  }
}
.admin textarea {
  background: #ffffff;
  border-color: var(--line-strong);
  line-height: 1.5;
}
.admin textarea:focus {
  border-color: var(--accent);
}
.admin .card .section-label {
  margin: 0 0 8px;
}

/* ── 선선 홈페이지와 같은 맨 위 메뉴줄·맨 아래 회사 정보(11-12 사용자 요청) ──
   컴퓨터 화면은 손님 화면 전부, 휴대폰은 첫 화면에만 메뉴줄을 둔다(다른 화면은 뒤로 가기·제목 줄이 더 중요) */
.site-head { display: none; flex: none; background: #ffffff; border-bottom: 1px solid #f2f2f2; }
.home .site-head { display: block; }
.site-head-inner { position: relative; max-width: 1200px; min-height: 56px; margin: 0 auto; padding: 0 16px; display: flex; flex-wrap: wrap; align-items: center; gap: 0 16px; }
.site-logo { display: inline-flex; flex: none; align-items: center; height: 56px; }
.site-logo img { display: block; width: auto; height: 36px; }
.gnb { display: none; margin-left: auto; }
.gnb a { position: relative; padding: 8px 16px; color: #212121; font-size: 0.9375rem; text-decoration: none; white-space: nowrap; }
.gnb a:hover { color: var(--accent); }
.gnb a.on { font-weight: 700; }
.gnb a.on::after { content: ""; position: absolute; left: 16px; right: 16px; bottom: -2px; height: 2px; background: var(--brand-sky); }
.gnb-m { margin-left: auto; }
.gnb-m summary { display: inline-flex; align-items: center; min-height: 40px; padding: 0 14px; border: 1px solid var(--line-strong); border-radius: 8px; color: var(--text); font-size: 0.875rem; font-weight: 600; list-style: none; cursor: pointer; }
.gnb-m summary::-webkit-details-marker { display: none; }
.gnb-m[open] { flex: 0 0 100%; margin-left: 0; }
.gnb-m[open] summary { position: absolute; top: 8px; right: 16px; }
.gnb-m nav { display: flex; flex-direction: column; padding: 0 0 10px; border-top: 1px solid var(--line); }
.gnb-m nav a { padding: 12px; color: #212121; text-decoration: none; }
.gnb-m nav a.on { color: var(--accent); font-weight: 700; }
.site-foot { background: #1a1a1a; color: rgba(255, 255, 255, 0.72); font-size: 0.8125rem; line-height: 1.7; }
.site-foot-inner { max-width: 1200px; margin: 0 auto; padding: 32px 16px 40px; }
.site-foot img { display: block; width: auto; height: 36px; margin-bottom: 14px; }
.site-foot strong { display: block; margin-bottom: 6px; color: #ffffff; font-size: 0.875rem; }
.site-foot p { margin: 0; }
.site-foot p span { margin: 0 6px; color: rgba(255, 255, 255, 0.35); }
.site-foot-links { display: flex; flex-wrap: wrap; gap: 0 20px; margin-top: 18px; padding-top: 10px; border-top: 1px solid rgba(255, 255, 255, 0.12); }
.site-foot-links a { display: inline-flex; align-items: center; min-height: 40px; color: rgba(255, 255, 255, 0.8); text-decoration: none; }
.site-foot-links a:hover { color: #ffffff; }
.site-foot-tel { color: #ffffff; font-weight: 700; text-decoration: underline; text-underline-offset: 2px; }   /* 누르면 바로 전화(11-12) */
/* 아래 고정 단추가 있는 화면은 회사 정보 칸 끝이 가리지 않게 */
.has-bar .site-foot-inner { padding-bottom: calc(76px + 40px + env(safe-area-inset-bottom)); }

/* ── 반응형 및 데스크톱 뷰포트 최적화 ───────────────────── */
@media (min-width: 600px) {
  body {
    background: #e2e8f0;
  }
  .appbar, .page, .chat-dock, .footer {
    max-width: 480px;
    box-shadow: 0 0 24px rgba(15, 23, 42, 0.08);
  }
  /* 600~1023px은 본문이 가운데 480px이므로 맨 위 로고·맨 아래 회사 정보 안쪽도 같은 폭에 맞춘다(띠는 화면 끝까지, Codex 11-12) */
  .site-head-inner, .site-foot-inner { max-width: 480px; }
}

/* 360px 모바일 화면 가로스크롤 제로 보장 */
@media (max-width: 360px) {
  .page {
    padding-left: 10px;
    padding-right: 10px;
  }
  .prompts-grid {
    grid-template-columns: 1fr;
  }
  .guide-grid {
    grid-template-columns: 1fr;
  }
  .choices.inline {
    gap: 4px;
  }
  .choices.inline .choice {
    padding: 12px 2px;
    font-size: 0.9063rem;
  }
  .house {
    padding: 12px 10px;
  }
}

/* 접근성: 동작 줄이기 (prefers-reduced-motion) */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* 관리자 목록의 상태 글은 자르지 않는다(접수 시각, 견적, 연락처, 꺼짐) */
.admin .list-row .sub {
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
}

/* 관리자 문의: 연락처로 바로 전화·문자 */
.contact-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}
.contact-actions .button {
  flex: 1 1 auto;
  width: auto;
  margin: 0;
}

/* ── 하우스 배치·견적 ─────────────────────── */
/* 배치 화면은 앱처럼 고정한다. 페이지는 움직이지 않고 맵과 아래 패널만 움직인다 */
body.layout-page {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  overscroll-behavior: none;
}
.layout-page .appbar { position: static; flex: none; }
.layout-page .page {
  flex: 1;
  width: 100%;
  min-height: 0;
  padding: 0 0 calc(76px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.layout-page .page > .errors, .layout-page .page > noscript { flex: none; margin: 8px 12px; }
#layout-app { flex: 1; min-height: 0; display: flex; flex-direction: column; }
#layout-app[data-mode="field"] .lay-panel { display: none; }
#layout-app[data-mode="house"] .lay-panel { flex: 0 0 36%; }
#layout-app[data-mode="pipes"] .lay-panel { flex: 0 0 32%; }

/* 상단 3단계 탭: 단정하고 일관된 세그먼트 버튼 */
.lay-steps {
  flex: none;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  padding: 8px 12px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.lay-steps button {
  min-height: 38px;
  height: 38px;
  padding: 0 6px;
  font-size: 0.8438rem;
  font-weight: 700;
  color: var(--text-2);
  background: var(--surface-alt);
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  box-shadow: none;
  transition: all 0.15s ease-in-out;
}
.lay-steps button:active {
  background: var(--surface-hover);
}
.lay-steps button.todo::after {
  content: "";
  flex: none;
  width: 6px;
  height: 6px;
  margin-left: -3px;
  background: var(--warn);
  border-radius: 50%;
}
.lay-steps button.on {
  color: #ffffff;
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 2px 6px rgba(29, 78, 216, 0.22);
}
/* 견적을 눌렀는데 빠진 단계: 잠깐 반짝인다(layout.js missingSteps) */
.lay-steps button.flash { animation: lay-step-flash 0.6s ease-in-out 3; }
@keyframes lay-step-flash {
  0%, 100% { box-shadow: 0 0 0 0 rgba(217, 119, 6, 0); }
  50% { box-shadow: 0 0 0 4px rgba(217, 119, 6, 0.55); background: #fff7ed; border-color: #f59e0b; color: #92400e; }
}
.lay-steps button.on.flash { animation-name: lay-step-flash-on; }
@keyframes lay-step-flash-on {
  0%, 100% { box-shadow: 0 0 0 0 rgba(217, 119, 6, 0); }
  50% { box-shadow: 0 0 0 4px rgba(217, 119, 6, 0.55); }
}
#lay-submit[aria-disabled="true"] { opacity: 0.55; }
@media (prefers-reduced-motion: reduce) {
  .lay-steps button.flash { animation: none; box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.55); }
}

/* 캔버스 스테이지 */
.lay-stage {
  position: relative;
  flex: 1 1 0;
  min-height: 0;
  overflow: hidden;
  background: #f8fafc;
  border-block: 1px solid var(--line);
}
@media (min-width: 481px) {
  .lay-stage { border-inline: 1px solid var(--line); }
}

/* 상단 플로팅 컨트롤 규격 통일: 높이 36px, radius-pill */
.lay-link {
  position: absolute;
  top: 8px;
  left: 8px;
  display: flex;
  align-items: center;
  height: 36px;
  padding: 2px;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-sm);
}
#layout-app:not([data-mode="field"]) .lay-link { display: none; }
.lay-link button {
  min-width: 44px;
  height: 30px;
  min-height: 30px;
  padding: 0 10px;
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--text-2);
  background: transparent;
  border: 0;
  border-radius: var(--radius-pill);
  box-shadow: none;
  transition: all 0.15s ease;
}
.lay-link button.on {
  color: #ffffff;
  background: var(--accent);
}

.lay-pump-bar {
  position: absolute;
  top: 8px;
  left: 8px;
  display: none;
  align-items: center;
  gap: 6px;
}
#layout-app[data-mode="pipes"] .lay-pump-bar { display: flex; }
.lay-pump-tip {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 2;
  padding: 6px 10px;
  font-size: 0.8125rem;
  font-weight: 700;
  color: #ffffff;
  white-space: nowrap;
  background: var(--accent);
  border-radius: 8px;
  box-shadow: var(--shadow-md);
  pointer-events: none;
}
.lay-pump-tip::before {
  content: "";
  position: absolute;
  top: -5px;
  left: 18px;
  width: 10px;
  height: 10px;
  background: var(--accent);
  transform: rotate(45deg);
}
.lay-pump-toggle.on { animation: lay-pump-pulse 1.4s ease-out 3; }
@keyframes lay-pump-pulse {
  0% { box-shadow: 0 0 0 0 rgba(29, 78, 216, 0.5); }
  100% { box-shadow: 0 0 0 10px rgba(29, 78, 216, 0); }
}
@media (prefers-reduced-motion: reduce) {
  .lay-pump-toggle.on { animation: none; }
}
.lay-pump-toggle {
  min-height: 36px;
  height: 36px;
  padding: 0 14px;
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--text);
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-sm);
  transition: all 0.15s ease;
}
.lay-pump-toggle.on {
  color: #ffffff;
  background: var(--accent);
  border-color: var(--accent);
}
.lay-main-length {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  height: 36px;
  padding: 0 12px;
  font-size: 0.8125rem;
  font-weight: 800;
  color: var(--text);
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-sm);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.lay-zoom {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  align-items: center;
  height: 36px;
  padding: 2px;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-sm);
}
.lay-zoom button {
  width: 32px;
  min-width: 32px;
  height: 30px;
  min-height: 30px;
  padding: 0;
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--text);
  background: transparent;
  border: 0;
  border-radius: var(--radius-pill);
  box-shadow: none;
  transition: all 0.15s ease;
}
.lay-zoom button:active { background: var(--accent-soft); }
.lay-zoom #lay-zoom-fit { width: 42px; font-size: 0.8125rem; }
.lay-stage.fixed .lay-zoom { display: none; }

/* 본문 자간은 px로 물려받아 확대할수록 글자 크기에 비해 커진다. 그림 속 글자는 자간을 쓰지 않는다 */
#lay-svg text { letter-spacing: 0; }
#lay-svg {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

/* 폭 조절 바 (하우스 상세) */
.lay-tools { display: none; }
.lay-stage.fixed .lay-tools {
  position: absolute;
  right: 8px;
  bottom: 10px;
  left: 8px;
  display: flex;
  justify-content: center;
  pointer-events: none;
}
.lay-width {
  display: flex;
  align-items: center;
  gap: 2px;
  height: 40px;
  padding: 2px 4px;
  font-variant-numeric: tabular-nums;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-md);
  pointer-events: auto;
}
.lay-width strong { min-width: 46px; font-size: 0.9063rem; font-weight: 800; text-align: center; color: var(--text); }
.lay-width button {
  width: 34px;
  min-width: 34px;
  height: 34px;
  min-height: 34px;
  padding: 0;
  color: var(--accent);
  background: transparent;
  border: 0;
  border-radius: 50%;
  box-shadow: none;
  transition: all 0.15s ease;
}
.lay-width button:active:not(:disabled) { background: var(--accent-soft); }
.lay-width button:disabled { color: var(--line-strong); opacity: 0.35; }
.lay-mini-icon { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.lay-dim { fill: none; stroke: #94a3b8; stroke-width: 1px; vector-effect: non-scaling-stroke; pointer-events: none; }

/* 스크롤바 */
.lay-scroll {
  position: absolute;
  right: 12px;
  bottom: 6px;
  left: 12px;
  width: calc(100% - 24px);
  height: 20px;
  min-height: 0;
  margin: 0;
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
}
.lay-scroll:focus { outline: none; box-shadow: none; border: 0; }
.lay-scroll:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.lay-scroll::-webkit-slider-runnable-track { height: 4px; background: var(--line-strong); border-radius: 2px; }
.lay-scroll::-moz-range-track { height: 4px; background: var(--line-strong); border-radius: 2px; }
.lay-scroll::-webkit-slider-thumb { width: 44px; height: 14px; margin-top: -5px; background: var(--accent); border: 2px solid #ffffff; border-radius: 7px; -webkit-appearance: none; appearance: none; }
.lay-scroll::-moz-range-thumb { width: 40px; height: 10px; background: var(--accent); border: 2px solid #ffffff; border-radius: 7px; }

/* SVG 그래픽 꾸미기 */
.lay-shadow { fill: #64748b; fill-opacity: 0.14; pointer-events: none; }
.lay-house { stroke: #64a0e8; stroke-width: 1.5px; vector-effect: non-scaling-stroke; cursor: grab; }
.lay-house.on { stroke: var(--accent); stroke-width: 2.5px; }
.lay-house.open { fill-opacity: 0.3; stroke: #64a0e8; stroke-width: 1.5px; stroke-dasharray: 6 4; }
.lay-rib { fill: none; stroke: #ffffff; stroke-opacity: 0.85; stroke-width: 1.4px; vector-effect: non-scaling-stroke; pointer-events: none; }
.lay-rib.faint { stroke: #93c5fd; stroke-opacity: 0.6; stroke-width: 1px; }
.lay-ridge { stroke: #ffffff; stroke-opacity: 0.7; stroke-width: 1.5px; vector-effect: non-scaling-stroke; pointer-events: none; }
.lay-shine { stroke: #ffffff; stroke-opacity: 0.75; stroke-width: 3px; stroke-linecap: round; vector-effect: non-scaling-stroke; pointer-events: none; }
.lay-gable { fill: #eff6ff; stroke: #64a0e8; stroke-width: 1.5px; vector-effect: non-scaling-stroke; }
.lay-door { fill: #fef3c7; stroke: #b98a4a; stroke-width: 1.2px; vector-effect: non-scaling-stroke; pointer-events: none; }
.lay-door-line { stroke: #b98a4a; stroke-width: 1px; vector-effect: non-scaling-stroke; pointer-events: none; }
.lay-knob { fill: #92400e; pointer-events: none; }
.lay-tag { fill: #ffffff; fill-opacity: 0.95; stroke: #bfdbfe; stroke-width: 1px; vector-effect: non-scaling-stroke; pointer-events: none; }
.lay-label { fill: var(--text-2); font-weight: 600; pointer-events: none; }
.lay-label.strong { fill: var(--text); font-weight: 800; }
.lay-noz-line { stroke: var(--accent); stroke-width: 2px; vector-effect: non-scaling-stroke; pointer-events: none; }
.lay-noz-line.single { stroke: #0f766e; }
.lay-noz-line.big { stroke-width: 2px; }
.lay-nozzle { fill: #1f2937; pointer-events: none; }
.lay-nozzle-cone { fill: #ffffff; stroke: #2b6cb0; stroke-width: 1px; vector-effect: non-scaling-stroke; pointer-events: none; }
.lay-spray { fill: #38bdf8; fill-opacity: 0.16; pointer-events: none; }
.lay-handle { fill: var(--accent); stroke: #ffffff; stroke-width: 1.5px; vector-effect: non-scaling-stroke; pointer-events: none; }
.lay-handle-stem { stroke: var(--accent); stroke-width: 1.5px; vector-effect: non-scaling-stroke; pointer-events: none; }
.lay-arrow { cursor: ns-resize; }
.lay-arrow-bg { fill: #ffffff; stroke: var(--accent); stroke-width: 1.5px; vector-effect: non-scaling-stroke; }
.lay-arrow-mark { fill: none; stroke: var(--accent); stroke-width: 2px; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; pointer-events: none; }
.lay-hit { fill: transparent; cursor: grab; }
.lay-still { pointer-events: none; }
.lay-halo { stroke: #f8fafc; paint-order: stroke; }
.lay-grid { stroke: #e2e8f0; stroke-width: 1px; vector-effect: non-scaling-stroke; pointer-events: none; }
.lay-grid.zero { stroke: #cbd5e1; }
.lay-ruler { fill: #7c8aa0; font-weight: 600; stroke: #f8fafc; paint-order: stroke; pointer-events: none; }
.lay-hit-line { stroke: transparent; cursor: ew-resize; }
.lay-pipe { fill: none; stroke: #475569; stroke-width: 2px; vector-effect: non-scaling-stroke; stroke-linejoin: round; stroke-linecap: round; pointer-events: none; }
/* 나란한 주관 사이에 흰 틈을 두는 테두리. 갈래 색은 아래 갈래 카드 왼쪽 띠와 같다 */
.lay-pipe-case { fill: none; stroke: #ffffff; stroke-width: 5px; vector-effect: non-scaling-stroke; stroke-linejoin: round; stroke-linecap: round; pointer-events: none; }
.lay-pipe.g0 { stroke: #1d4ed8; }
.lay-pipe.g1 { stroke: #c2410c; }
.lay-pipe.g2 { stroke: #15803d; }
.lay-pipe.g3 { stroke: #7e22ce; }
.lay-pipe.g4 { stroke: #0e7490; }
.lay-stub { stroke: #94a3b8; stroke-width: 2px; vector-effect: non-scaling-stroke; pointer-events: none; }
.lay-marker.pump { fill: var(--accent); }
.lay-marker-dot { fill: #ffffff; pointer-events: none; }

/* 토스트 알림 */
.lay-toast {
  position: absolute;
  top: 50px;
  left: 50%;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 4px;
  width: max-content;
  max-width: calc(100% - 16px);
  min-height: 36px;
  padding: 4px 14px;
  font-size: 0.8125rem;
  line-height: 1.35;
  color: #ffffff;
  background: rgba(15, 23, 42, 0.9);
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-md);
  transform: translateX(-50%);
  animation: lay-toast-in 0.15s ease-out;
}
.lay-toast button {
  flex: none;
  min-height: 28px;
  margin-right: -8px;
  padding: 0 8px;
  font-size: 0.8125rem;
  color: #93c5fd;
  background: transparent;
  border: 0;
  box-shadow: none;
}
@keyframes lay-toast-in {
  from { opacity: 0; transform: translate(-50%, -4px); }
  to { opacity: 1; transform: translateX(-50%); }
}
@media (prefers-reduced-motion: reduce) {
  .lay-toast { animation: none; }
}
.lay-stage.fixed .lay-toast { top: 8px; }

/* ── 하단 조작 패널 (.lay-panel): 2·3탭 통일감 부여 ── */
.lay-panel {
  flex: none;
  display: grid;
  grid-auto-rows: max-content;   /* 내용이 넘쳐도 칸이 납작해지지 않고 패널이 스크롤된다 */
  align-content: start;
  gap: 8px;
  padding: 10px 12px;
  background: var(--bg);
  overflow-y: auto;
  overscroll-behavior: contain;
}
.lay-panel > * { min-width: 0; margin: 0; }
.lay-panel h2 { font-size: 1rem; font-weight: 800; color: var(--text); }
.lay-panel h3 { font-size: 0.9063rem; font-weight: 800; margin-top: 6px; color: var(--text); }

/* 노즐 설정 바 (노즐 줄 추가 + 노즐 간격): 높이 38px 통일 */
.lay-nozzle-bar { display: flex; align-items: center; gap: 6px; }
.lay-nozzle-bar .lay-tool { flex: 1 1 0; min-width: 0; min-height: 38px; height: 38px; padding: 0 6px; }
.lay-nozzle-bar .lay-select { flex: 0 0 146px; height: 38px; }

.lay-tool {
  min-height: 38px;
  height: 38px;
  padding: 0 12px;
  font-size: 0.8438rem;
  font-weight: 700;
  color: var(--accent);
  background: var(--surface);
  border: 1px solid var(--accent-border);
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-sm);
  transition: all 0.15s ease-in-out;
}
.lay-tool:active:not(:disabled) { background: var(--accent-soft); }

/* 노즐 줄 카드 (.lay-line): radius-s, 단정한 배치 */
.lay-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 48px;
  padding: 6px 8px 6px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-s);
  box-shadow: var(--shadow-sm);
}
.lay-line strong {
  min-width: 0;
  font-size: 0.9063rem;
  font-weight: 700;
  color: var(--text);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.lay-line .lay-kind {
  position: relative;
  gap: 4px;
  min-height: 28px;
  height: 28px;
  padding: 0 8px 0 10px;
  font-size: 0.7813rem;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  border-radius: var(--radius-pill);
  box-shadow: none;
  transition: all 0.15s ease;
}
.lay-line .lay-kind::after { content: ""; position: absolute; inset: -7px -3px; }
.lay-kind .lay-mini-icon { width: 12px; height: 12px; stroke-width: 2.4; }
.lay-line .lay-line-del {
  flex: none;
  width: 32px;
  min-width: 32px;
  min-height: 32px;
  height: 32px;
  padding: 0;
  font-size: 1.125rem;
  font-weight: 500;
  color: var(--text-3);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 50%;
  box-shadow: none;
  transition: all 0.15s ease;
}
.lay-line .lay-line-del:active {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: var(--danger-border);
}

/* 셀렉트 공통 (.lay-select) */
.lay-select {
  position: relative;
  display: block;
  height: 38px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.lay-select:focus-within { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-border); }
.lay-select span {
  position: absolute;
  top: 50%;
  left: 10px;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-2);
  white-space: nowrap;
  pointer-events: none;
  transform: translateY(-50%);
}
.lay-select select,
.lay-select select:focus {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  margin: 0;
  padding: 0 18px 0 36px;
  font-size: 1rem;   /* 16px 아래면 아이폰이 누를 때 화면을 확대한다 */
  font-weight: 700;
  color: var(--text);
  background-color: transparent;
  background-position: right 5px center;
  border: 0;
  border-radius: inherit;
  outline: none;
  box-shadow: none;
}
.lay-select.cap-3 select, .lay-select.cap-3 select:focus { padding-left: 47px; }
.lay-select.cap-4 select, .lay-select.cap-4 select:focus { padding-left: 62px; }
@media (max-width: 359px) {
  .lay-select select, .lay-select select:focus { padding-right: 6px; background-image: none; }
}

/* 배관·옵션: 3칸 분할 셀렉트 카드 (.lay-options) - radius-s(12px)로 통일 */
.lay-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-s);
  box-shadow: var(--shadow-sm);
}
.lay-options label.lay-select { height: 52px; background: transparent; border: 0; border-radius: 0; box-shadow: none; }
.lay-options label.lay-select + label.lay-select { border-left: 1px solid var(--line); }
.lay-options label.lay-select:focus-within { background: var(--accent-soft); box-shadow: none; }
.lay-options label.lay-select span { top: 7px; left: 12px; font-size: 0.6875rem; font-weight: 700; color: var(--text-3); transform: none; }
.lay-options label.lay-select select,
.lay-options label.lay-select select:focus {
  padding: 20px 22px 4px 12px;
  background-position: right 8px bottom 10px;
  background-size: 13px;
  border-radius: 0;
  font-size: 1rem;   /* 16px 아래면 아이폰이 누를 때 화면을 확대한다 */
  font-weight: 700;
}

/* 갈래 목록 (.lay-groups, .lay-group) */
.lay-groups { display: grid; gap: 8px; }
.lay-groups > * { margin: 0; }
.lay-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px 10px;
  min-height: 48px;
  padding: 6px 10px 6px 14px;
  font-size: 0.8125rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-s);
  box-shadow: var(--shadow-sm);
}
.lay-group strong {
  font-size: 0.8438rem;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.lay-group.bad { background: var(--warn-soft); border-color: var(--warn-border); }
.lay-group.g0 { border-left: 5px solid #1d4ed8; }
.lay-group.g1 { border-left: 5px solid #c2410c; }
.lay-group.g2 { border-left: 5px solid #15803d; }
.lay-group.g3 { border-left: 5px solid #7e22ce; }
.lay-group.g4 { border-left: 5px solid #0e7490; }
.lay-group.bad strong { color: var(--warn-text); }
.lay-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.chip-button {
  min-height: 28px;
  height: 28px;
  padding: 0 10px;
  font-size: 0.7813rem;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  border-radius: var(--radius-pill);
  box-shadow: none;
  transition: all 0.15s ease;
}
.chip-button:active {
  background: var(--accent);
  color: #ffffff;
}

/* 완료 버튼 및 결과 링크 */
.layout-page .bottom-bar-inner .lay-submit { flex: 1 1 auto; min-width: 0; }
.layout-page .bottom-bar-inner .lay-submit button { width: 100%; }
.layout-split h2, .layout-check h2 { font-size: 1rem; }
.layout-houses { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 6px; }
.layout-houses li { display: flex; justify-content: space-between; gap: 10px; font-size: 0.9375rem; font-variant-numeric: tabular-nums; }
.layout-houses li span { min-width: 0; }
.layout-houses li strong { flex: none; }
.layout-check { background: var(--warn-soft); border-color: var(--warn-border); }
.layout-check ul { margin: 0; padding-left: 18px; font-size: 0.9375rem; }

/* 상단 새로시작 아이콘 버튼 */
.desk-nav { display: none; }   /* 넓은 화면 상단 메뉴(아래 1024px 블록에서 보인다) */
.home-bar { display: none; }   /* 첫 화면 메뉴줄은 컴퓨터 화면에서만 */
.appbar-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  min-width: 40px;
  height: 40px;
  min-height: 40px;
  padding: 0;
  justify-self: end;
  color: var(--text);
  background: transparent;
  border: 0;
  border-radius: var(--radius-pill);
  box-shadow: none;
  transition: background-color 0.15s;
}
.appbar-icon:active { background: var(--surface-alt); }

/* SVG 인앱 버튼 */
.lay-icon-btn { cursor: pointer; }
.lay-icon-bg { fill: #ffffff; fill-opacity: 0.9; stroke: #e2e8f0; stroke-width: 1px; vector-effect: non-scaling-stroke; }
.lay-icon-mark { fill: none; stroke: #94a3b8; stroke-width: 1.4px; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; pointer-events: none; }
.lay-icon-btn.danger .lay-icon-mark { stroke: #d6a3a3; stroke-width: 1.8px; }
.lay-icon-btn.add .lay-icon-bg { stroke: #bfdbfe; }
.lay-icon-btn.add .lay-icon-mark { stroke: var(--accent); stroke-width: 1.8px; }
@media (hover: hover) {
  .lay-icon-btn.danger:hover .lay-icon-mark { stroke: var(--danger); }
  .lay-icon-btn.add:hover .lay-icon-mark { stroke: var(--accent); }
}

/* 확인 대화상자 */
.lay-dialog {
  width: min(300px, calc(100vw - 48px));
  padding: 18px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
}
.lay-dialog::backdrop { background: rgba(15, 23, 42, 0.45); }
.lay-dialog p { margin: 0 0 14px; font-size: 0.9375rem; font-weight: 600; }
.lay-dialog-actions { display: flex; justify-content: flex-end; gap: 6px; }
.lay-dialog-actions button { min-width: 60px; min-height: 38px; padding: 0 14px; font-size: 0.875rem; border-radius: var(--radius-s); }

/* ── 하우스 온도·습도 미리보기(임시 기능, sim.html) ─────────── */
.sim-form fieldset { margin: 0 0 12px; }
.sim-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 12px; }
.sim-field { display: flex; flex-direction: column; gap: 4px; font-size: 0.9375rem; font-weight: 600; color: var(--text-2); }
.sim-field small { font-weight: 500; color: var(--text-3); }
.sim-field input, .sim-field select { width: 100%; }
.sim-hint { font-size: 0.8125rem; font-weight: 500; color: var(--text-3); }
.sim-form details.help { margin: 4px 0 14px; }
.sim-result { margin-top: 24px; }
.sim-result h2 { font-size: 1.25rem; margin: 0 0 10px; }
.sim-result h3 { font-size: 1.0625rem; margin: 20px 0 8px; }
.sim-warn { display: grid; gap: 6px; margin: 0 0 12px; padding: 12px 14px; color: var(--warn-text); background: var(--warn-soft); border: 1px solid var(--warn-border); border-radius: var(--radius-s); }
.sim-warn p { display: flex; gap: 8px; margin: 0; font-size: 0.9375rem; line-height: 1.5; }
.sim-warn .icon { flex: none; width: 18px; height: 18px; margin-top: 2px; }
.sim-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.sim-card { display: flex; flex-direction: column; gap: 2px; padding: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-s); }
.sim-card span { font-size: 0.8125rem; color: var(--text-3); }
.sim-card strong { font-size: 1.125rem; font-variant-numeric: tabular-nums; }
.sim-figure { margin: 0 0 12px; padding: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-s); }
.sim-svg { display: block; width: 100%; height: auto; }
.sim-svg text { font-size: 21px; letter-spacing: 0; }   /* 그림이 휴대폰 폭(약 330px)으로 줄어도 읽히게. 넓은 화면은 아래에서 줄인다 */
.sim-house { fill: #eaf2fe; stroke: #6b8fd6; stroke-width: 2; }
.sim-ground { stroke: #94a3b8; stroke-width: 2; }
.sim-spray { fill: rgba(59, 130, 246, 0.12); }
.sim-nz-body { fill: #1f2937; }
.sim-nz-head { fill: #ffffff; stroke: #2b6cb0; stroke-width: 1; }
.sim-scene .sky-top { stop-color: #8fcbf2; } .sim-scene .sky-bottom { stop-color: #e9f6ff; }
.sim-scene.hot .sky-top { stop-color: #f6c77e; } .sim-scene.hot .sky-bottom { stop-color: #fff1da; }
.sim-scene.cloudy .sky-top { stop-color: #aeb9c6; } .sim-scene.cloudy .sky-bottom { stop-color: #e4e9ee; }
.sim-scene.night .sky-top { stop-color: #1d2a44; } .sim-scene.night .sky-bottom { stop-color: #3d4f6e; }
.sim-moon { fill: #f3efd2; }
.sim-sun circle { fill: #ffd34d; } .sim-sun line { stroke: #ffd34d; stroke-width: 3; }
.sim-cloud ellipse { fill: rgba(255, 255, 255, 0.92); }
.sim-hill { fill: #8cc27b; } .sim-field { fill: #c9dfa8; }
.sim-film { fill: rgba(240, 248, 255, 0.62); } .sim-frame-line { fill: none; stroke: #51ace1; stroke-width: 2; }
.sim-vent { fill: #2b6cb0; } .sim-crop { fill: #52a73d; } .sim-wire { stroke: #2b6cb0; stroke-width: 1.5; }
.sim-mist circle { fill: #80c0ea; } .sim-fan circle { fill: #fff; stroke: #2b6cb0; } .sim-fan path { fill: #2b6cb0; }
.sim-badge rect { fill: rgba(255, 255, 255, 0.9); } .sim-badge text { fill: var(--text); font-weight: 700; }
.sim-line { stroke-width: 1.5; }
.sim-line.twin { stroke: var(--accent); }
.sim-line.single { stroke: #0f766e; }
.sim-dim { fill: var(--text-2); font-weight: 600; }
.sim-on { fill: rgba(59, 130, 246, 0.24); }
.sim-grid { stroke: #e2e8f0; stroke-width: 1; }
.sim-frame { fill: none; stroke: #cbd5e1; stroke-width: 1; }
.sim-axis { fill: var(--text-3); }
.sim-axis.t { fill: #c2410c; }
.sim-axis.rh { fill: #1d4ed8; }
.sim-t { fill: none; stroke: #c2410c; stroke-width: 2.5; stroke-linejoin: round; }
.sim-rh { fill: none; stroke: #1d4ed8; stroke-width: 2; stroke-linejoin: round; }
.sim-ref { stroke-width: 1.5; stroke-dasharray: 5 4; }
.sim-ref.out { stroke: #f59e0b; }
.sim-ref.wb { stroke: #0f766e; }
.sim-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 6px; font-size: 0.8125rem; color: var(--text-2); }
.sim-legend .k::before { content: ""; display: inline-block; width: 16px; height: 3px; margin-right: 6px; vertical-align: middle; border-radius: 2px; }
.sim-legend .k.t::before { background: #c2410c; }
.sim-legend .k.rh::before { background: #1d4ed8; }
.sim-legend .k.out::before { background: #f59e0b; }
.sim-legend .k.wb::before { background: #0f766e; }
.sim-legend .k.on::before { height: 10px; background: rgba(59, 130, 246, 0.30); }
.sim-canvas { display: block; width: 100%; height: auto; aspect-ratio: 100 / 58; border-radius: 10px; background: #e9f6ff; }
.sim-scene-cap { display: flex; justify-content: space-between; gap: 8px; margin: 8px 2px 0; font-size: 0.9375rem; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.sim-scene-cap span:last-child { color: #1d4ed8; }
.sim-facts { margin: 0; padding-left: 18px; font-size: 0.9375rem; line-height: 1.7; }
.sim-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; font-variant-numeric: tabular-nums; }
.sim-table th, .sim-table td { padding: 4px 8px; text-align: right; border-bottom: 1px solid var(--line); }
@media (min-width: 600px) {
  .sim-svg text { font-size: 14px; }
}

/* ── 미리보기 조작 화면(sim_ui.js, 창중대 2단계 설정 화면 규칙) ─────────── */
.sim-page { --sim-navy: #1b2350; --sim-sky: #2b9bd8; --sim-sky-strong: #1c6fb0; --sim-custom: #4b56c6; --sim-faint: #55618c; --sim-line: #dce6f2; }   /* 작은 글자는 4.5:1 이상(흐린 글자 #55618c, 고른 버튼 #1c6fb0) */
.sim-app:not(.live) .sim-controls { display: none; }
.sim-app.live .sim-fallback { display: none; }
/* 하우스 칸은 맨 위에 두되 고정하지 않는다(11-10 사용자: 휴대폰에서 고정하니 설정 칸이 좁고, 스크롤하다 값이 바뀜) */
.sim-stage {
  margin: 0 -16px 12px; padding: 8px 16px 10px;
  background: #edf4fb; border-bottom: 1px solid var(--sim-line);
}
.sim-stage .sim-canvas { display: block; width: min(100%, calc(42vh / 0.58)); margin: 0 auto; }
.sim-live { display: grid; gap: 2px; margin-top: 8px; color: var(--sim-navy); }
.sim-live-main { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; }
.sim-live-label { flex: 1 0 100%; font-size: 0.8125rem; font-weight: 700; color: #55618c; }
.sim-live-num b { font-size: 1.875rem; font-weight: 900; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.sim-live-num small { margin-left: 1px; font-size: 0.9375rem; font-weight: 700; color: #55618c; }
.sim-live-num.rh b { color: var(--sim-sky); }
.sim-live-drop { margin-left: auto; font-size: 0.875rem; font-weight: 700; color: #1c6fb0; }
.sim-live-drop b { font-variant-numeric: tabular-nums; }
.sim-live-sub { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 0.8125rem; color: #55618c; }
.sim-live-warn { padding: 2px 10px; font-size: 0.8125rem; font-weight: 800; color: var(--warn-text); background: var(--warn-soft); border: 1px solid var(--warn-border); border-radius: var(--radius-pill); text-decoration: none; }
.sim-live-note { margin: 4px 0 0; font-size: 0.875rem; font-weight: 700; color: var(--danger-text); }

.sim-controls { display: grid; gap: 12px; margin-bottom: 16px; }
.sim-col { display: contents; }   /* 아주 넓은 화면에서만 두 줄 묶음이 된다(1440px 블록) */
.sim-panel {
  position: relative; padding: 14px 16px 16px; background: #ffffff; border: 1px solid var(--sim-line); border-radius: 12px;
  box-shadow: 0 1px 3px rgba(39, 46, 126, 0.06);
}
.sim-panel::before, .sim-panel::after {   /* 모서리 장식(창중대 HudPanel) */
  content: ""; position: absolute; width: 14px; height: 14px; border: 2px solid #9fc7e8; pointer-events: none;
}
.sim-panel::before { top: -1px; left: -1px; border-right: 0; border-bottom: 0; border-top-left-radius: 12px; }
.sim-panel::after { right: -1px; bottom: -1px; border-left: 0; border-top: 0; border-bottom-right-radius: 12px; }
.sim-panel-title { margin: 0 0 4px; padding-left: 10px; font-size: 1rem; font-weight: 800; color: var(--sim-navy); border-left: 3px solid var(--sim-sky); line-height: 1.2; }
details.sim-adv > summary { cursor: pointer; list-style: none; }
details.sim-adv > summary::-webkit-details-marker { display: none; }
details.sim-adv > summary::after { content: " ▾"; color: var(--sim-faint); }
details.sim-adv[open] > summary::after { content: " ▴"; }
.sim-note { margin: 6px 0 2px; font-size: 0.8125rem; line-height: 1.5; color: var(--sim-faint); }
.sim-row { padding-top: 10px; }
.sim-row-top { display: flex; align-items: baseline; gap: 8px; }
.sim-row-name { font-size: 0.9375rem; font-weight: 700; color: var(--sim-navy); }
.sim-row-base { margin-left: auto; font-size: 0.75rem; color: var(--sim-faint); }
.sim-row-value { color: var(--sim-navy); white-space: nowrap; }
.sim-row-base:empty + .sim-row-value { margin-left: auto; }
.sim-row-value b { font-size: 1.1875rem; font-weight: 900; font-variant-numeric: tabular-nums; }
.sim-row-value small { font-size: 0.8125rem; color: var(--sim-faint); }
.sim-row.custom .sim-row-value b { color: var(--sim-custom); }
.sim-row-bar { display: flex; align-items: center; gap: 10px; margin-top: 4px; }
.sim-step {
  flex: none; width: 38px; height: 38px; min-height: 38px; padding: 0; border-radius: 50%;
  font-size: 1.25rem; font-weight: 700; line-height: 1; color: var(--sim-navy); background: #ffffff; border: 1.5px solid #bfd1e6;
  touch-action: manipulation; user-select: none; -webkit-user-select: none;
}
.sim-step:active:not(:disabled) { background: #e6f2fb; }
.sim-range {
  --fill: 50%; flex: 1; min-width: 0; height: 28px; min-height: 28px; margin: 0; padding: 0; background: transparent; -webkit-appearance: none; appearance: none;
  border: 0; border-radius: 0; box-shadow: none;
  touch-action: pan-y;   /* 세로로 밀면 페이지가 스크롤되고 슬라이더 값은 그대로 */
}
.sim-range:focus { outline: none; box-shadow: none; }
.sim-range:focus-visible { outline: 2px solid var(--sim-sky); outline-offset: 4px; border-radius: 6px; }
.sim-range::-webkit-slider-runnable-track { height: 5px; border-radius: 3px; background: linear-gradient(to right, var(--sim-sky) var(--fill), #dce6f2 var(--fill)); }
.sim-range::-moz-range-track { height: 5px; border-radius: 3px; background: #dce6f2; }
.sim-range::-moz-range-progress { height: 5px; border-radius: 3px; background: var(--sim-sky); }
.sim-range::-webkit-slider-thumb { -webkit-appearance: none; width: 22px; height: 22px; margin-top: -8.5px; border-radius: 50%; background: var(--sim-sky); border: 2px solid #ffffff; box-shadow: 0 1px 4px rgba(27, 35, 80, 0.3); }
.sim-range::-moz-range-thumb { width: 20px; height: 20px; border-radius: 50%; background: var(--sim-sky); border: 2px solid #ffffff; box-shadow: 0 1px 4px rgba(27, 35, 80, 0.3); }
.sim-row.custom .sim-range::-webkit-slider-runnable-track { background: linear-gradient(to right, var(--sim-custom) var(--fill), #dce6f2 var(--fill)); }
.sim-row.custom .sim-range::-webkit-slider-thumb { background: var(--sim-custom); }
.sim-row.custom .sim-range::-moz-range-progress, .sim-row.custom .sim-range::-moz-range-thumb { background: var(--sim-custom); }
.sim-range:disabled { opacity: 0.4; }
/* 손가락 화면: 손잡이를 잡았을 때만 값이 바뀐다. 막대를 스치면 페이지가 스크롤된다(스크롤하다 값이 바뀌던 문제) */
@media (pointer: coarse) {
  .sim-range { pointer-events: none; }
  .sim-range::-webkit-slider-thumb { pointer-events: auto; width: 28px; height: 28px; margin-top: -11.5px; }
  .sim-range::-moz-range-thumb { pointer-events: auto; width: 26px; height: 26px; }
}
.sim-pills { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.sim-pill {
  flex: 1 1 0; min-width: max-content; min-height: 40px; padding: 0 12px; border-radius: var(--radius-pill);
  font-size: 0.9375rem; font-weight: 700; color: var(--sim-navy); background: #ffffff; border: 1.5px solid #bfd1e6;
}
.sim-pill.on { color: #ffffff; background: var(--sim-sky-strong); border-color: var(--sim-sky-strong); }
.sim-presets { margin-top: 8px; }
.sim-presets-name { font-size: 0.8125rem; font-weight: 700; color: #55618c; }
.sim-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.sim-chip { min-height: 34px; padding: 0 12px; border-radius: var(--radius-pill); font-size: 0.8125rem; font-weight: 700; color: #1c6fb0; background: #eef6fd; border: 1px solid #c5def3; }
.sim-layouts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 8px; }
.sim-layout {
  display: flex; flex-direction: column; align-items: stretch; gap: 4px; min-height: 0; padding: 4px 4px 8px; border-radius: 10px;
  font-size: 0.75rem; font-weight: 700; line-height: 1.3; color: var(--sim-navy); background: #ffffff; border: 1.5px solid #dce6f2;
}
.sim-layout.on { color: #1c6fb0; border-color: var(--sim-sky); box-shadow: 0 0 0 2px rgba(43, 155, 216, 0.18); }
.sim-layout-pic { display: block; width: 100%; aspect-ratio: 100 / 58; border-radius: 6px; }
.sim-layout-n { font-size: 0.8125rem; font-weight: 800; }
.sim-layout-d { font-size: 0.75rem; font-weight: 600; overflow-wrap: anywhere; }
.sim-select-wrap { display: block; }
.sim-target { margin: 8px 0 0; padding: 8px 10px; font-size: 0.8125rem; font-weight: 600; line-height: 1.5; color: #2f6b1f; background: #eef7e9; border-radius: 8px; }
.sim-opt { margin-top: 8px; }
.sim-opt-btn { width: 100%; min-height: 46px; border-radius: 12px; font-size: 1rem; font-weight: 800; color: #ffffff; background: var(--sim-sky-strong); border: 0; }
.sim-opt-btn:disabled { opacity: 0.7; }
.sim-heat { margin-top: 6px; }
.sim-heat-btn { width: 100%; min-height: 42px; border-radius: 10px; font-size: 0.9375rem; font-weight: 700; color: #9a3412; background: #fff7ed; border: 1.5px solid #fdba74; }
.sim-heat-msg:empty { display: none; }
.sim-wx { margin-top: 6px; padding: 8px 10px; border-radius: 10px; background: #eef6fd; color: #1f4f7a; }
.sim-wx.bad { background: #fdf0ef; color: #9b2c22; }
.sim-wx a { color: inherit; text-decoration: underline; }
.sim-opt-box { margin-top: 8px; padding: 10px; border: 1.5px solid #c5def3; border-radius: 10px; background: #f6fbff; }
.sim-opt-table { width: 100%; border-collapse: collapse; font-size: 0.8125rem; font-variant-numeric: tabular-nums; }
.sim-opt-table th, .sim-opt-table td { padding: 5px 4px; text-align: left; border-bottom: 1px solid var(--sim-line); }
.sim-opt-table tbody th { color: #1c6fb0; }
.sim-opt-table td.over { color: var(--danger-text); font-weight: 800; }
.sim-opt-msg { margin: 8px 0 0; font-size: 0.875rem; font-weight: 600; color: var(--sim-navy); }
.sim-opt-msg.good { color: #2f6b1f; } .sim-opt-msg.bad { color: var(--danger-text); }
.sim-opt-actions { display: flex; gap: 8px; margin-top: 8px; }
.sim-opt-apply { flex: 2; min-height: 42px; border-radius: 10px; font-weight: 800; color: #ffffff; background: var(--sim-sky-strong); border: 0; }
.sim-opt-close { flex: 1; min-height: 42px; border-radius: 10px; font-weight: 700; color: #55618c; background: #ffffff; border: 1.5px solid #bfd1e6; }
.sim-live-chips { display: inline-flex; gap: 6px; align-items: center; }
.sim-live-crop:empty { display: none; }
.sim-live-crop { padding: 2px 10px; font-size: 0.8125rem; font-weight: 800; border-radius: var(--radius-pill); }
.sim-live-crop.good { color: #2f6b1f; background: #eef7e9; border: 1px solid #bfe0ad; }
.sim-live-crop.bad { color: var(--danger-text); background: var(--danger-soft); border: 1px solid var(--danger-border); }
.sim-live-crop.mid { color: var(--warn-text); background: var(--warn-soft); border: 1px solid var(--warn-border); }
.sim-band { fill: rgba(82, 167, 61, 0.13); }
.sim-cap { stroke: #1d4ed8; stroke-width: 1.5; stroke-dasharray: 2 4; }
.sim-legend .k.band::before { height: 10px; background: rgba(82, 167, 61, 0.25); }
.sim-legend .k.cap::before { height: 0; border-top: 2px dotted #1d4ed8; }
.sim-select { width: 100%; min-height: 44px; margin-top: 4px; padding: 0 12px; font-size: 1rem; font-weight: 700; color: var(--sim-navy); background: #ffffff; border: 1.5px solid #bfd1e6; border-radius: 10px; }
.sim-auto { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: 0.875rem; font-weight: 600; color: var(--sim-navy); }
.sim-auto input { width: 20px; height: 20px; accent-color: var(--sim-sky); }
.sim-foot { display: flex; gap: 8px; }
.sim-reset { flex: 1; min-height: 46px; border-radius: 12px; font-weight: 700; color: #55618c; background: #ffffff; border: 1.5px solid #bfd1e6; }
.sim-reset:disabled { opacity: 0.45; }

/* ── 넓은 화면(PC, 1024px 이상) ─────────────────────────
   휴대폰·태블릿(1023px까지)은 위의 480px 한 줄 구성을 그대로 쓴다.
   넓은 화면에서는 글 읽는 화면은 820px, 첫 화면은 두 칸, 배치 화면은 배치도 옆에 설정 패널을 둔다. */
@media (min-width: 1024px) {
  /* 모든 화면 공통(11-11 사용자 요청: 휴대폰 틀처럼 가운데 회색 테두리 속에 보이던 모양 대신 일반 웹 모양).
     메뉴줄은 화면 끝까지 흰 띠, 안쪽 글자는 1200px 폭에 맞춘다. 본문은 글 읽기 좋은 880px(첫 화면 1200px) */
  body { background: var(--bg); }
  .appbar, .page, .chat-dock, .footer { box-shadow: none; }
  .page, .chat-dock, .footer { max-width: 880px; }
  .page { padding: 20px 28px 48px; }
  .bottom-bar-inner { max-width: 824px; justify-content: flex-end; }
  .bottom-bar-inner > .primary { flex: 0 1 280px; }
  .appbar, .chat-page .appbar, .admin .appbar {
    max-width: none; display: flex; align-items: center; gap: 12px;
    padding: 0 max(24px, calc((100vw - 1200px) / 2));
    background: #ffffff; border-bottom: 1px solid var(--line);
  }
  /* 맨 위에 홈페이지 메뉴줄(로고·기업소개…)을 두고, 그 아래 줄은 도우미 안 메뉴만(11-12).
     처음으로 가기는 '처음' 단추가, 화면 이름은 지금 화면 표시가 대신해서 뒤로 가기·제목은 글 읽기 프로그램에만 남긴다 */
  .site-head { display: block; }
  .site-head-inner { max-width: 1200px; height: 64px; padding: 0 24px; }
  .site-foot-inner { max-width: 1200px; }
  .site-logo { height: 64px; }
  .site-logo img { height: 42px; }
  .gnb { display: flex; gap: 4px; }
  .gnb-m { display: none; }
  .site-foot-inner { padding: 40px 24px 44px; }
  .appbar .appbar-back { display: none; }
  .appbar-title, .chat-header-title { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
  .desk-nav-label { align-self: center; margin-right: 10px; color: var(--text-3); font-size: 0.8125rem; font-weight: 700; white-space: nowrap; }
  /* 제목이 먼저 줄어들고(말줄임) 메뉴·아이콘은 제 폭을 지킨다(Codex 11-11) */
  .desk-nav { display: flex; flex: 1 1 auto; min-width: 0; gap: 4px; }
  .appbar-icon, .chat-header-actions { flex: none; margin-left: auto; }
  .admin .appbar-link { margin-left: auto; }
  .desk-nav a { padding: 7px 14px; border-radius: 999px; color: var(--text-2); font-size: 0.9375rem; font-weight: 600; text-decoration: none; white-space: nowrap; }
  .desk-nav a:hover { background: var(--surface-alt); color: var(--text); }
  .desk-nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent-press); box-shadow: inset 0 0 0 1px var(--accent-border); }
  .home-bar { display: flex; position: sticky; }

  /* 첫 화면: 왼쪽 상담, 오른쪽 계산·안내 */
  .home .page { max-width: 1200px; }
  .home-container {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 20px 28px;
    align-items: start;
    padding-top: 24px;
  }
  .home-container > .hero { grid-column: 1 / -1; }
  .home .hero { margin: 0; padding: 40px 24px 36px; }
  .hero h1 { font-size: 1.875rem; }
  .hero p { margin-top: 10px; font-size: 0.9375rem; }

  /* 상담: 말풍선이 한 줄에 더 많이 들어간다 */
  .chat-page .page { padding: 20px 28px; }

  /* 미리보기·배치·견적: 넓은 화면을 꽉 채운다(가운데 좁은 휴대폰형 대신, 11-11 사용자 요청) */
  .layout-page .appbar { padding: 0 24px; }
  .layout-page .site-head-inner { max-width: none; }
  .layout-page .page { max-width: none; padding-inline: 24px; }

  /* 하우스 배치: 배치도 왼쪽, 설정 패널 오른쪽 */
  .layout-page .bottom-bar-inner { max-width: none; padding-inline: 24px; justify-content: flex-end; }
  .layout-page .bottom-bar-inner .lay-submit { flex: 0 1 380px; }
  #layout-app {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 380px;
    grid-template-rows: auto minmax(0, 1fr);
  }
  #layout-app[data-mode="field"] { grid-template-columns: minmax(0, 1fr); }
  /* 세 단계 탭은 가운데에 붙여 둔다. 화면 폭을 셋으로 나누면 큰 모니터에서 탭 사이가 600px 넘게 벌어졌다(11-11 사용자 지적) */
  .lay-steps { grid-column: 1 / -1; grid-template-columns: repeat(3, 176px); justify-content: center; gap: 8px; padding-inline: 16px; }
  .lay-steps button { width: 100%; }
  .lay-stage { grid-column: 1; grid-row: 2; }
  #layout-app[data-mode] .lay-panel {
    grid-column: 2;
    grid-row: 2;
    flex: none;
    min-height: 0;
    padding: 14px 16px;
    border-left: 1px solid var(--line);
  }

  /* 하우스 온도·습도 미리보기 */

  .sim-page .page, .sim-page .footer { max-width: none; }
  .sim-app { display: grid; grid-template-columns: minmax(0, 1fr) 440px; gap: 0 24px; align-items: start; }
  .sim-main { display: contents; }
  .sim-stage { position: static; grid-column: 1; grid-row: 1; margin: 0 0 12px; padding: 12px; border: 1px solid var(--sim-line); border-radius: 12px; }
  .sim-stage .sim-canvas { width: min(100%, calc(48vh / 0.58)); }
  .sim-controls, .sim-fallback { grid-column: 2; grid-row: 1 / span 3; }
  /* 넓은 화면(스크립트 없을 때): 하우스·결과는 왼쪽, 조작 칸은 오른쪽에 붙어 따로 스크롤 */
  .sim-controls { position: sticky; top: 68px; max-height: calc(100vh - 84px); overflow-y: auto; overscroll-behavior: contain; padding: 2px 4px 8px 2px; }
  /* 넓은 화면(스크립트 동작): 페이지 전체는 움직이지 않고 왼쪽(.sim-left: 하우스·결과·바닥글)과 오른쪽(.sim-main: 조작 칸)이
     각자 스크롤한다. 예전 sticky/fixed 방식은 왼쪽을 내리면 페이지가 같이 밀려 오른쪽이 잘리거나 뚫려 보였다(11-10 사용자 지적 두 번) */
  body.sim-live-page { height: 100vh; height: 100dvh; overflow: hidden; }
  .sim-live-page .page { height: calc(100vh - 56px - 65px); height: calc(100dvh - 56px - 65px); min-height: 0; padding: 12px 24px 0; }
  .sim-app.live { height: 100%; grid-template-rows: minmax(0, 1fr); align-items: stretch; }
  .sim-app.live .sim-left { grid-column: 1; grid-row: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 0 8px 12px 0; }
  .sim-app.live .sim-main { display: block; grid-column: 2; grid-row: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 2px 4px 16px 2px; }
  .sim-app.live .sim-controls { position: static; max-height: none; overflow: visible; padding: 0; }
  .sim-app.live .sim-left > * { grid-column: auto; grid-row: auto; }
  .sim-app.live .sim-left > .footer { max-width: none; padding: 20px 4px 8px; }
  .sim-result { grid-column: 1; grid-row: 2; margin-top: 0; }
  .sim-main > details { grid-column: 1; grid-row: 3; }

  .sim-fields { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  /* 고르는 단추가 3개·4개면 같은 폭으로 한 줄에 놓는다(마지막 하나만 아랫줄로 떨어지지 않게) */
  /* :has()를 모르는 브라우저는 예전처럼 글자 폭대로 줄바꿈한다(Codex 11-11) */
  @supports selector(:has(*)) {
    .sim-pills:has(> :nth-child(3):last-child) { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .sim-pills:has(> :nth-child(4):last-child) { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .sim-pills:has(> :nth-child(3):last-child) > *, .sim-pills:has(> :nth-child(4):last-child) > * { min-width: 0; padding-inline: 6px; }
  }
  /* 칸이 좁으면 숫자를 꺾지 않고 두 줄(2×2)로 놓는다 */
  .sim-cards { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }

  /* 컴퓨터 화면의 미리보기 크기 다듬기(11-11 사용자: 다른 사이트에 비해 글자·단추가 너무 커 징그럽다).
     휴대폰은 손가락 크기(38~40px 단추, 16px 글자)를 그대로 두고, 1024px 이상에서만 일반 웹 수준(15px 글자, 30~32px 단추)으로 줄인다.
     미리보기는 아주 넓은 모니터에서도 내용 폭을 1600px로 묶는다(메뉴줄 배경은 끝까지, 글자는 내용과 줄을 맞춘다) */
  html.desk-tool { font-size: 15px; }   /* 작은 글씨(0.8125rem)가 12px 이상이 되게 */
  .sim-page .appbar { padding-inline: max(24px, calc((100vw - 1600px) / 2 + 24px)); }
  .sim-page .site-head-inner { max-width: 1600px; }   /* 홈페이지 메뉴줄 로고도 아래 줄·본문과 같은 줄에 맞춘다(11-12) */
  .sim-page .page, .sim-page .footer { max-width: 1600px; margin-inline: auto; }
  .sim-stage .sim-canvas { width: min(100%, calc(44vh / 0.58)); }
  .sim-panel { padding: 12px 14px 14px; }
  .sim-row { padding-top: 8px; }
  .sim-row-bar { gap: 8px; margin-top: 2px; }
  /* 조작부는 마우스 화면에서만 줄인다. 손가락 태블릿(가로 1024 이상)은 휴대폰 크기 그대로(Codex 11-11) */
  @media (pointer: fine) {
    .sim-step { width: 30px; height: 30px; min-height: 30px; font-size: 1.0625rem; border-width: 1px; }
    .sim-range { height: 22px; min-height: 22px; }
    .sim-range::-webkit-slider-runnable-track { height: 4px; }
    .sim-range::-moz-range-track, .sim-range::-moz-range-progress { height: 4px; }
    .sim-range::-webkit-slider-thumb { width: 16px; height: 16px; margin-top: -6px; }
    .sim-range::-moz-range-thumb { width: 14px; height: 14px; }
    .sim-pills { gap: 6px; }
    .sim-pill { min-height: 32px; padding: 0 10px; font-size: 0.9286rem; border-width: 1px; }
  }
  .sim-opt-btn { min-height: 40px; font-size: 1rem; }
  .sim-heat-btn, .sim-reset { min-height: 38px; }
  .sim-live-num b { font-size: 1.75rem; }
  .sim-card { padding: 10px 12px; }
  .sim-card strong { font-size: 1.0714rem; }
  .sim-svg text { font-size: 12px; }   /* 그래프는 실제 화면 폭으로 그려(sim_ui.js chart) 글자가 화면 폭 따라 커지지 않는다 */
  .sim-row-base, .sim-layout-d { font-size: 0.8125rem; }
  /* 15px 기준에서도 작은 글씨가 12px 밑으로 내려가지 않게(첫 화면 카드 설명·안내 영상 길이·작은 표·작은 단추) */
  html.desk-tool .guide-sub, html.desk-tool .list-row .sub, html.desk-tool .brand-badge, html.desk-tool .brand small, html.desk-tool .msg.bot .no-answer button.secondary { font-size: 0.8125rem; }
}

/* 아주 넓은 화면(1440px 이상): 미리보기 조작 칸을 두 줄(단)로 펼치고, 배치·견적 설정 칸도 넓힌다 */
@media (min-width: 1440px) {
  /* 오른쪽 조작 칸은 화면의 46%(최소 640px)만 쓴다. 고정 860px이면 맥북 폭(1470px 안팎)에서 왼쪽 하우스·결과 칸이 530px로 좁아져
     결과 숫자가 두 줄로 꺾였다(11-11 사용자 지적) */
  .sim-app { grid-template-columns: minmax(0, 1fr) minmax(640px, 46%); gap: 0 28px; }
  /* 조작 칸을 두 줄로 고정한다(왼쪽·오른쪽 묶음이 각자 아래로만 늘어난다) */
  .sim-app.live .sim-controls { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; gap: 0 16px; }
  .sim-app.live .sim-col { display: grid; gap: 12px; align-content: start; }
  @supports selector(:has(*)) { .sim-app.live .sim-pills:has(> :nth-child(4):last-child) { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
  .sim-stage .sim-canvas { width: min(100%, calc(48vh / 0.58)); }   /* 큰 모니터에서 하우스 그림이 화면을 다 차지하지 않게(11-11) */
  #layout-app { grid-template-columns: minmax(0, 1fr) 440px; }
}
