/* =====================================================================
   APSFlow 스타일 — 모바일 우선 (Mobile First)
   기본 규칙 = 휴대폰. 화면이 넓어질수록 min-width 중단점으로 확장한다.
     ~1023px  휴대폰·태블릿 : 햄버거 버튼 → 왼쪽 메뉴 서랍, 도움말 → 오른쪽 서랍
     768px~   태블릿   : 글자·여백 확장, KPI 여러 칸, 툴바 한 줄
     1024px~  PC        : 왼쪽 사이드 메뉴
     1200px~  넓은 PC   : 카드 2단 배치
     1440px~  와이드    : 오른쪽 도움말 패널 상시 표시
   ===================================================================== */

/* ───────── 디자인 토큰 ───────── */
:root {
    --bg: #f4f6f9;
    --card: #ffffff;
    --line: #e3e7ec;
    --text: #1e2228;
    --muted: #6b7380;
    --accent: #2f6fd0;
    --accent-bg: #e3edfb;
    --good: #2e9a63;
    --good-bg: #dcf2e4;
    --bad: #d0313f;
    --hot: #dc143c;
    --busy: #8fb8ea;
    --setup: #c8c8c8;

    --fs: 15px;          /* 본문 */
    --fs-sm: 13px;       /* 보조 글자 */
    --fs-xs: 12px;       /* 범례, 배지 */
    --fs-input: 16px;    /* 입력창: 16px 미만이면 iOS가 확대함 */
    --h1: 20px;
    --h2: 15px;
    --kpi: 20px;

    --pad: 12px;         /* 화면 좌우 여백 */
    --gap: 10px;         /* 카드 사이 간격 */
    --card-pad: 14px;
    --radius: 10px;
    --control-h: 40px;   /* 터치 대상 최소 높이 */
    --topbar-h: 52px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }
html, body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: "Malgun Gothic", "Apple SD Gothic Neo", "Segoe UI", sans-serif;
    font-size: var(--fs);
    line-height: 1.5;
}

h1:focus { outline: none; }
h1 { font-size: var(--h1); margin: 0; line-height: 1.3; }
h2 { font-size: var(--h2); margin: 0 0 12px; display: flex; align-items: baseline; flex-wrap: wrap; gap: 2px 8px; line-height: 1.4; }
h2 small, .sub, .note { color: var(--muted); font-weight: normal; font-size: var(--fs-sm); }
/* 휴대폰: 제목 옆 작은 설명은 항상 다음 줄로 (들쭉날쭉한 줄바꿈 방지) */
h2 small { flex-basis: 100%; }
/* 카드 제목 아래 설명 문장 */
.card-desc { margin: -6px 0 12px; color: var(--muted); font-size: var(--fs-sm); line-height: 1.55; }
.note { margin: 8px 0 0; }
a { color: var(--accent); }
input, select, button, textarea { font: inherit; color: inherit; }

