/* =============================================================================
   mass_study.css — 개략 가설계(매스 스터디) 패널 · 3D 뷰 (2026-11-29 초안)
   index.html 의 style.css 뒤에 링크하세요. :root 토큰만 사용합니다.
   ========================================================================== */

body.ms-body-lock { overflow: hidden; }

.ms-overlay {
  position: fixed; inset: 0; z-index: 330;
  background: rgba(9, 22, 38, .48);
  display: flex; align-items: center; justify-content: center; padding: 14px;
}
.ms-shell {
  width: 1180px; max-width: 100%; height: 94vh; max-height: 94vh;
  display: flex; flex-direction: column;
  background: #fff; border-radius: 14px; box-shadow: var(--shadow-lg, 0 18px 48px rgba(9,27,48,.22));
  overflow: hidden;
}

/* ── 헤더 ── */
.ms-head {
  display: flex; align-items: center; gap: 10px; padding: 11px 14px;
  border-bottom: 1px solid var(--line, #dfe6ef);
  background: linear-gradient(180deg, #f6f9fe 0%, #fff 100%);
}
.ms-head-t { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1; }
.ms-head-t h3 { margin: 0; font-size: 14.8px; color: var(--text, #16202e); white-space: nowrap; }
.ms-ic { font-size: 15px; }
.ms-ctx {
  font-size: 11.2px; color: var(--muted, #6b7c91); background: var(--panel-2, #f8fafc);
  border: 1px solid var(--line, #dfe6ef); border-radius: 999px; padding: 2px 9px;
  max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ms-head-r { display: flex; align-items: center; gap: 8px; }
.ms-tag {
  font-size: 10.4px; font-weight: 800; color: #0b4c92; background: #eaf2fd;
  border: 1px solid #cfe0f5; border-radius: 999px; padding: 3px 9px; white-space: nowrap;
}
.ms-x { border: none; background: transparent; font-size: 20px; line-height: 1; color: var(--muted); cursor: pointer; padding: 2px 6px; border-radius: 7px; }
.ms-x:hover { background: var(--panel-2); color: var(--text); }

.ms-disclaim {
  padding: 7px 14px; font-size: 11.2px; line-height: 1.55; color: #7a4b00;
  background: #fff8ea; border-bottom: 1px solid #f2e2c4;
}
.ms-disclaim b { color: #8a5100; }

/* ── 본문 2단 ── */
.ms-body {
  flex: 1 1 auto; min-height: 0;
  display: grid; grid-template-columns: 344px minmax(0, 1fr);
}
.ms-in {
  border-right: 1px solid var(--line, #dfe6ef); overflow: auto; padding: 10px 12px 18px;
  background: #fbfdff;
}
.ms-out { overflow: auto; padding: 12px 14px 20px; min-width: 0; }

/* ── 입력 ── */
.ms-grp { margin-bottom: 12px; }
.ms-grp h4 {
  margin: 0 0 6px; font-size: 11.6px; font-weight: 800; color: var(--text, #16202e);
  display: flex; align-items: center; gap: 6px;
}
.ms-grp-s { font-size: 9.8px; font-weight: 700; color: var(--muted, #6b7c91); background: var(--panel-2); border: 1px solid var(--line); border-radius: 999px; padding: 1px 6px; }
.ms-field { margin-bottom: 7px; }
.ms-field label { display: block; font-size: 10.6px; color: var(--muted, #6b7c91); margin-bottom: 3px; }
.ms-field input, .ms-field select {
  width: 100%; font-family: inherit; font-size: 12.2px; padding: 6px 8px;
  border: 1px solid var(--line, #dfe6ef); border-radius: 8px; background: #fff; color: var(--text, #16202e);
}
.ms-field input:focus, .ms-field select:focus { outline: 2px solid #bcd7f4; outline-offset: 1px; }
.ms-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.ms-unit { display: flex; align-items: center; gap: 6px; }
.ms-unit-t { font-size: 11px; font-weight: 700; color: var(--text-2, #3c4b5f); min-width: 18px; }
.ms-unit-btn {
  font-size: 10.4px; padding: 5px 7px; white-space: nowrap; cursor: pointer;
  border: 1px solid var(--line); border-radius: 7px; background: #fff; color: var(--text-2);
}
.ms-unit-btn:hover { background: var(--panel-2); }
.ms-hint { margin: 4px 0 0; font-size: 10.2px; line-height: 1.55; color: var(--muted, #6b7c91); }
.ms-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.ms-chip {
  font-size: 11px; padding: 5px 9px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line, #dfe6ef); background: #fff; color: var(--text-2);
}
.ms-chip:hover { background: var(--panel-2); }
.ms-chip.on { background: #0b5cb0; border-color: #0b5cb0; color: #fff; font-weight: 700; }
.ms-in-acts { display: flex; gap: 6px; margin-top: 4px; }

/* ── 버튼 ── */
.ms-btn {
  font-family: inherit; font-size: 11.8px; font-weight: 700; padding: 7px 11px;
  border-radius: 8px; border: 1px solid var(--line, #dfe6ef); background: #fff; color: var(--text-2, #3c4b5f);
  cursor: pointer; white-space: nowrap;
}
.ms-btn:hover { background: var(--panel-2); }
.ms-btn.main { background: linear-gradient(180deg, #1b6fca 0%, #0b5cb0 100%); border-color: #0b5cb0; color: #fff; }
.ms-btn.main:hover { filter: brightness(1.07); }
.ms-btn.ghost { background: transparent; }
.ms-mini {
  font-size: 10.2px; padding: 2px 7px; border-radius: 6px; cursor: pointer;
  border: 1px solid var(--line); background: #fff; color: var(--text-2);
}

/* ── KPI ── */
.ms-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 7px; }
.ms-kpi {
  border: 1px solid var(--line, #dfe6ef); border-radius: 10px; padding: 8px 9px;
  background: linear-gradient(180deg, #fbfdff, #fff); display: flex; flex-direction: column; gap: 1px;
}
.ms-kpi-l { font-size: 10px; color: var(--muted, #6b7c91); }
.ms-kpi-v { font-size: 15px; font-weight: 800; color: var(--text, #16202e); letter-spacing: -.2px; }
.ms-kpi-s { font-size: 9.8px; color: var(--muted, #6b7c91); line-height: 1.45; }
.ms-kpi.strong { border-color: #cfe0f5; background: linear-gradient(180deg, #f2f8ff, #fff); }
.ms-kpi.strong .ms-kpi-v { color: #0b4c92; }
.ms-kpi.bad { border-color: #f0cfcf; background: #fff7f7; }
.ms-kpi.bad .ms-kpi-v { color: #b32c2c; }
.ms-cap { margin: 8px 0 10px; font-size: 10.4px; line-height: 1.6; color: var(--muted, #6b7c91); }

/* ── 탭 ── */
.ms-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line, #dfe6ef); margin-bottom: 9px; flex-wrap: wrap; }
.ms-tab {
  font-family: inherit; font-size: 11.6px; font-weight: 700; padding: 6px 11px 7px;
  border: none; border-bottom: 2px solid transparent; background: transparent; color: var(--muted, #6b7c91); cursor: pointer;
}
.ms-tab.on { color: #0b5cb0; border-bottom-color: #0b5cb0; }
.ms-pane.hidden { display: none; }

/* ── 3D 뷰 ── */
.ms-view-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; margin-bottom: 6px; }
.ms-vb {
  font-family: inherit; font-size: 11px; font-weight: 700; padding: 5px 9px; cursor: pointer;
  border: 1px solid var(--line, #dfe6ef); border-radius: 7px; background: #fff; color: var(--text-2, #3c4b5f);
}
.ms-vb:hover { background: var(--panel-2); }
.ms-vb.on { background: #eaf2fd; border-color: #b9d4f2; color: #0b4c92; }
.ms-vb.main { margin-left: auto; background: #0b5cb0; border-color: #0b5cb0; color: #fff; }
.ms-vb.main:hover { filter: brightness(1.07); }
.ms-vb-sep { width: 1px; height: 18px; background: var(--line, #dfe6ef); margin: 0 3px; }
.ms-vb-check { display: inline-flex; align-items: center; gap: 4px; font-size: 10.6px; color: var(--muted, #6b7c91); }

.ms-canvas-wrap {
  position: relative; border: 1px solid var(--line, #dfe6ef); border-radius: 11px; overflow: hidden;
  background: #f7fbff;
}
.ms-canvas { display: block; width: 100%; height: auto; cursor: grab; touch-action: none; }
.ms-canvas:active { cursor: grabbing; }
.ms-canvas-hint {
  position: absolute; right: 8px; bottom: 6px; font-size: 9.6px; color: #7c8ea6;
  background: rgba(255,255,255,.82); border-radius: 6px; padding: 2px 6px; pointer-events: none;
}
.ms-legend { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.ms-lg { display: inline-flex; align-items: center; gap: 4px; font-size: 10.4px; color: var(--text-2, #3c4b5f); }
.ms-lg i { width: 11px; height: 11px; border-radius: 3px; display: inline-block; }
.ms-lg-line { background: repeating-linear-gradient(90deg, #b8c6d8 0 2px, transparent 2px 4px); }

/* ── 단면 SVG ── */
.ms-sec-wrap { border: 1px solid var(--line, #dfe6ef); border-radius: 11px; background: #fbfdff; overflow: hidden; }
.ms-sec { display: block; width: 100%; height: auto; }
.ms-sec-lab { font-size: 9px; fill: #3c4b5f; font-weight: 700; font-family: var(--font, sans-serif); }
.ms-sec-area { font-size: 9px; fill: #54657a; font-family: var(--font, sans-serif); }
.ms-sec-use { font-weight: 800; fill: #16202e; }
.ms-sec-area2 { font-size: 8px; fill: #93a2b4; font-family: var(--font, sans-serif); }
.ms-sec-tick { font-size: 8px; fill: #9aa9bb; font-family: var(--font, sans-serif); }
.ms-sec-gl { font-size: 8.6px; fill: #5b6b7f; font-family: var(--font, sans-serif); }
.ms-sec-meta { margin-top: 6px; font-size: 10.6px; line-height: 1.6; color: var(--text-2, #3c4b5f); }
.ms-sec-meta span { color: var(--muted, #6b7c91); }

/* ── 표 ── */
.ms-tbl-wrap { border: 1px solid var(--line, #dfe6ef); border-radius: 10px; overflow: auto; max-height: 52vh; }
.ms-tbl { width: 100%; border-collapse: collapse; font-size: 11.4px; background: #fff; }
.ms-tbl th, .ms-tbl td { padding: 5px 8px; border-bottom: 1px solid var(--line-2, #eef2f7); text-align: left; }
.ms-tbl thead th { position: sticky; top: 0; background: #f2f7fd; font-size: 10.8px; color: var(--text, #16202e); z-index: 1; }
.ms-tbl tbody tr:hover td { background: #fafdff; }
.ms-tbl tr.below td { background: #f7f9fc; color: var(--muted, #6b7c91); }
.ms-tbl tr.sum td, .ms-tbl tfoot th, .ms-tbl tfoot td { background: #f2f7fd; font-weight: 800; }
.ms-tbl td.num { text-align: right; font-variant-numeric: tabular-nums; }
.ms-tbl td.b { font-weight: 800; }
.ms-tbl td.memo { color: var(--muted, #6b7c91); font-size: 10.6px; }
.ms-tbl.sm { font-size: 11px; }
.ms-dot { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 5px; vertical-align: middle; }

/* ── 주차 ── */
.ms-park-h { font-size: 12px; font-weight: 800; color: var(--text); margin-bottom: 6px; }
.ms-park-flex { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; margin-top: 9px; }
.ms-park-flex > div {
  border: 1px solid var(--line); border-radius: 9px; padding: 8px 9px; background: #fbfdff;
  display: flex; flex-direction: column; gap: 1px;
}
.ms-park-flex span { font-size: 10px; color: var(--muted); }
.ms-park-flex b { font-size: 13px; color: var(--text); }
.ms-park-flex em { font-size: 9.6px; color: var(--muted); font-style: normal; line-height: 1.4; }
.ms-park-flex.ok { border: none; }
.ms-park-flex.ok > div:last-child { border-color: #bfe6cf; background: #f2fbf6; }
.ms-park-flex.warn > div:last-child { border-color: #f0cfcf; background: #fff7f7; }
.ms-checks { margin: 10px 0 0; padding: 0; list-style: none; }
.ms-checks li { font-size: 11px; line-height: 1.6; padding: 5px 8px; border-radius: 8px; margin-bottom: 4px; }
.ms-checks li.ok { background: #f2fbf6; color: #14663c; }
.ms-checks li.warn { background: #fff8ec; color: #7a4b00; }

/* ── 액션 ── */
.ms-acts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line, #dfe6ef); }
.ms-disclaim2 { margin: 9px 0 0; font-size: 10.2px; line-height: 1.6; color: var(--muted, #6b7c91); }

/* ── AI 이미지 ── */
.ms-aipane {
  margin-top: 10px; border: 1px solid #cfe0f5; border-radius: 11px; padding: 10px 11px;
  background: linear-gradient(180deg, #f8fbff, #fff);
}
.ms-aipane.hidden { display: none; }
.ms-aipane-h { font-size: 12px; font-weight: 800; color: #0b4c92; display: flex; align-items: baseline; gap: 7px; }
.ms-aipane-h span { font-size: 10.2px; font-weight: 500; color: var(--muted); }
.ms-aipane-row { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; margin: 8px 0 6px; }
.ms-radio { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; color: var(--text-2); }
.ms-aipane-note { font-size: 10.2px; line-height: 1.6; color: var(--muted); }
.ms-imgout { margin-top: 9px; }
.ms-img-empty { font-size: 10.8px; color: var(--muted); border: 1px dashed var(--line); border-radius: 9px; padding: 12px; text-align: center; }
.ms-img-loading { font-size: 11.4px; color: var(--text-2); padding: 12px; display: flex; align-items: center; gap: 7px; }
.ms-spin {
  width: 12px; height: 12px; border-radius: 50%; border: 2px solid #cfe0f5; border-top-color: #0b5cb0;
  display: inline-block; animation: ms-spin 0.9s linear infinite;
}
@keyframes ms-spin { to { transform: rotate(360deg); } }
.ms-img-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ms-img-card { margin: 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #fff; }
.ms-img-card img { display: block; width: 100%; height: auto; }
.ms-img-card figcaption { font-size: 10.2px; color: var(--muted); padding: 6px 8px; display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.ms-img-card figcaption b { color: var(--text); font-size: 10.8px; }
.ms-img-acts { margin-left: auto; display: inline-flex; gap: 4px; }
.ms-img-warn { font-size: 10.4px; color: #7a4b00; background: #fff8ec; border: 1px solid #f2e2c4; border-radius: 8px; padding: 6px 9px; margin-top: 7px; }

.ms-img-fallback { border: 1px solid #f2e2c4; background: #fffaf2; border-radius: 10px; padding: 11px 12px; }
.ms-img-fb-h { font-size: 12px; font-weight: 800; color: #8a5100; }
.ms-img-fb-b { font-size: 11.2px; color: var(--text-2); margin-top: 4px; line-height: 1.6; }
.ms-img-fb-hint { font-size: 10.4px; color: var(--muted); margin-top: 4px; line-height: 1.55; }
.ms-img-fb-acts { display: flex; flex-wrap: wrap; gap: 6px; margin: 9px 0; }
.ms-img-fb-prompt {
  margin: 0; max-height: 132px; overflow: auto; background: #0f2338; color: #dce8f6;
  border-radius: 8px; padding: 8px 10px; font-size: 10.2px; line-height: 1.55; white-space: pre-wrap; word-break: break-word;
}
.ms-img-fb-note { font-size: 10.2px; line-height: 1.6; color: var(--muted); margin-top: 7px; }

/* ── 근거 배지·형상 입력 ── */
.ms-basis {
  display: inline-block; font-size: 9.4px; font-weight: 800; border-radius: 999px; padding: 1px 6px; margin-top: 2px;
  border: 1px solid; line-height: 1.5;
}
.ms-basis.drawn { color: #14663c; background: #eefaf2; border-color: #bfe6cf; }
.ms-basis.est { color: #8a5100; background: #fff8ec; border-color: #f2e2c4; }
.ms-sub-h { font-size: 10.6px; font-weight: 800; color: var(--text-2, #3c4b5f); margin: 8px 0 4px; display: flex; align-items: baseline; gap: 6px; }
.ms-sub-h span { font-size: 9.6px; font-weight: 500; color: var(--muted, #6b7c91); }
.ms-warnline { margin: 5px 0 0; font-size: 10.2px; line-height: 1.55; color: #8a5100; background: #fff8ec; border: 1px solid #f2e2c4; border-radius: 7px; padding: 4px 7px; }
.ms-link { border: none; background: transparent; color: #0b5cb0; font: inherit; font-size: 10.2px; text-decoration: underline; cursor: pointer; padding: 0; }
.ms-grp-hl { border: 1px solid #d8e6f6; background: #f8fbff; border-radius: 10px; padding: 8px 9px; }
.ms-mini.on { background: #0b5cb0; border-color: #0b5cb0; color: #fff; }
a.ms-mini { display: inline-block; text-decoration: none; line-height: 1.6; }
.ms-outline-wrap { margin-top: 7px; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; background: #fff; }
.ms-outline-wrap.hidden { display: none; }
.ms-outline-wrap canvas { display: block; width: 100%; height: auto; cursor: crosshair; touch-action: manipulation; }
.ms-outline-acts { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; padding: 5px 7px; border-top: 1px solid var(--line-2, #eef2f7); }

/* ── 배치(평면) 도해 ── */
.ms-plan-wrap { position: relative; border: 1px solid var(--line); border-radius: 11px; background: #fbfdff; overflow: hidden; }
.ms-plan-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; opacity: .32; pointer-events: none; }
.ms-plan-svg { position: relative; }
.ms-plan { display: block; width: 100%; height: auto; }

/* ── AI 이미지 (img2img) ── */
.ms-shot { margin: 6px 0; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; background: #fff; display: flex; gap: 8px; align-items: center; }
.ms-shot img { width: 210px; max-width: 55%; height: auto; display: block; }
.ms-shot-h { font-size: 10.2px; color: var(--muted); padding: 6px 8px; line-height: 1.5; }
.ms-lbl { font-size: 10.4px; font-weight: 800; color: var(--text-2); }
.ms-img-check { font-size: 10.4px; line-height: 1.6; color: #7a4b00; background: #fff8ec; border: 1px solid #f2e2c4; border-radius: 8px; padding: 6px 9px; margin-top: 7px; }
.ms-btn:disabled { opacity: .7; cursor: default; }

/* ── 하단 ── */
.ms-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  padding: 6px 14px; border-top: 1px solid var(--line); background: var(--panel-2);
  font-size: 10.2px; color: var(--muted);
}

/* ── 반응형 ── */
@media (max-width: 1080px) {
  .ms-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ms-park-flex { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .ms-overlay { padding: 0; }
  .ms-shell { width: 100%; height: 100vh; max-height: 100vh; border-radius: 0; }
  .ms-body { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .ms-in { border-right: none; border-bottom: 1px solid var(--line); max-height: 42vh; }
  .ms-out { padding: 10px; }
  .ms-img-grid { grid-template-columns: 1fr; }
  .ms-foot-r { display: none; }
  .ms-ctx { max-width: 130px; }
}