/* ───────── 상단 바 ───────── */
.topbar {
    display: flex; align-items: center; gap: 12px;
    padding: 0 var(--pad); height: var(--topbar-h);
    background: #1d2633; color: #fff;
    position: sticky; top: 0; z-index: 20;
}
.brand { color: #fff; font-size: 19px; font-weight: 700; text-decoration: none; letter-spacing: .3px; flex: none; }
.brand span { color: #7db3ff; }
.crumb { display: none; color: #c6d0dd; font-size: var(--fs-sm); white-space: nowrap; }
.crumb b { color: #6f8197; margin: 0 4px; }
.source { display: none; margin-left: auto; color: #9fb0c4; font-size: var(--fs-xs); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 40%; }
.help-toggle {
    margin-left: auto; display: inline-flex; align-items: center; justify-content: center; gap: 4px;
    min-height: 36px; padding: 0 12px; border: 1px solid #3a475a; border-radius: 8px;
    color: #c6d0dd; font-size: var(--fs-sm); cursor: pointer; white-space: nowrap; user-select: none;
}
.help-toggle:hover { border-color: #5a6b82; color: #fff; }
/* 숨긴 체크박스는 화면에 고정: 버튼을 누를 때 포커스가 가도 페이지 맨 위로 스크롤되지 않게 */
.help-switch { position: fixed; top: 0; left: 0; opacity: 0; pointer-events: none; }
/* 단색 SVG 아이콘 */
.icon { display: inline-block; flex: none; vertical-align: -3px; }
.btn .icon { vertical-align: 0; }
.help-switch:checked ~ .topbar .help-toggle { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ───────── 화면 골격 ───────── */
.shell { display: block; min-height: calc(100vh - var(--topbar-h)); }

/* 메뉴: PC 미만에서는 햄버거 버튼으로 여는 왼쪽 서랍 */
.nav-switch { position: fixed; top: 0; left: 0; opacity: 0; pointer-events: none; }
.nav-toggle {
    flex: none; display: inline-flex; flex-direction: column; justify-content: center; gap: 4px;
    width: 40px; height: 40px; margin-left: -8px; padding: 0 9px; border-radius: 8px; cursor: pointer;
}
.nav-toggle span { display: block; height: 2px; border-radius: 1px; background: #dfe6ef; }
.nav-toggle:hover { background: #2a3646; }
.nav-backdrop { display: none; position: fixed; inset: 0; z-index: 30; background: rgba(15, 23, 35, .4); }
.sidenav {
    position: fixed; top: 0; left: 0; z-index: 40;
    width: min(82vw, 300px); height: 100vh; height: 100dvh; overflow-y: auto;
    padding: 12px 12px 40px; background: #f9fafc; box-shadow: 8px 0 24px rgba(0, 0, 0, .12);
    transform: translateX(-105%); transition: transform .2s ease; visibility: hidden;
}
.nav-switch:checked ~ .shell .nav-backdrop { display: block; }
.nav-switch:checked ~ .shell .sidenav { transform: none; visibility: visible; }
/* 서랍 안 스크롤이 끝까지 가도 뒤 본문으로 넘어가지 않게 + 서랍이 열려 있는 동안 본문 스크롤 잠금 */
.sidenav, .help-panel { overscroll-behavior: contain; }
html:has(.nav-switch:checked), html:has(.help-switch:checked) { overflow: hidden; }
html:has(.nav-switch:checked) body, html:has(.help-switch:checked) body { overflow: hidden; }
.sidenav-head { display: flex; align-items: center; justify-content: space-between; margin: 0 0 12px; padding: 2px 2px 10px 6px; border-bottom: 1px solid var(--line); }
.sidenav .sidenav-head .brand { display: inline; min-height: 0; padding: 0; font-size: 19px; font-weight: 700; color: var(--text); background: none; }
.sidenav-head .brand span { color: var(--accent); }
.sidenav-head .help-close { float: none; margin: 0; }
.menu-search { width: 100%; margin-bottom: 12px; }
.module { margin-bottom: 14px; }
.module-title { font-size: var(--fs-xs); font-weight: 700; color: var(--muted); letter-spacing: .5px; padding: 4px 10px; }
.sidenav a {
    display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 10px; border-radius: 8px;
    color: var(--text); text-decoration: none; font-size: var(--fs); white-space: nowrap;
}
.sidenav a .icon { flex: none; color: var(--muted); }
.sidenav a:hover { background: #eef2f7; }
.sidenav a.active { background: var(--accent-bg); color: var(--accent); font-weight: 700; }
.sidenav a.active .icon { color: var(--accent); }

.content { padding: 14px var(--pad) 40px; min-width: 0; }

/* 도움말: 휴대폰·태블릿에서는 오른쪽에서 나오는 서랍 */
.help-backdrop {
    display: none; position: fixed; inset: 0; z-index: 30; background: rgba(15, 23, 35, .4);
}
.help-panel {
    position: fixed; top: 0; right: 0; z-index: 40;
    width: min(88vw, 360px); height: 100vh; height: 100dvh; overflow-y: auto;
    background: #fff; box-shadow: -8px 0 24px rgba(0, 0, 0, .12);
    padding: 18px 18px 40px; font-size: var(--fs-sm); line-height: 1.65;
    transform: translateX(105%); transition: transform .2s ease; visibility: hidden;
}
.help-switch:checked ~ .shell .help-backdrop { display: block; }
.help-switch:checked ~ .shell .help-panel { transform: none; visibility: visible; }
.help-close {
    float: right; display: inline-flex; align-items: center; justify-content: center;
    width: 36px; height: 36px; margin: -6px -6px 0 8px; border-radius: 8px; cursor: pointer; color: var(--muted);
}
.help-close:hover { background: #f0f2f5; }
.help-panel h3 { font-size: 16px; margin: 0 0 8px; }
.help-panel h4 { font-size: var(--fs-xs); color: var(--muted); margin: 18px 0 6px; letter-spacing: .3px; }
.help-panel p { margin: 0; }
.help-panel ul { margin: 0; padding-left: 18px; }
.help-panel li { margin-bottom: 4px; }
.help-panel ul.related { list-style: none; padding: 0; }
/* 함께 보기: 줄 간격을 좁게(행 높이 약 70%), 밑줄 없음 */
.help-panel ul.related li { display: flex; margin-bottom: 2px; }
.help-panel ul.related a { display: inline-flex; align-items: center; gap: 6px; padding: 0; text-decoration: none; }
.help-panel ul.related a:hover { color: #1d4f9e; }
.help-panel dl { margin: 0; }
.help-panel dt { font-weight: 700; margin-top: 8px; }
.help-panel dd { margin: 0; color: #4b5563; }

/* ───────── 페이지 머리 / 툴바 ───────── */
.page-head { display: flex; flex-direction: column; align-items: stretch; gap: 10px; margin-bottom: 14px; }
.page-head > .sub { margin: 0; }
.toolbar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px; }
.toolbar > label, .toolbar > .field {
    display: flex; flex-direction: column; gap: 4px; flex: 1 1 140px;
    font-size: var(--fs-sm); color: var(--muted);
}
.toolbar > label:has(input[type="checkbox"]) { flex: 0 0 auto; flex-direction: row; align-items: center; gap: 6px; color: var(--text); min-height: var(--control-h); }
.toolbar select, .toolbar input:not([type="checkbox"]) { width: 100%; }
.toolbar .btn { flex: 1 1 auto; }
.toolbar .note, .toolbar .msg { flex-basis: 100%; margin: 0; }
.msg { color: var(--good); font-weight: 600; }

/* ───────── 입력 요소 ───────── */
select, input:not([type="checkbox"]):not([type="radio"]) {
    min-height: var(--control-h); padding: 6px 10px;
    border: 1px solid var(--line); border-radius: 8px; background: #fff;
    font-size: var(--fs-input);
}
input[type="number"] { text-align: right; }
input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--accent); margin: 0; }
select:focus, input:focus { outline: 2px solid rgba(47, 111, 208, .35); outline-offset: 0; border-color: var(--accent); }

/* ───────── 버튼 ───────── */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    min-height: var(--control-h); padding: 0 16px; border-radius: 8px; cursor: pointer;
    border: 1px solid var(--line); background: #fff; color: var(--text); font-size: var(--fs-sm); white-space: nowrap; text-decoration: none;
}
.btn:hover { border-color: #b9c2ce; }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn.small { min-height: 34px; padding: 0 12px; font-size: var(--fs-xs); }

/* ───────── 카드 / 그리드 ───────── */
.card {
    background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
    padding: var(--card-pad); margin-bottom: var(--gap);
    overflow-x: auto; /* 넓은 표·차트는 카드 안에서 가로 스크롤 */
}
.grid2 { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0 var(--gap); }
.grid2 > .card { margin-bottom: var(--gap); }
.mt { margin-top: 14px; }
/* 표 바로 아래에 오는 버튼·도구 모음은 표의 아래 테두리와 붙지 않게 띄운다 */
:is(.table, .scroll-x) + :is(.btn, .toolbar) { margin-top: 12px; }

/* ───────── KPI ───────── */
.kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-bottom: var(--gap); }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; min-width: 0; }
.kpi span { display: block; color: var(--muted); font-size: var(--fs-xs); margin-bottom: 2px; }
.kpi strong { display: block; font-size: var(--kpi); line-height: 1.3; word-break: keep-all; overflow-wrap: break-word; }
.kpi strong.small { font-size: var(--fs-sm); line-height: 1.45; }
.kpi small { font-size: var(--fs-xs); font-weight: normal; color: var(--muted); }
.kpi.bad strong { color: var(--bad); }
.kpi.good strong { color: var(--good); }
/* 휴대폰 2칸 배치에서 홀수 개면 마지막 카드를 한 줄 전체로 */
.kpis > .kpi:last-child:nth-child(odd) { grid-column: 1 / -1; }

/* ───────── 표 ───────── */
.table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.table th { text-align: left; color: var(--muted); font-weight: 600; font-size: var(--fs-xs); padding: 8px 6px; border-bottom: 2px solid var(--line); white-space: nowrap; vertical-align: bottom; }
.table td { padding: 9px 6px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:hover { background: #f8fafc; }
.table th.num, .num { text-align: right; font-variant-numeric: tabular-nums; }
.w-bar { width: 34%; min-width: 110px; }
.empty { color: var(--muted); margin: 8px 0; }
.bad-text { color: var(--bad); }
.good-text { color: var(--good); font-weight: 600; }
.muted { color: var(--muted); font-weight: normal; }
.nowrap { white-space: nowrap; }
.hide-sm { display: none; }
.table td:has(> .dot) { white-space: nowrap; }
.table tr.subtotal td { background: #f7f9fb; font-weight: 600; }
.table.e10 th, .table.e10 td.num, .table.e10 tr.subtotal td { white-space: nowrap; }
.table.heat td.num { text-align: center; }
.table.clickable tbody tr { cursor: pointer; }
.table.clickable tbody tr:hover td { background: #f5f8fc; }
.table.clickable tbody tr.sel td { background: var(--accent-bg); }
.scroll-x { overflow-x: auto; }

/* 휴대폰에서 칸이 많은 표는 행을 카드처럼 세로로 펼친다 (data-label = 항목 이름) */
.table.cards-sm thead { display: none; }
.table.cards-sm tr { display: block; padding: 10px 0; border-bottom: 1px solid var(--line); }
.table.cards-sm td { display: block; border: 0; padding: 2px 0; }
.table.cards-sm td[data-label]::before {
    content: attr(data-label); display: inline-block; min-width: 64px; margin-right: 8px;
    color: var(--muted); font-size: var(--fs-xs); font-weight: 600;
}
.table.cards-sm td.num { text-align: left; }
.table.cards-sm .stack { margin: 4px 0; }
/* 누를 수 있는 카드 행: 선택·hover 배경이 글자에 붙지 않게 안쪽 여백 */
.table.cards-sm.clickable tbody tr { padding: 10px 12px; }
.table.cards-sm.clickable tbody tr:hover { background: #f5f8fc; }
.table.cards-sm.clickable tbody tr.sel { background: var(--accent-bg); }

/* 입력 표 (What-if 시나리오, 실험 설계) */
.table.form td { padding: 6px 4px; }
.table.form input:not([type="checkbox"]) { width: 100%; min-width: 64px; max-width: 120px; }
.table.form input.wide { max-width: none; text-align: left; }
.table.form select { width: 100%; max-width: 220px; }

.dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.tag { display: inline-block; margin-left: 6px; font-size: 11px; line-height: 1.5; padding: 1px 6px; border-radius: 4px; background: #eef1f5; color: #4b5563; vertical-align: 1px; white-space: nowrap; }
.tag.hot { background: #fde4e7; color: var(--hot); font-weight: 700; }

/* ───────── 누적 막대 / 범례 ───────── */
.stack { display: flex; height: 12px; background: #f0f2f5; border-radius: 3px; overflow: hidden; }
.stack .busy { background: var(--busy); }
.stack .setup { background: repeating-linear-gradient(45deg, var(--setup) 0 3px, #e8e8e8 3px 6px); }
.stack .standby { background: #e6ebf1; }
.stack .waitbar { background: #f2b8bf; }
.stack .bdbar { background: #d0313f; }
.stack-label { font-size: var(--fs-xs); }
.stack-label em { color: var(--muted); font-style: normal; }

.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: var(--fs-xs); color: var(--muted); margin: 0 0 8px; }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
.legend .busy { background: var(--busy); }
.legend .setup { background: repeating-linear-gradient(45deg, var(--setup) 0 3px, #e8e8e8 3px 6px); }
.legend .standby { background: #e6ebf1; }
.legend i.hatch { background: repeating-linear-gradient(45deg, #9a9a9a 0 2px, #e3e3e3 2px 5px); }
.legend i.hot { border: 2px solid var(--hot); background: #fff; }
.legend i.pm { background: #6b7380; }
.legend i.bd { background: repeating-linear-gradient(45deg, #d0313f 0 2px, #fde4e7 2px 5px); }
.legend i.wait { background: #f2b8bf; height: 4px; vertical-align: 2px; }
.legend i.due { background: var(--hot); width: 3px; }

/* ───────── 규칙 비교 ───────── */
.compare td.best { background: var(--good-bg); font-weight: 700; }
.cell-bar { height: 4px; background: #f0f2f5; border-radius: 2px; margin-bottom: 4px; min-width: 40px; }
.cell-bar i { display: block; height: 100%; background: #b9cde6; border-radius: 2px; }
.compare td.best .cell-bar i { background: var(--good); }
.insights { margin: 0; padding-left: 18px; line-height: 1.8; font-size: var(--fs-sm); }

/* ───────── Route 흐름 ───────── */
.flow { display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: stretch; }
.step {
    display: flex; flex-direction: column; gap: 2px; min-width: 88px;
    border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: #fafbfc;
    position: relative;
}
.step:not(:last-child)::after { content: "→"; position: absolute; right: -15px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.step b { font-size: var(--fs-sm); }
.step span { color: var(--muted); font-size: var(--fs-xs); }
.step .tag { align-self: flex-start; margin: 2px 0 0; }

/* ───────── Gantt ───────── */
.gantt-bar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; gap: 8px 12px; flex-wrap: wrap; }
.gantt-bar .legend { margin: 0; }
.zoom { display: flex; gap: 6px; }
.gantt-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: 6px; -webkit-overflow-scrolling: touch; }
.gantt { display: block; font-family: inherit; }
.gantt .row { fill: #fff; }
.gantt .row.alt { fill: #f6f8fa; }
.gantt .axis-bg { fill: #eef1f5; }
.gantt .grid { stroke: #e2e6eb; }
.gantt .divider { stroke: #a9b1bc; }
.gantt .tool-label { font-size: 12.5px; fill: #3c4048; font-weight: 600; }
.gantt .axis-label { font-size: 11.5px; fill: #5d6470; }
.gantt .frame { fill: none; stroke: rgba(0, 0, 0, .18); }
.gantt .frame.hot { stroke: var(--hot); stroke-width: 2.5; }
.gantt .bar-label { font-size: 11px; fill: #fff; text-anchor: middle; pointer-events: none; }
.gantt .op:hover .process { filter: brightness(1.18); }
.gantt .op { cursor: default; }
.gantt .down.pm { fill: #6b7380; opacity: .85; }
.gantt .down.bd { fill: url(#bdhatch); stroke: #d0313f; }
.gantt .down-label { font-size: 11px; font-weight: 700; fill: #fff; paint-order: stroke; stroke: rgba(0, 0, 0, .35); stroke-width: 2px; }

/* ───────── SVG 차트 ───────── */
/* 휴대폰에서는 글자가 너무 작아지지 않게 최소 폭을 두고 카드 안에서 가로 스크롤 */
.chart { display: block; width: 100%; min-width: 420px; height: auto; }
.chart .grid { stroke: #e9edf2; }
.chart .axis-label { font-size: 12px; fill: var(--muted); }

/* ───────── 탭 / 칩 ───────── */
.tabs {
    display: flex; gap: 2px; margin: 0 calc(var(--pad) * -1) 14px; padding: 0 var(--pad);
    border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tabs button {
    flex: none; border: 0; background: none; padding: 10px 12px; min-height: 44px; color: var(--muted); cursor: pointer;
    border-bottom: 2px solid transparent; margin-bottom: -1px; font-size: var(--fs-sm); white-space: nowrap;
}
.tabs button.on { color: var(--accent); border-bottom-color: var(--accent); font-weight: 700; }
.filters { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.chip { border: 1px solid var(--line); background: #fff; border-radius: 999px; min-height: 34px; padding: 0 12px; font-size: var(--fs-xs); cursor: pointer; }
.chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ───────── 가중치 입력 ───────── */
.weights { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 8px; align-items: end; }
.weights label { display: flex; flex-direction: column; gap: 4px; font-size: var(--fs-xs); font-weight: 600; min-width: 0; }
.weights label small { color: var(--muted); font-weight: normal; }
.weights input { width: 100%; }
.weights .btn { min-height: var(--control-h); }

/* ───────── What-if 결과 ───────── */
.effect { margin-bottom: 16px; }
.effect > b { display: block; margin-bottom: 6px; font-size: var(--fs-sm); }
.effect-row { display: grid; grid-template-columns: 52px minmax(0, 1fr) 48px; gap: 8px; align-items: center; font-size: var(--fs-xs); margin-bottom: 2px; }
.effect-row .bar { height: 10px; background: #f0f2f5; border-radius: 3px; overflow: hidden; }
.effect-row .bar i { display: block; height: 100%; background: #b9cde6; }
.effect-row .bar i.best { background: var(--good); }

/* ───────── 대시보드: 납기 약속 ───────── */
.commit-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.commit { border: 1px solid var(--line); border-left: 4px solid var(--good); border-radius: 6px; padding: 7px 9px; font-size: var(--fs-xs); display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.commit.late { border-left-color: var(--bad); background: #fff7f8; }
.commit .margin { margin-left: auto; font-weight: 700; }
.commit .tag { margin-left: 2px; }
.commit.late .margin { color: var(--bad); }
.commit.ok .margin { color: var(--good); }

/* ───────── 데이터 점검 / Capacity / 지연 원인 ───────── */
.sev { display: inline-block; font-size: 11.5px; font-weight: 700; padding: 2px 8px; border-radius: 4px; white-space: nowrap; }
.sev.error { background: #fde4e7; color: var(--bad); }
.sev.warning { background: #fff1d6; color: #a86300; }
.sev.info { background: #eef1f5; color: #4b5563; }
.sev.ok { background: var(--good-bg); color: var(--good); }
.cap-row { display: grid; grid-template-columns: 76px minmax(0, 1fr) 72px; gap: 8px; align-items: center; margin-bottom: 10px; font-size: var(--fs-xs); }
.cap-row .num { text-align: right; }
.cap-bar { position: relative; height: 16px; background: #f0f2f5; border-radius: 4px; overflow: hidden; }
.cap-bar i { position: absolute; top: 0; bottom: 0; display: block; }
.cap-bar i.range { background: rgba(47, 111, 208, .14); }
.cap-bar i.load { left: 0; top: 4px; bottom: 4px; border-radius: 3px; }
.cap-bar i.load.ok { background: var(--busy); }
.cap-bar i.load.tight { background: #e9a23b; }
.cap-bar i.load.short { background: var(--bad); }
.cap-bar i.target { width: 2px; background: #6b7380; }
.cap-bar i.full { width: 2px; background: #1e2228; }
.action-box { border: 1px solid #f3d9a4; background: #fffaf0; border-radius: 8px; padding: 10px 12px; margin-top: 10px; font-size: var(--fs-sm); }
.action-box ul { margin: 4px 0 0; padding-left: 18px; }
.cause { margin: 0 0 8px; font-weight: 600; color: var(--bad); font-size: var(--fs-sm); }

/* ───────── Blazor 오류 표시 (템플릿 기본) ───────── */
#blazor-error-ui {
    background: lightyellow; bottom: 0; box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none; left: 0; padding: 0.6rem 1.25rem 0.7rem 1.25rem; position: fixed; width: 100%; z-index: 1000;
}
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: 0.75rem; top: 0.5rem; }
.blazor-error-boundary { background: #b32121; padding: 1rem; color: white; }
.blazor-error-boundary::after { content: "오류가 발생했습니다."; }


/* =====================================================================
   태블릿 (768px~)
   ===================================================================== */
@media (min-width: 768px) {
    :root {
        --h1: 22px;
        --kpi: 22px;
        --pad: 20px;
        --gap: 14px;
        --card-pad: 16px;
    }

    h2 small { flex-basis: auto; }
    .crumb { display: inline; }
    .source { display: block; }
    .help-toggle { margin-left: 0; }

    .content { padding: 18px var(--pad) 40px; }

    /* 툴바: 라벨과 입력을 한 줄로 */
    .page-head { flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: space-between; }
    .page-head > .sub { flex-basis: 100%; }
    .toolbar { align-items: center; gap: 10px 12px; }
    .toolbar > label, .toolbar > .field { flex: none; flex-direction: row; align-items: center; gap: 8px; color: var(--text); }
    .toolbar select { width: auto; }
    .toolbar .dropdown { width: auto; min-width: 150px; }
    .toolbar input:not([type="checkbox"]) { width: 80px; }
    .toolbar .btn { flex: none; }
    .toolbar .note, .toolbar .msg { flex-basis: auto; }

    .kpis { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
    .kpis > .kpi:last-child:nth-child(odd) { grid-column: auto; }
    .kpi { padding: 12px 16px; }

    .table th { padding: 8px 10px; }
    .table td { padding: 9px 10px; }
    .hide-sm { display: table-cell; }

    .table.cards-sm thead { display: table-header-group; }
    .table.cards-sm tr { display: table-row; padding: 0; border: 0; }
    .table.cards-sm td { display: table-cell; padding: 9px 10px; border-bottom: 1px solid var(--line); }
    .table.cards-sm td[data-label]::before { content: none; }
    .table.cards-sm td.num { text-align: right; }
    .table.cards-sm .stack { margin: 0; }
    .table.cards-sm.clickable tbody tr { padding: 0; }
    .table.cards-sm.clickable tbody tr:hover, .table.cards-sm.clickable tbody tr.sel { background: none; }

    .chart { min-width: 0; }
    .chart .axis-label { font-size: 11px; }

    .tabs { margin: 0 0 14px; padding: 0; }
    .tabs button { padding: 10px 14px; }

    .weights { display: flex; flex-wrap: wrap; gap: 10px 14px; }
    .weights input { width: 84px; }

    .cap-row { grid-template-columns: 110px minmax(0, 1fr) 100px; font-size: var(--fs-sm); }
    .effect-row { grid-template-columns: 64px minmax(0, 1fr) 52px; }
    .commit-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
}

/* =====================================================================
   PC (1024px~): 왼쪽 사이드 메뉴
   ===================================================================== */
@media (min-width: 1024px) {
    :root {
        --fs: 14px;
        --fs-sm: 12.5px;
        --fs-input: 14px;
        --control-h: 34px;
        --topbar-h: 50px;
        --pad: 24px;
        --gap: 16px;
        --card-pad: 16px 18px;
    }

    .brand { width: 186px; }
    .nav-toggle, .nav-backdrop, .sidenav-head { display: none; }

    .shell { display: grid; grid-template-columns: 210px minmax(0, 1fr); }
    .sidenav {
        position: sticky; top: var(--topbar-h); z-index: auto;
        width: auto; height: calc(100vh - var(--topbar-h));
        transform: none; visibility: visible; transition: none; box-shadow: none;
        padding: 12px 10px; border-right: 1px solid var(--line);
    }
    .nav-switch:checked ~ .shell .nav-backdrop { display: none; }
    html:has(.nav-switch:checked):not(:has(.help-switch:checked)),
    html:has(.nav-switch:checked):not(:has(.help-switch:checked)) body { overflow: visible; }
    .menu-search { margin-bottom: 10px; font-size: var(--fs-sm); min-height: 34px; }
    .module { margin-bottom: 12px; }
    .module-title { font-size: 11.5px; padding: 4px 8px; }
    .sidenav a { gap: 8px; min-height: 34px; padding: 0 8px; border-radius: 6px; font-size: 13.5px; }

    .content { padding: 20px var(--pad) 40px; }
}

/* =====================================================================
   넓은 PC (1200px~): 카드 2단
   ===================================================================== */
@media (min-width: 1200px) {
    .grid2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .kpis { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
}

/* =====================================================================
   와이드 (1440px~): 도움말 패널을 오른쪽 칸에 상시 표시 (스위치를 켜면 숨김)
   ===================================================================== */
@media (min-width: 1440px) {
    .shell { grid-template-columns: 210px minmax(0, 1fr) 290px; }
    .help-switch:checked ~ .shell { grid-template-columns: 210px minmax(0, 1fr); }

    .help-panel {
        position: sticky; top: var(--topbar-h); z-index: auto;
        width: auto; height: calc(100vh - var(--topbar-h));
        transform: none; visibility: visible; transition: none;
        box-shadow: none; border-left: 1px solid var(--line); padding: 16px 16px 30px;
    }
    .help-switch:checked ~ .shell .help-panel { display: none; }
    .help-switch:checked ~ .shell .help-backdrop { display: none; }
    html:has(.nav-switch:checked), html:has(.help-switch:checked),
    html:has(.nav-switch:checked) body, html:has(.help-switch:checked) body { overflow: visible; }

    /* 기본 상태(패널 보임)에서 버튼을 켜진 모양으로 */
    .help-toggle { background: var(--accent); border-color: var(--accent); color: #fff; }
    .help-switch:checked ~ .topbar .help-toggle { background: transparent; border-color: #3a475a; color: #c6d0dd; }
}

/* =====================================================================
   누르면 상세 (터치/클릭) + 상세 팝업
   ===================================================================== */
.tap { cursor: pointer; }
.chart .hit, .gantt .hit, svg .hit { fill: transparent; }
.chart .tap:hover .hit { fill: rgba(47, 111, 208, .06); }
.chart .tick { stroke: #c3cad4; }
.commit.tap:hover { border-color: #b9c2ce; box-shadow: 0 1px 4px rgba(0, 0, 0, .06); }

.modal-backdrop {
    position: fixed; inset: 0; z-index: 60; background: rgba(15, 23, 35, .45);
    display: flex; align-items: flex-end; justify-content: center;
    animation: fade-in .15s ease;
}
/* 휴대폰: 아래에서 올라오는 시트 */
.modal {
    width: 100%; max-height: 85vh; max-height: 85dvh; overflow-y: auto;
    background: #fff; border-radius: 16px 16px 0 0; padding: 16px 18px 28px;
    box-shadow: 0 -8px 24px rgba(0, 0, 0, .15); animation: sheet-up .2s ease;
}
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.modal-head h3 { margin: 0; font-size: 16px; line-height: 1.4; }
.modal-close {
    flex: none; width: 36px; height: 36px; border: 0; border-radius: 8px; background: #f0f2f5;
    color: var(--muted); cursor: pointer; font-size: 15px;
}
.modal-rows { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 8px 14px; margin: 0; font-size: var(--fs-sm); }
.modal-rows dt { color: var(--muted); white-space: pre; }
.modal-rows dd { margin: 0; font-weight: 600; }
.modal-sub { font-size: var(--fs-sm); margin: 16px 0 6px; }
.modal-sub small { color: var(--muted); font-weight: normal; }
.modal .table { margin-top: 4px; }
.modal .btn { margin-top: 14px; }

/* 상세 시트가 열려 있는 동안: 시트 안 스크롤이 끝나도 뒤 본문이 밀리지 않게 */
.modal { overscroll-behavior: contain; }
.modal-backdrop { overscroll-behavior: contain; touch-action: none; }
.modal-backdrop .modal { touch-action: pan-y; }
/* html 만 잠금: body 까지 hidden 이면 body 가 스크롤 컨테이너가 되어 sticky 메뉴·도움말이 위로 튄다 */
html:has(.modal-backdrop) { overflow: hidden; }
/* 스크롤바가 사라지며 본문이 옆으로 밀리지 않게 자리 유지 */
html { scrollbar-gutter: stable; }

/* ───────── 버튼 진행 표시 · 알림 ───────── */
.spinner {
    width: 14px; height: 14px; border-radius: 50%; flex: none;
    border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.btn[aria-busy="true"] { cursor: progress; }

.toast-area {
    position: fixed; left: 0; right: 0; bottom: 16px; z-index: 80;
    display: flex; justify-content: center; padding: 0 12px; pointer-events: none;
}
.toast {
    pointer-events: auto; display: flex; align-items: flex-start; gap: 10px;
    max-width: 560px; width: 100%; padding: 12px 10px 12px 14px; border-radius: 10px;
    background: #1f2a3a; color: #fff; font-size: var(--fs-sm); line-height: 1.5;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .22); border-left: 4px solid #6b8fc7; animation: toast-in .18s ease;
}
.toast span { flex: 1; min-width: 0; }
.toast.ok { border-left-color: #3fbf86; }
.toast.bad { border-left-color: #ef5b6b; }
.toast-close { flex: none; width: 28px; height: 28px; margin: -4px 0; border: 0; border-radius: 6px; background: transparent; color: #c6d0dd; cursor: pointer; }
.toast-close:hover { background: rgba(255, 255, 255, .1); color: #fff; }
@keyframes toast-in { from { transform: translateY(12px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ───────── 숫자 입력 ▲▼ 버튼 (StepButtons) ───────── */
.stepper { display: inline-flex; align-items: stretch; width: 112px; max-width: 100%; vertical-align: middle; }
.stepper > input[type="number"]:not([type="checkbox"]) {
    flex: 1 1 auto; width: 100%; min-width: 0; max-width: none; border-radius: 8px 0 0 8px; -moz-appearance: textfield; appearance: textfield;
}
.stepper > input[type="number"]::-webkit-inner-spin-button,
.stepper > input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.stepper-btns {
    flex: none; display: flex; flex-direction: column; width: 30px;
    border: 1px solid var(--line); border-left: 0; border-radius: 0 8px 8px 0; overflow: hidden; background: #f7f9fb;
}
.stepper-btns button {
    flex: 1; display: flex; align-items: center; justify-content: center; min-height: 0; padding: 0;
    border: 0; background: transparent; color: var(--muted); cursor: pointer; touch-action: manipulation;
}
.stepper-btns button + button { border-top: 1px solid var(--line); }
.stepper-btns button:hover { background: #eaeef3; color: var(--text); }
.stepper-btns button:active { background: var(--accent-bg); color: var(--accent); }
.stepper-btns svg { width: 10px; height: 6px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.stepper-btns button:focus { outline: none; }
.weights .stepper { width: 100%; }
.table.form .stepper { width: 100%; min-width: 96px; max-width: 150px; }
.stepper:has(input.short) { width: 100px; }
.range-input .stepper { width: 118px; }
@media (min-width: 768px) { .weights .stepper { width: 114px; } }

/* ───────── 펼침 선택 상자 (Dropdown) ───────── */
.dropdown { position: relative; width: 100%; }
.dropdown-btn {
    display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%;
    min-height: var(--control-h); padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px;
    background: #fff; color: var(--text); font-size: var(--fs-input); text-align: left; cursor: pointer;
}
.dropdown-btn span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dropdown-btn .icon { flex: none; color: var(--muted); transition: transform .15s ease; }
.dropdown.open .dropdown-btn { border-color: var(--accent); outline: 2px solid rgba(47, 111, 208, .35); }
.dropdown.open .dropdown-btn .icon { transform: rotate(180deg); }
.dropdown-backdrop { position: fixed; inset: 0; z-index: 45; }
/* 위치·폭·높이는 Dropdown.razor가 버튼 좌표로 계산해 style에 넣는다 */
.dropdown-list {
    position: fixed; z-index: 46; box-sizing: border-box;
    margin: 0; padding: 4px; list-style: none; max-height: 300px; overflow-y: auto; overscroll-behavior: contain;
    background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 24px rgba(0, 0, 0, .12);
}
.dropdown-list li {
    display: flex; align-items: center; min-height: 40px; padding: 0 10px; border-radius: 6px; text-align: left; line-height: 1.35; padding-block: 6px;
    color: var(--text); font-size: var(--fs-input); cursor: pointer;
}
.dropdown-list li:hover, .dropdown-list li:focus-visible { background: #eef2f7; outline: none; }
.dropdown-list li.on { background: var(--accent-bg); color: var(--accent); font-weight: 700; }

@keyframes sheet-up { from { transform: translateY(30px); opacity: .6; } to { transform: none; opacity: 1; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

/* 태블릿 이상: 가운데 모달 */
@media (min-width: 768px) {
    .modal-backdrop { align-items: center; padding: 24px; }
    .modal { width: min(520px, 100%); border-radius: 14px; padding: 18px 22px 22px; box-shadow: 0 16px 40px rgba(0, 0, 0, .2); }
}

/* =====================================================================
   고객지원: 문의 양식, 오픈소스 목록
   ===================================================================== */
.plain-list { margin: 0; padding-left: 18px; font-size: var(--fs-sm); line-height: 1.8; }
.req { color: var(--bad); font-weight: 700; }

.form-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: var(--fs-sm); font-weight: 600; }
.field input, .field textarea { width: 100%; font-weight: normal; }
.field textarea {
    min-height: 150px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px;
    font-size: var(--fs-input); line-height: 1.6; resize: vertical; background: #fff;
}
.field textarea:focus { outline: 2px solid rgba(47, 111, 208, .35); border-color: var(--accent); }
.field input.invalid, .field textarea.invalid { border-color: var(--bad); }
.validation-message { color: var(--bad); font-size: var(--fs-xs); font-weight: normal; }

.consent { display: flex; align-items: flex-start; gap: 10px; font-size: var(--fs-sm); cursor: pointer; line-height: 1.5; }
.consent input { margin-top: 2px; flex: none; }
.consent.all { padding: 12px 14px; margin-bottom: 10px; border: 1px solid var(--line); border-radius: 8px; background: #f7f9fb; }
.consent-box { border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; margin-bottom: 10px; }
.consent-box details { margin: 8px 0 0 28px; }
.consent-box summary { cursor: pointer; color: var(--accent); font-size: var(--fs-xs); }
.policy { margin: 8px 0 0; padding: 10px 12px; max-height: 260px; overflow-y: auto; background: #f7f9fb; border-radius: 6px; font-size: var(--fs-xs); line-height: 1.6; }
.policy dt { font-weight: 700; margin-top: 8px; }
.policy dt:first-child { margin-top: 0; }
.policy dd { margin: 2px 0 0; color: #4b5563; }
.form-error { color: var(--bad); font-weight: 600; font-size: var(--fs-sm); margin: 10px 0 0; }
.form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-top: 14px; }
.form-actions .btn { flex: 1 1 100%; min-height: 46px; font-size: var(--fs); }

.done-card { text-align: center; padding: 32px 18px; }
.done-card h2 { justify-content: center; font-size: 18px; }
.done-card p { margin: 0 0 18px; font-size: var(--fs-sm); }
.done-icon { width: 52px; height: 52px; margin: 0 auto 12px; border-radius: 50%; background: var(--good-bg); color: var(--good); font-size: 26px; line-height: 52px; font-weight: 700; }

@media (min-width: 768px) {
    .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 18px; }
    .field.wide { grid-column: 1 / -1; }
    .form-actions .btn { flex: none; min-width: 180px; min-height: var(--control-h); font-size: var(--fs-sm); }
    .support-form { max-width: 900px; }
}

/* =====================================================================
   사용자 가이드 (/guide) — 본문 스타일은 PDF(guide-print.css)와 공유
   ===================================================================== */
.guide-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0 var(--gap); align-items: start; }
.guide-toc b { display: block; margin-bottom: 6px; font-size: var(--fs-sm); }
.guide-toc ol { margin: 0; padding-left: 0; list-style: none; display: flex; flex-wrap: wrap; gap: 6px; }
.guide-toc a {
    display: inline-flex; align-items: center; min-height: 34px; padding: 0 12px; border: 1px solid var(--line);
    border-radius: 999px; font-size: var(--fs-xs); text-decoration: none; color: var(--text); background: #fff;
}
.guide-toc a:hover { border-color: var(--accent); color: var(--accent); }
.guide-body { padding: 18px 16px; }

.guide { font-size: var(--fs); line-height: 1.75; color: #2a2f36; word-break: keep-all; overflow-wrap: break-word; }
.guide p { margin: 0 0 12px; }
.g-chapter { margin-bottom: 36px; scroll-margin-top: calc(var(--topbar-h) + 12px); }
.g-chapter:last-child { margin-bottom: 0; }
.g-h2 {
    display: flex; align-items: center; gap: 10px; font-size: 20px; margin: 0 0 16px; padding-bottom: 10px;
    border-bottom: 2px solid var(--accent); color: #17345f;
}
.g-num {
    display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 8px;
    background: var(--accent); color: #fff; font-size: 15px; flex: none;
}
.g-h3 { font-size: 16px; margin: 22px 0 10px; color: var(--accent); }
.g-list, .g-steps { margin: 0 0 14px; padding-left: 22px; }
.g-list li, .g-steps li { margin-bottom: 6px; }
.g-note { color: var(--muted); font-size: var(--fs-sm); }
.g-table { width: 100%; border-collapse: collapse; margin: 0 0 16px; font-size: var(--fs-sm); line-height: 1.6; }
.g-table th, .g-table td { border: 1px solid var(--line); padding: 8px 10px; vertical-align: top; text-align: left; }
.g-table thead th { background: #eef3fb; color: #17345f; font-weight: 700; }
.g-table tbody th { background: #f8fafc; font-weight: 700; white-space: nowrap; }
.g-table .r { text-align: right; white-space: nowrap; }
.g-fig { margin: 4px 0 18px; }
.g-fig img { display: block; width: 100%; height: auto; border: 1px solid var(--line); border-radius: 8px; }
.g-fig figcaption { margin-top: 6px; color: var(--muted); font-size: var(--fs-xs); text-align: center; }
.g-row2, .g-row3 { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0 14px; }
.g-row3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-fig.small img { max-width: 220px; margin: 0 auto; }
.g-callout { margin: 6px 0 16px; padding: 12px 14px; border-left: 4px solid var(--accent); background: #f2f6fd; border-radius: 0 8px 8px 0; font-size: var(--fs-sm); line-height: 1.7; }
.g-callout b:first-child { display: block; margin-bottom: 2px; color: #17345f; }
.g-code { margin: 0 0 10px; padding: 10px 12px; background: #1e2633; color: #dfe8f5; border-radius: 8px; font-family: Consolas, "Courier New", monospace; font-size: 13px; overflow-x: auto; white-space: nowrap; }
.guide code { padding: 1px 5px; background: #eef1f5; border-radius: 4px; font-size: .92em; }
.g-flow { list-style: none; counter-reset: flow; margin: 0 0 16px; padding: 0; }
.g-flow li { counter-increment: flow; position: relative; margin: 0 0 10px; padding: 10px 12px 10px 52px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.g-flow li::before {
    content: counter(flow); position: absolute; left: 12px; top: 10px; width: 28px; height: 28px; border-radius: 50%;
    background: var(--accent); color: #fff; font-weight: 700; text-align: center; line-height: 28px; font-size: 14px;
}
.g-flow li > span { display: inline-block; margin-left: 6px; padding: 1px 8px; border-radius: 999px; background: #eef3fb; color: var(--accent); font-size: var(--fs-xs); }
.g-flow li p { margin: 4px 0 0; font-size: var(--fs-sm); color: #4b5563; }
.g-faq dt { font-weight: 700; margin-top: 14px; color: #17345f; }
.g-faq dt::before { content: "Q. "; color: var(--accent); }
.g-faq dd { margin: 4px 0 0; padding-left: 22px; font-size: var(--fs-sm); color: #4b5563; }

@media (min-width: 768px) {
    .guide-body { padding: 24px 28px; }
    .g-row2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 1200px) {
    .guide-layout { grid-template-columns: 210px minmax(0, 1fr); }
    .guide-toc { position: sticky; top: calc(var(--topbar-h) + 16px); }
    .guide-toc ol { display: block; }
    .guide-toc li { margin-bottom: 2px; }
    .guide-toc a { display: flex; border: 0; border-radius: 6px; min-height: 32px; padding: 0 8px; background: transparent; font-size: var(--fs-sm); }
    .guide-toc a:hover { background: #eef2f7; }
}

/* ───── 연락처: 국가번호 콤보박스 + 번호 입력 ───── */
.field > label { display: block; }
.phone-input {
    position: relative; display: flex; align-items: stretch; min-height: var(--control-h);
    border: 1px solid var(--line); border-radius: 8px; background: #fff;
}
.phone-input:focus-within { outline: 2px solid rgba(47, 111, 208, .35); border-color: var(--accent); }
.phone-input:has(input.invalid) { border-color: var(--bad); }
.phone-input > input { flex: 1; min-width: 0; border: 0 !important; outline: none !important; background: transparent; border-radius: 0 8px 8px 0; }
/* 목록 창은 국가번호 칸 + 번호 칸 전체(.phone-input) 폭에 맞춘다 */
.ccp { position: static; display: flex; }
.ccp-button {
    display: inline-flex; align-items: center; gap: 4px; padding: 0 8px 0 12px; border: 0; border-right: 1px solid var(--line);
    background: #f7f9fb; border-radius: 8px 0 0 8px; cursor: pointer; font-size: var(--fs-sm); color: var(--text); white-space: nowrap;
}
.ccp-button:hover { background: #eef2f7; }
.ccp-iso { font-weight: 700; }
.ccp-dial { color: var(--muted); font-variant-numeric: tabular-nums; }
.ccp-backdrop { position: fixed; inset: 0; z-index: 50; }
.ccp-panel {
    position: absolute; left: -1px; top: calc(100% + 6px); z-index: 51;
    right: -1px; background: #fff; border: 1px solid var(--line); border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .14); overflow: hidden;
}
.ccp-search { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-bottom: 1px solid var(--line); color: var(--muted); }
.ccp-search input { flex: 1; min-width: 0; border: 0 !important; outline: none !important; padding: 4px 0; min-height: 32px; }
.ccp-list { list-style: none; margin: 0; padding: 4px; max-height: 280px; overflow-y: auto; }
.ccp-list button {
    display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; align-items: center; gap: 8px; width: 100%;
    min-height: 40px; padding: 0 10px; border: 0; border-radius: 6px; background: none; cursor: pointer; text-align: left; font-size: var(--fs-sm);
}
.ccp-list button:hover { background: #f2f6fd; }
.ccp-list button.on { background: var(--accent-bg); }
.ccp-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ccp-name small { color: var(--muted); margin-left: 4px; }
.ccp-empty { padding: 14px 10px; color: var(--muted); font-size: var(--fs-sm); text-align: center; }

/* 숫자 전용 입력칸: 한글 조합 중에는 실제 글자·커서를 숨기고 숫자 덮개(.digits-mask)만 보인다 (js/digits-only.js) */
input.ime-masked { color: transparent !important; caret-color: transparent; }
.digits-mask {
    position: absolute; display: none; align-items: center; box-sizing: border-box;
    pointer-events: none; white-space: pre; overflow: hidden;
}
/* 덮개 안의 가짜 커서: 한글 조합 중에도 입력칸에 포커스가 있는 것처럼 커서가 제자리에서 깜빡인다 */
.digits-mask .mask-caret {
    display: inline-block; width: 1px; height: 1.15em; margin-right: -1px; background: currentColor;
    animation: mask-caret-blink 1.06s step-end infinite;
}
@keyframes mask-caret-blink { 50% { opacity: 0; } }

/* ───────── 공통 보조 ───────── */
/* 체크박스 + 글자: 표·카드 안에서 체크박스와 글자가 같은 높이에 오고, 위 요소와 간격을 둔다 */
.check { display: inline-flex; align-items: center; gap: 8px; min-height: var(--control-h); font-size: var(--fs-sm); cursor: pointer; }
.check input[type="checkbox"] { width: 18px; height: 18px; margin: 0; flex: none; accent-color: var(--accent); }
.check.mt { margin-top: 12px; }
.toolbar > label:has(input[type="checkbox"]) input[type="checkbox"] { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); }

/* 실행 결과 안내 (작업 계획 화면) */
.run-msg { margin: 0; padding: 8px 12px; border-radius: 8px; background: #eef3fb; color: #2a4b7c; font-size: var(--fs-sm); line-height: 1.5; }
.run-msg.ok { background: var(--good-bg); color: var(--good); }
.run-msg.bad { background: #fde4e7; color: var(--bad); }
.plan-stamp { margin: 0; font-size: var(--fs-xs); color: var(--muted); }

.legend .bdbar { background: #d0313f; }
.gantt .grid.day { stroke: #9aa7b8; stroke-width: 1.5; }
.table tr.best-row td { background: var(--good-bg); }
.table.form small.at { display: block; margin-top: 2px; font-size: 11px; }
label.inline { display: inline-flex; align-items: center; gap: 4px; margin-right: 10px; font-size: var(--fs-sm); white-space: nowrap; }
input.short { width: 72px; }

/* 실험 설계: 요인 행 (요인 선택 + 요인 종류에 맞는 수준 입력) */
.factor-rows { display: flex; flex-direction: column; gap: 10px; }
.factor-row { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; }
.factor-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; }
.factor-head select { min-width: 220px; }
.factor-head .muted { font-size: var(--fs-xs); }
.factor-levels { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.range-input { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.range-input label { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-sm); }
.range-input input { width: 90px; }
.level-summary { font-size: var(--fs-xs); color: var(--muted); }

.flow-diagram { max-width: 760px; }

/* 개발 명세 (/dev/spec) — SVG 도면 글자 (인쇄용은 dev-spec-print.css) */
.spec .d-svg svg { display: block; width: 100%; height: auto; }
.spec .d-t { font-size: 11px; fill: #4b5563; }
.spec .d-h { font-size: 13px; font-weight: 700; fill: #4b5563; }
.spec .d-th { font-size: 12.5px; font-weight: 700; fill: #fff; }
.spec .d-col { font-size: 11.5px; fill: #2a2f36; }
.spec .d-key { font-size: 10px; font-weight: 700; fill: #c0466b; }
.spec code { font-family: Consolas, "Courier New", monospace; font-size: .92em; background: #f2f4f7; padding: 0 4px; border-radius: 3px; }
.spec pre.g-code { white-space: pre; line-height: 1.6; }
.spec .g-table.tables td:nth-child(2) { white-space: nowrap; }

/* What-if 돌발 상황 대응: 종류·대상 선택이 잘리지 않게, 내용 칸은 줄바꿈 허용 */
.table.events select { width: auto; max-width: none; }
.table.events td:nth-child(1) select { min-width: 120px; }
.table.events td:nth-child(2) select { min-width: 200px; }
.table.events td:nth-child(3) input { width: 80px; }
.table.events td:nth-child(4) { min-width: 300px; }
.table.events small.hint { display: block; margin-top: 4px; }
.table.events label.inline input { width: 70px; }
.table.responses td:first-child { min-width: 230px; }
