:root {
  --navy: #1e3a8a; --navy-2: #1e40af; --blue: #2563eb; --blue-50: #eff6ff; --blue-100: #dbeafe;
  --ink: #0f172a; --ink-2: #334155; --muted: #64748b; --faint: #94a3b8;
  --line: #e2e8f0; --line-2: #cbd5e1; --bg: #f8fafc; --card: #fff;
  --ok: #166534; --ok-bg: #dcfce7; --warn: #92400e; --warn-bg: #fef3c7; --err: #b91c1c; --err-bg: #fee2e2;
  --series-1: #2a78d6; --series-2: #eb6834;
  --radius: 10px; --shadow: 0 1px 2px rgba(15,23,42,.06), 0 1px 3px rgba(15,23,42,.08);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body { font-family: "Pretendard", -apple-system, BlinkMacSystemFont, "Malgun Gothic", "맑은 고딕", "Apple SD Gothic Neo", sans-serif; background: var(--bg); color: var(--ink); font-size: 13px; -webkit-font-smoothing: antialiased; word-break: keep-all; overflow-wrap: anywhere; }
.hide { display: none !important; }
a { color: var(--blue); }
button { font-family: inherit; }

/* ---------- 입력 */
label { font-size: 11.5px; font-weight: 700; color: #475569; }
input:not([type]), input[type="text"], input[type="search"], input[type="password"], input[type="number"], input[type="date"], input[type="email"], input[type="tel"], select, textarea {
  padding: 8px 10px; border: 1px solid var(--line-2); border-radius: 6px; font-size: 13px; outline: none; background: #fff; color: var(--ink); font-family: inherit; width: 100%; min-width: 0;
}
input:focus, select:focus, textarea:focus { border-color: #3b82f6; box-shadow: 0 0 0 3px rgba(59,130,246,.18); }
input[type="number"] { text-align: right; }
textarea { resize: vertical; min-height: 60px; }
.form-group { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; min-width: 0; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 0 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 0 12px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 0 12px; }
.hint { font-size: 11.5px; color: var(--muted); line-height: 1.5; }

/* ---------- 버튼 */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border-radius: 7px; font-size: 13px; font-weight: 700; padding: 9px 14px; cursor: pointer; border: 1px solid transparent; text-decoration: none; white-space: nowrap; transition: background .12s, border-color .12s; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--navy-2); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--navy); }
.btn-ghost { background: #fff; color: var(--ink-2); border-color: var(--line-2); }
.btn-ghost:hover:not(:disabled) { background: #f1f5f9; }
.btn-danger { background: #fff; color: var(--err); border-color: #fecaca; }
.btn-danger:hover:not(:disabled) { background: #fef2f2; }
.btn-ok { background: #15803d; color: #fff; }
.btn-sm { padding: 6px 10px; font-size: 12px; border-radius: 6px; }
.btn-block { width: 100%; }
.link-btn { background: none; border: none; color: var(--blue); cursor: pointer; font-weight: 700; font-size: 12px; padding: 0; }

/* ---------- 배지 / 배너 */
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; padding: 3px 8px; border-radius: 999px; font-weight: 700; white-space: nowrap; }
.b-blue { background: var(--blue-50); color: var(--navy-2); }
.b-ok { background: var(--ok-bg); color: var(--ok); }
.b-warn { background: var(--warn-bg); color: var(--warn); }
.b-err { background: var(--err-bg); color: var(--err); }
.b-gray { background: #f1f5f9; color: var(--ink-2); }
.banner { padding: 10px 14px; border-radius: 8px; font-size: 12.5px; margin-bottom: 12px; line-height: 1.55; }
.banner.warn { background: #fffbeb; border: 1px solid #fde68a; color: var(--warn); }
.banner.err { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; }
.banner.info { background: var(--blue-50); border: 1px solid #bfdbfe; color: var(--navy); }
.banner.ok { background: #f0fdf4; border: 1px solid #bbf7d0; color: var(--ok); }

/* ---------- 로그인 */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-brand { background: linear-gradient(150deg, #0b1f5c 0%, #1e3a8a 55%, #2563eb 100%); color: #fff; padding: 56px 64px; display: flex; flex-direction: column; justify-content: space-between; }
.auth-logo { font-size: 22px; font-weight: 900; letter-spacing: 2px; }
.auth-logo small { display: block; font-size: 12px; font-weight: 600; letter-spacing: 0; opacity: .75; margin-top: 4px; }
.auth-head { font-size: 30px; font-weight: 800; line-height: 1.35; margin: 40px 0 16px; }
.auth-sub { font-size: 14.5px; opacity: .85; line-height: 1.7; max-width: 460px; }
.auth-points { list-style: none; margin-top: 32px; display: grid; gap: 14px; }
.auth-points li { display: flex; gap: 12px; align-items: flex-start; font-size: 14px; line-height: 1.5; }
.auth-points b { display: block; }
.auth-points span { opacity: .8; font-size: 12.5px; }
.auth-points .dot { flex: 0 0 26px; height: 26px; border-radius: 8px; background: rgba(255,255,255,.14); display: grid; place-items: center; font-size: 13px; }
.auth-foot { font-size: 12px; opacity: .7; }
.auth-form { display: flex; align-items: center; justify-content: center; padding: 32px 20px; background: #fff; }
.auth-box { width: 100%; max-width: 380px; }
.auth-title { font-size: 24px; font-weight: 800; margin-bottom: 6px; }
.auth-desc { color: var(--muted); font-size: 13px; margin-bottom: 26px; }
.auth-box .btn-primary { width: 100%; padding: 12px; font-size: 14px; margin-top: 6px; }
.auth-links { margin-top: 22px; font-size: 12px; color: var(--muted); text-align: center; line-height: 1.8; }
.auth-links a { color: var(--muted); }

/* ---------- 앱 골격 */
.app { display: flex; flex-direction: column; height: 100vh; }
.header { height: 56px; background: var(--navy); color: #fff; display: flex; align-items: center; justify-content: space-between; padding: 0 18px; gap: 12px; flex-shrink: 0; }
.header-left, .header-right { display: flex; align-items: center; gap: 10px; min-width: 0; }
.logo { font-size: 17px; font-weight: 900; letter-spacing: 1.5px; }
.h-company { font-size: 12px; font-weight: 700; background: rgba(255,255,255,.14); padding: 4px 10px; border-radius: 999px; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.header .search-box { background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.5' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-3.5-3.5'/%3E%3C/svg%3E") no-repeat 11px center; border: 2px solid #93c5fd; border-radius: 8px; padding: 7px 12px 7px 32px; color: var(--ink); caret-color: var(--navy); outline: none; font-size: 13px; font-weight: 600; width: 320px; font-family: inherit; }
.header .search-box::placeholder { color: var(--muted); font-weight: 400; }
.header .search-box:focus { border-color: #fbbf24; box-shadow: 0 0 0 3px rgba(251,191,36,.35); }
.user-menu { position: relative; }
.user-btn { background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.2); color: #fff; padding: 6px 12px; border-radius: 8px; cursor: pointer; font-weight: 700; font-size: 12.5px; }
.menu { position: absolute; right: 0; top: 42px; background: #fff; color: var(--ink); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 30px rgba(15,23,42,.18); min-width: 200px; padding: 6px; z-index: 50; }
.menu button { display: block; width: 100%; text-align: left; background: none; border: none; padding: 9px 10px; border-radius: 6px; cursor: pointer; font-size: 13px; color: var(--ink-2); }
.menu button:hover { background: #f1f5f9; }
.main { display: flex; flex: 1; overflow: hidden; }
.sidebar { width: 200px; background: #fff; border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 10px 8px; gap: 2px; flex-shrink: 0; overflow-y: auto; }
.nav-btn { width: 100%; text-align: left; padding: 10px 12px; font-size: 13.5px; font-weight: 600; color: #475569; background: transparent; border: none; border-radius: 8px; cursor: pointer; display: flex; gap: 10px; align-items: center; }
.nav-btn .ic { width: 18px; text-align: center; opacity: .8; }
.nav-btn:hover { background: #f1f5f9; color: var(--navy); }
.nav-btn.active { background: var(--blue-50); color: var(--navy); font-weight: 800; }
.nav-sep { height: 1px; background: var(--line); margin: 8px 6px; }
.content { flex: 1; overflow-y: auto; padding: 22px 26px 60px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.page-title { font-size: 19px; font-weight: 800; }
.page-sub { font-size: 12.5px; color: var(--muted); margin-top: 3px; }

/* ---------- 카드/패널 */
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 14px; box-shadow: var(--shadow); }
.panel-title { font-size: 14px; font-weight: 800; color: var(--ink); margin-bottom: 4px; }
.panel-sub { font-size: 12px; color: var(--muted); margin-bottom: 14px; }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 12px; margin-bottom: 16px; }
.metric { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.metric.click { cursor: pointer; }
.metric.click:hover { border-color: #93c5fd; }
.metric-label { font-size: 12px; font-weight: 700; color: var(--muted); }
.metric-value { font-size: 22px; font-weight: 800; color: var(--ink); margin-top: 6px; letter-spacing: -.3px; }
.metric-foot { font-size: 11.5px; color: var(--muted); margin-top: 4px; }
.metric.risk .metric-value { color: var(--err); }
.metric.warn .metric-value { color: #b45309; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.toolbar select { width: auto; min-width: 120px; }

/* ---------- 견적 카드 */
.q-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.q-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; display: flex; flex-direction: column; gap: 8px; position: relative; box-shadow: var(--shadow); }
.q-card:hover { border-color: #bfdbfe; }
.q-card .thumb { width: 100%; height: 120px; object-fit: contain; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; }
.q-top { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.q-name { font-size: 15px; font-weight: 800; word-break: break-all; }
.q-meta { font-size: 12px; color: var(--muted); }
.q-price { font-size: 18px; font-weight: 800; color: var(--navy-2); }
.q-price small { font-size: 11.5px; font-weight: 500; color: var(--muted); margin-left: 4px; }
.q-actions { display: flex; gap: 6px; margin-top: 2px; }
.q-actions .btn { flex: 1; }
.card-check { position: absolute; top: 12px; left: 12px; width: 18px; height: 18px; z-index: 2; }
.status-chip { font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 999px; white-space: nowrap; }
.pager { display: flex; gap: 8px; align-items: center; justify-content: center; margin-top: 16px; }
.empty { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty b { display: block; font-size: 15px; color: var(--ink); margin-bottom: 6px; }

/* ---------- 시작 가이드 */
.onboard { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 10px; margin-top: 12px; }
.ob-step { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; background: #fff; display: flex; gap: 10px; align-items: flex-start; }
.ob-step .n { flex: 0 0 24px; height: 24px; border-radius: 50%; background: var(--blue-50); color: var(--navy-2); font-weight: 800; display: grid; place-items: center; font-size: 12px; }
.ob-step.done .n { background: var(--ok-bg); color: var(--ok); }
.ob-step b { display: block; font-size: 13px; margin-bottom: 3px; }

/* ---------- 견적 편집 */
.editor { display: grid; grid-template-columns: minmax(0,1fr) 340px; gap: 16px; align-items: start; }
.summary { position: sticky; top: 0; }
.item-card { border: 1px solid var(--line); border-radius: var(--radius); background: #fff; margin-bottom: 12px; box-shadow: var(--shadow); }
.item-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--line); background: #fbfdff; border-radius: var(--radius) var(--radius) 0 0; gap: 8px; }
.item-head b { font-size: 13.5px; }
.item-body { padding: 14px; display: grid; grid-template-columns: 250px minmax(0,1fr); gap: 16px; }
.dropzone { border: 2px dashed #93c5fd; background: var(--blue-50); border-radius: 10px; min-height: 150px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; cursor: pointer; padding: 12px; text-align: center; transition: background .12s; }
.dropzone.drag { background: var(--blue-100); border-color: var(--blue); }
.dropzone b { font-size: 13px; color: var(--navy); }
.dropzone span { font-size: 11.5px; color: var(--muted); word-break: break-all; }
.dropzone img { max-width: 100%; max-height: 110px; object-fit: contain; border-radius: 6px; }
.cost-lines { font-size: 12px; line-height: 1.9; border-top: 1px dashed var(--line); margin-top: 4px; padding-top: 8px; display: grid; grid-template-columns: repeat(5, minmax(0,1fr)); gap: 6px; }
.cost-lines div { background: var(--bg); border-radius: 6px; padding: 4px 8px; }
.cost-lines span { display: block; color: var(--muted); font-size: 11px; }
.cost-lines b { font-size: 12.5px; }
.sum-row { display: flex; justify-content: space-between; font-size: 13px; padding: 5px 0; }
.sum-row span { color: var(--muted); }
.sum-total { display: flex; justify-content: space-between; background: var(--blue-50); color: var(--navy); font-weight: 800; padding: 10px 12px; border-radius: 8px; margin-top: 8px; font-size: 15px; }
.sum-grand { display: flex; justify-content: space-between; background: var(--ok-bg); color: var(--ok); font-weight: 800; padding: 10px 12px; border-radius: 8px; margin-top: 6px; font-size: 16px; }

/* AI 패널 */
.ai-box { margin-top: 10px; border: 1px solid #c7d2fe; background: #f8faff; border-radius: 10px; padding: 12px; }
.ai-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.ai-head b { font-size: 13px; color: #3730a3; }
.conf { display: inline-flex; gap: 6px; align-items: center; font-size: 11.5px; font-weight: 700; }
.conf .bar { width: 70px; height: 6px; background: #e0e7ff; border-radius: 3px; overflow: hidden; }
.conf .bar i { display: block; height: 100%; background: #4f46e5; border-radius: 3px; }
.bk { width: 100%; border-collapse: collapse; font-size: 12px; margin-top: 6px; }
.bk td { padding: 5px 6px; border-bottom: 1px solid #e0e7ff; vertical-align: top; }
.bk td:last-child { text-align: right; font-weight: 700; white-space: nowrap; }
.bk td.lab { font-weight: 700; color: var(--ink-2); white-space: nowrap; }
.bk td.det { color: var(--muted); }
.ex-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 6px 10px; margin-top: 8px; }
.ex-grid .form-group { margin-bottom: 4px; }
.ex-grid label { font-size: 11px; font-weight: 600; }
.ex-grid input, .ex-grid select { padding: 5px 7px; font-size: 12px; }
.sim { font-size: 12px; margin-top: 8px; }
.sim-row { display: flex; justify-content: space-between; gap: 8px; padding: 6px 8px; background: #fff; border: 1px solid #e0e7ff; border-radius: 6px; margin-top: 4px; }
details summary { cursor: pointer; font-weight: 700; font-size: 12px; color: #3730a3; margin-top: 8px; }

/* ---------- 모달 */
.modal { position: fixed; inset: 0; background: rgba(15,23,42,.55); z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal-box { background: #fff; border-radius: 14px; width: 100%; max-width: 1180px; max-height: 94vh; overflow: hidden; display: flex; flex-direction: column; box-shadow: 0 25px 60px rgba(15,23,42,.35); }
.modal-box.sm { max-width: 460px; }
.modal-head { padding: 14px 20px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.modal-head b { font-size: 16px; }
.modal-body { padding: 18px 20px; overflow-y: auto; }
.modal-close { background: none; border: none; font-size: 24px; cursor: pointer; color: var(--faint); line-height: 1; }
.detail { display: grid; grid-template-columns: minmax(0,1.35fr) minmax(0,1fr); gap: 18px; }
.d-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 14px 0; }
@media (max-width: 560px) { .d-actions { grid-template-columns: 1fr 1fr; } }
.ph-head { margin: 8px 0 4px; }
.ph-tbl { width: 100%; border-collapse: collapse; }
.ph-tbl td { padding: 6px; font-size: 13px; white-space: nowrap; border-bottom: 1px solid var(--line); }
.ph-tbl td.num { text-align: right; }
@media (max-width: 560px) {
  .ph-tbl, .ph-tbl tbody { display: block; }
  .ph-tbl tr { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 10px; padding: 7px 0; border-bottom: 1px solid var(--line); }
  .ph-tbl td { border: none; padding: 0; white-space: normal; }
  .ph-tbl td:nth-child(2) { flex: 1 1 70%; }
}
.tbl { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.tbl th { text-align: left; font-size: 11.5px; color: var(--muted); font-weight: 700; padding: 8px 8px; border-bottom: 1px solid var(--line); background: var(--bg); white-space: nowrap; }
.tbl td { padding: 8px 8px; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
.tbl td.num, .tbl th.num { text-align: right; white-space: nowrap; }
.tbl img { width: 54px; height: 38px; object-fit: contain; border: 1px solid var(--line); border-radius: 4px; background: var(--bg); }
.pdf-frame { width: 100%; height: 62vh; border: 1px solid var(--line-2); border-radius: 8px; margin-top: 12px; }
.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: 8px; overflow: hidden; }
.seg button { border: none; background: #fff; padding: 8px 14px; font-weight: 700; font-size: 12.5px; cursor: pointer; color: var(--ink-2); border-right: 1px solid var(--line-2); }
.seg button:last-child { border-right: none; }
.seg button.on-open { background: #f1f5f9; color: var(--ink); }
.seg button.on-won { background: var(--ok-bg); color: var(--ok); }
.seg button.on-lost { background: var(--err-bg); color: var(--err); }
.temp-pw { font-family: Consolas, monospace; font-size: 22px; font-weight: 800; letter-spacing: 2px; background: var(--bg); border: 1px dashed var(--line-2); border-radius: 8px; padding: 14px; text-align: center; margin: 12px 0; user-select: all; }

/* ---------- 공정/스케줄러 */
.mes-steps { display: flex; gap: 4px; overflow-x: auto; margin-top: 10px; }
.mes-step { flex: 1; min-width: 64px; text-align: center; font-size: 10.5px; font-weight: 700; padding: 6px 4px; border-radius: 6px; border: 1px solid var(--line-2); color: var(--faint); background: var(--bg); }
.cal-head, .cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0,1fr)); gap: 4px; }
.cal-hd { text-align: center; font-size: 12px; font-weight: 700; padding: 6px 0; background: #f1f5f9; border-radius: 6px; }
.cal-cell { min-height: 96px; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 6px; overflow-y: auto; }
.cal-cell.out { opacity: .4; }
.cal-cell.today { border-color: var(--blue); box-shadow: inset 0 0 0 1px var(--blue); }
.cal-cell.over { background: var(--blue-50); }
.chip { display: block; width: 100%; border: 1px solid #bfdbfe; background: var(--blue-50); color: var(--navy); border-radius: 5px; padding: 3px 6px; margin: 0 0 4px; font-size: 11px; font-weight: 700; cursor: grab; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; text-align: left; }
.chip.late { background: #fef2f2; border-color: #fecaca; color: var(--err); }
.sch-item { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 9px 12px; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; font-size: 12.5px; margin-bottom: 6px; }

/* ---------- 경영 현황 */
.charts { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 14px; }
.chart-box { position: relative; height: 280px; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--ink-2); margin-bottom: 8px; flex-wrap: wrap; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }

/* ---------- 설정 */
.set-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.set-tab { background: none; border: none; padding: 10px 14px; font-weight: 700; font-size: 13px; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; }
.set-tab.active { color: var(--navy); border-bottom-color: var(--navy); }
.asset-box { border: 1px dashed var(--line-2); border-radius: 10px; padding: 12px; display: flex; gap: 12px; align-items: center; }
.asset-box img { width: 120px; height: 64px; object-fit: contain; background: var(--bg); border-radius: 6px; border: 1px solid var(--line); }
.price-row { display: grid; grid-template-columns: minmax(0,1fr) 120px 32px; gap: 6px; margin-bottom: 6px; align-items: center; }
.labor-row { display: grid; grid-template-columns: minmax(0,1fr) 100px; gap: 8px; align-items: center; margin-bottom: 6px; font-size: 12.5px; }

.toast { position: fixed; right: 18px; bottom: 18px; background: var(--ink); color: #fff; padding: 11px 16px; border-radius: 8px; font-size: 13px; z-index: 3000; box-shadow: 0 8px 24px rgba(15,23,42,.3); max-width: 420px; }
.toast.err { background: #991b1b; }
.spin { display: inline-block; width: 14px; height: 14px; border: 2px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: sp .8s linear infinite; }
.btn-ghost .spin { border-color: #cbd5e1; border-top-color: var(--navy); }
@keyframes sp { to { transform: rotate(360deg); } }

/* ---------- 모바일 */
@media (max-width: 1100px) {
  .editor { grid-template-columns: 1fr; }
  .summary { position: static; }
  .charts { grid-template-columns: 1fr; }
  .detail { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .auth { grid-template-columns: 1fr; }
  .auth-brand { padding: 32px 24px; }
  .auth-head { font-size: 22px; margin-top: 20px; }
  .auth-points { display: none; }
  .main { flex-direction: column; }
  .sidebar { width: 100%; flex-direction: row; overflow-x: auto; border-right: none; border-bottom: 1px solid var(--line); padding: 6px; }
  .nav-btn { width: auto; white-space: nowrap; padding: 8px 10px; }
  .nav-sep { display: none; }
  .content { padding: 16px; }
  .metrics { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .grid-3, .grid-4, .onboard { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .item-body { grid-template-columns: 1fr; }
  .cost-lines { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .ex-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .header .search-box { width: 160px; }
  .h-company { display: none; }
}
@media (max-width: 560px) {
  .grid-2, .grid-3, .grid-4, .onboard { grid-template-columns: 1fr; }
  .header { padding: 0 10px; }
  .header .search-box { width: 120px; }
}

/* ---------- 도면 업로드 확인 카드 */
.dropzone.has { padding: 8px; min-height: 0; align-items: stretch; background: #fff; border-style: solid; border-color: var(--line-2); }
.dropzone.sm { min-height: 64px; padding: 10px; }
.file-card { display: flex; flex-direction: column; gap: 6px; text-align: left; width: 100%; font-size: 12px; }
.file-card b { display: block; font-size: 12.5px; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-card img { width: 100%; height: 130px; object-fit: contain; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); }
.file-card .fc-ic { width: 100%; height: 70px; border-radius: 8px; display: grid; place-items: center; font-weight: 900; font-size: 18px; }
.file-card .fc-ic.doc { background: var(--blue-50); color: var(--navy); border: 1px solid #bfdbfe; font-size: 12px; }
.file-card.bad .fc-ic { background: var(--err-bg); color: var(--err); font-size: 22px; }
.file-card.checking { flex-direction: row; align-items: center; color: var(--muted); padding: 18px 4px; }
.fc-ok { color: var(--ok); font-weight: 800; font-size: 11.5px; margin-bottom: 1px; }
.fc-err { color: var(--err); font-weight: 700; margin: 2px 0 4px; }
.fc-warn { color: #b45309; font-size: 11.5px; margin-top: 2px; }
.dropzone.has:hover { border-color: #93c5fd; }
.ai-file { margin-top: 8px; padding: 8px; border: 1px dashed #c7d2fe; border-radius: 8px; background: #f8faff; }
.spin.dark { border-color: #cbd5e1; border-top-color: var(--navy); flex: 0 0 14px; }
.meter { height: 5px; background: #e2e8f0; border-radius: 3px; overflow: hidden; margin-top: 4px; width: 140px; }
.meter i { display: block; height: 100%; border-radius: 3px; }
.dropzone.sm .file-card img { height: 90px; }

/* ---------- 미리보기 창 (견적서 · 도면) */
.modal-box.viewer { max-width: 1500px; width: 97vw; height: 95vh; max-height: 95vh; }
.viewer-head { gap: 12px; flex-wrap: wrap; }
.viewer-tools { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.viewer-tools .seg button { padding: 6px 10px; }
.viewer-body { flex: 1; min-height: 0; background: #525659; overflow: auto; display: flex; align-items: flex-start; justify-content: center; }
.viewer-pdf { width: 100%; height: 100%; border: 0; background: #525659; }
.viewer-img { display: block; margin: 16px auto; background: #fff; box-shadow: 0 4px 20px rgba(0,0,0,.4); cursor: zoom-in; image-rendering: auto; }
.viewer-img.fit { cursor: zoom-in; }
.viewer-img:not(.fit) { cursor: zoom-out; max-width: none; }
.viewer-body:has(.viewer-img.fit) { align-items: center; }
.viewer-msg { margin: auto; color: #e2e8f0; text-align: center; padding: 40px; font-size: 14px; line-height: 1.6; }
.viewer-msg b { font-size: 16px; color: #fff; }
img.clickable { cursor: zoom-in; }
img.clickable:hover { outline: 2px solid #93c5fd; outline-offset: 1px; }
@media (max-width: 900px) { .modal-box.viewer { width: 100vw; height: 100vh; max-height: 100vh; border-radius: 0; } .modal:has(.viewer) { padding: 0; } }

/* ---------- 대량 견적: 페이지 · 선택 · 목록형 */
.pager { flex-wrap: wrap; gap: 4px; }
.pg { min-width: 34px; height: 32px; padding: 0 8px; border: 1px solid var(--line-2); background: #fff; border-radius: 6px; font-weight: 700; font-size: 12.5px; color: var(--ink-2); cursor: pointer; }
.pg:hover { background: #f1f5f9; }
.pg.on { background: var(--navy-2); border-color: var(--navy-2); color: #fff; }
.pg-gap { color: var(--faint); padding: 0 2px; }
.pg-jump { display: inline-flex; gap: 4px; margin-left: 8px; }
.pg-jump input { width: 64px; padding: 5px 6px; font-size: 12px; }
.batch-bar { position: sticky; top: -22px; z-index: 5; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; background: #eef4ff; border: 1px solid #bfdbfe; border-radius: 10px; padding: 8px 12px; margin-bottom: 12px; box-shadow: var(--shadow); }
.batch-bar b { color: var(--navy); font-size: 13.5px; margin-right: 4px; }
.q-card.sel { border-color: var(--blue); box-shadow: 0 0 0 2px rgba(37,99,235,.25); }
.metric.on { border-color: currentColor; box-shadow: 0 0 0 2px rgba(220,38,38,.15); }
.toolbar .seg button { padding: 6px 10px; }
.q-list tbody tr { cursor: pointer; }
.q-list tbody tr:hover { background: #f8fafc; }
.q-list tbody tr.sel { background: #eef4ff; }
.q-list td { white-space: normal; vertical-align: middle; }
.q-list td.num { white-space: nowrap; }
.q-list .oc-st { display: flex; gap: 4px; flex-wrap: wrap; }
.q-list .badge, .q-list .status-chip { font-size: 10.5px; }

/* ---------- 공정 칸반 보드 */
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(230px, 1fr); gap: 10px; overflow-x: auto; padding-bottom: 8px; align-items: start; }
.kb-col { background: #f1f5f9; border: 1px solid var(--line); border-radius: 10px; display: flex; flex-direction: column; min-height: 220px; max-height: calc(100vh - 290px); }
.kb-col.over { background: #dbeafe; border-color: var(--blue); }
.kb-head { padding: 10px 12px 8px; border-top: 4px solid var(--navy-2); border-radius: 10px 10px 0 0; background: #fff; border-bottom: 1px solid var(--line); }
.kb-head b { font-size: 14px; }
.kb-n { display: inline-block; min-width: 22px; padding: 1px 7px; border-radius: 999px; background: var(--blue-50); color: var(--navy); font-weight: 800; font-size: 12px; text-align: center; }
.kb-meta { font-size: 11.5px; color: var(--muted); margin-top: 3px; }
.kb-list { padding: 8px; overflow-y: auto; display: flex; flex-direction: column; gap: 7px; flex: 1; }
.kb-empty { color: var(--faint); text-align: center; font-size: 12px; padding: 18px 0; }
.kb-card { background: #fff; border: 1px solid var(--line); border-left: 4px solid #cbd5e1; border-radius: 8px; padding: 8px 10px; cursor: pointer; box-shadow: 0 1px 2px rgba(15,23,42,.06); user-select: none; }
.kb-card:hover { border-color: #93c5fd; border-left-color: inherit; }
.kb-card.late { border-left-color: var(--err); }
.kb-card.soon { border-left-color: #f59e0b; }
.kb-card.sel { outline: 2px solid var(--blue); outline-offset: 1px; background: #f5f9ff; }
.kb-card.dragging { opacity: .45; }
.kb-top { display: flex; gap: 5px; align-items: center; flex-wrap: wrap; margin-bottom: 4px; }
.kb-top input { width: 15px; height: 15px; margin: 0; }
.kb-name { font-weight: 800; font-size: 13px; line-height: 1.35; word-break: break-all; }
.kb-sub { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.kb-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 4px; }
.kb-next { border: 1px solid var(--line-2); background: #fff; border-radius: 6px; width: 28px; height: 24px; cursor: pointer; font-weight: 800; color: var(--navy); }
.kb-next:hover { background: var(--navy-2); color: #fff; border-color: var(--navy-2); }
.kb-dw { font-size: 11px; color: var(--faint); }
.dd { font-size: 11px; font-weight: 800; padding: 1px 7px; border-radius: 999px; background: #f1f5f9; color: var(--ink-2); }
.dd-late { background: var(--err-bg); color: var(--err); }
.dd-soon { background: var(--warn-bg); color: #b45309; }
.dd-none { color: var(--faint); font-weight: 600; }
.dd-stuck { background: #ede9fe; color: #6d28d9; }
.kb-ship { background: #f0fdf4; border-style: dashed; border-color: #86efac; }
.kb-ship.over { background: #dcfce7; border-color: #16a34a; }
.kb-drop { align-items: center; justify-content: center; text-align: center; color: #15803d; font-weight: 700; font-size: 13px; line-height: 1.8; }

/* ---------- 현장 TV 모드 */
.tv { position: fixed; inset: 0; z-index: 5000; background: #0b1220; color: #e2e8f0; display: flex; flex-direction: column; padding: 18px 22px; font-size: 18px; }
.tv-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.tv-logo { font-weight: 900; letter-spacing: 2px; font-size: 22px; color: #fff; }
.tv-co { font-size: 20px; color: #94a3b8; margin-left: 8px; }
.tv-clock { font-size: 22px; font-weight: 700; color: #cbd5e1; }
.tv .btn-ghost { background: transparent; color: #cbd5e1; border-color: #334155; }
.tv-kpi { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin-bottom: 14px; }
.tv-kpi div { background: #111a2e; border: 1px solid #1e293b; border-radius: 12px; padding: 12px 16px; }
.tv-kpi span { display: block; font-size: 16px; color: #94a3b8; }
.tv-kpi b { font-size: 44px; font-weight: 900; color: #fff; line-height: 1.1; }
.tv-kpi .r b { color: #f87171; } .tv-kpi .o b { color: #fbbf24; } .tv-kpi .g b { color: #4ade80; }
.tv-board { flex: 1; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 12px; min-height: 0; }
.tv-col { background: #111a2e; border: 1px solid #1e293b; border-radius: 12px; padding: 10px; overflow: hidden; display: flex; flex-direction: column; gap: 8px; }
.tv-col-h { font-size: 21px; font-weight: 800; color: #fff; border-bottom: 4px solid; padding-bottom: 6px; display: flex; justify-content: space-between; }
.tv-card { background: #1a2540; border-left: 6px solid #475569; border-radius: 8px; padding: 8px 10px; }
.tv-card.late { border-left-color: #ef4444; background: #3a1820; }
.tv-card.soon { border-left-color: #f59e0b; }
.tv-dd { font-size: 15px; font-weight: 800; color: #fbbf24; }
.tv-card.late .tv-dd { color: #fca5a5; }
.tv-name { font-size: 19px; font-weight: 800; color: #fff; word-break: break-all; }
.tv-sub { font-size: 15px; color: #94a3b8; }
.tv-more { text-align: center; color: #94a3b8; font-size: 15px; }
.tv-foot { margin-top: 10px; font-size: 13px; color: #64748b; text-align: right; }
@media (max-width: 900px) { .kanban { grid-auto-columns: minmax(220px, 80vw); } .kb-col { max-height: none; } .tv-kpi { grid-template-columns: repeat(2, 1fr); } .tv-board { grid-auto-flow: row; overflow-y: auto; } }

/* ---------- 납기 스케줄러 */
.cal-head, .cal-grid { grid-template-columns: repeat(7, minmax(0,1fr)); }
.cal-cell { min-height: 112px; cursor: pointer; transition: background .1s; overflow: hidden; }
.cal-cell:hover { border-color: #93c5fd; }
.cal-d { display: flex; align-items: center; gap: 5px; font-size: 12.5px; font-weight: 800; margin-bottom: 5px; }
.cal-today { color: var(--blue); font-size: 11px; font-weight: 800; }
.cal-n { margin-left: auto; font-size: 11px; font-weight: 800; padding: 1px 7px; border-radius: 999px; background: var(--navy-2); color: #fff; }
.cal-n.late { background: var(--err); }
.cal-more { font-size: 11px; font-weight: 700; color: var(--navy); text-align: center; padding: 2px 0; }
.chip.tent, .wk-card.tent { border-style: dashed; background: #fff; color: var(--muted); }
.week { display: grid; grid-template-columns: repeat(7, minmax(150px, 1fr)); gap: 6px; overflow-x: auto; }
.wk-col { background: var(--bg); border: 1px solid var(--line); border-radius: 10px; min-height: 300px; display: flex; flex-direction: column; }
.wk-col.today { border-color: var(--blue); box-shadow: inset 0 0 0 1px var(--blue); }
.wk-col.over { background: var(--blue-50); }
.wk-h { padding: 8px 10px; border-bottom: 1px solid var(--line); background: #fff; border-radius: 10px 10px 0 0; cursor: pointer; }
.wk-list { padding: 6px; display: flex; flex-direction: column; gap: 6px; overflow-y: auto; max-height: 60vh; }
.wk-card { background: #fff; border: 1px solid var(--line); border-left: 4px solid #cbd5e1; border-radius: 7px; padding: 6px 8px; font-size: 12px; cursor: grab; }
.wk-card.late { border-left-color: var(--err); }
.wk-card b { display: block; font-size: 12.5px; word-break: break-all; }
.wk-card .status-chip { font-size: 10px; display: inline-block; margin-top: 3px; }
.load { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; }
.load-row { display: grid; grid-template-columns: 110px minmax(0,1fr) 190px; gap: 12px; align-items: center; background: none; border: none; padding: 4px 6px; border-radius: 8px; cursor: pointer; text-align: left; font-family: inherit; }
.load-row:hover { background: var(--bg); }
.load-lab { font-weight: 800; font-size: 13px; color: var(--ink); }
.load-lab small, .load-val small { display: block; font-size: 11px; font-weight: 500; color: var(--muted); }
.load-bar { position: relative; height: 16px; background: #eef2f7; border-radius: 4px; }
.load-bar i { position: absolute; left: 0; top: 0; bottom: 0; background: var(--series-1); border-radius: 4px; }
.load-bar i.warn { background: #f59e0b; }
.load-bar i.over { background: var(--err); }
.load-bar em { position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--ink); opacity: .6; }
.load-val { font-size: 12.5px; color: var(--ink-2); }
.load-val.warn b { color: #b45309; } .load-val.over b { color: var(--err); }
.modal-box.wide { max-width: 860px; }
@media (max-width: 900px) { .load-row { grid-template-columns: 80px minmax(0,1fr); } .load-val { grid-column: 2; } .cal-cell { min-height: 80px; } }

/* ---------- 본부 관리 */
.code { background: #f1f5f9; padding: 1px 6px; border-radius: 4px; font-size: 12px; color: var(--navy); }
.hq-acts { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.demo-panel { background: linear-gradient(135deg, #f5f3ff 0%, #eef4ff 100%); border-color: #c7d2fe; }
.banner.view-as { background: #f5f3ff; border: 1px solid #c4b5fd; color: #4c1d95; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.banner.view-as .btn { margin-left: auto; }

/* ---------- ? 설명 */
.tip { display: inline-flex; align-items: center; justify-content: center; width: 17px; height: 17px; border-radius: 50%; background: #e0e7ff; color: #3730a3; font-size: 11px; font-weight: 900; cursor: help; vertical-align: 1px; margin-left: 3px; user-select: none; flex: 0 0 17px; }
.tip:hover, .tip:focus { background: #4f46e5; color: #fff; outline: none; }
.tip-pop { position: fixed; z-index: 6000; background: #1e1b4b; color: #e0e7ff; border-radius: 10px; padding: 12px 14px; font-size: 12.5px; line-height: 1.6; box-shadow: 0 12px 32px rgba(15,23,42,.35); }
.tip-pop b { display: block; color: #fff; font-size: 13px; margin-bottom: 4px; }
.tip-pop .link-btn { color: #a5b4fc; margin-top: 6px; }
/* ---------- 도움말 */
.help-wrap { display: grid; grid-template-columns: 220px minmax(0,1fr); gap: 16px; align-items: start; }
.help-toc { position: sticky; top: 0; display: flex; flex-direction: column; gap: 2px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; }
.help-toc input { margin-bottom: 8px; }
.help-link { text-align: left; background: none; border: none; padding: 8px 10px; border-radius: 6px; font-size: 13px; font-weight: 600; color: var(--ink-2); cursor: pointer; font-family: inherit; }
.help-link:hover, .help-link.on { background: var(--blue-50); color: var(--navy); }
.help-text { font-size: 13.5px; line-height: 1.85; color: var(--ink-2); }
.help-text ol, .help-text ul { padding-left: 20px; margin: 6px 0; } .help-text li { margin: 3px 0; }
.help-text dt { font-weight: 800; color: var(--ink); margin-top: 10px; } .help-text dd { margin: 2px 0 0 0; }
.help-text code { background: #f1f5f9; padding: 1px 6px; border-radius: 4px; }
/* ---------- 켜기/끄기 스위치 */
.switch { display: inline-flex; align-items: center; gap: 7px; font-weight: 700; font-size: 12.5px; color: var(--ink-2); cursor: pointer; }
.switch input { display: none; }
.switch span:first-of-type { width: 34px; height: 20px; border-radius: 999px; background: #cbd5e1; position: relative; transition: background .15s; flex: 0 0 34px; }
.switch span:first-of-type::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: left .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked + span { background: var(--navy-2); }
.switch input:checked + span::after { left: 16px; }
.undo-btn { border-color: #fcd34d; background: #fffbeb; color: #92400e; }

/* ---------- 모바일 · 태블릿 (갤럭시·폴드·아이폰) */
body { padding-bottom: env(safe-area-inset-bottom); }
.toast { bottom: calc(18px + env(safe-area-inset-bottom)); }
body.modal-open { overflow: hidden; }
@media (max-width: 900px) {
  .help-wrap { grid-template-columns: 1fr; }
  .help-toc { position: static; flex-direction: row; flex-wrap: wrap; }
  .help-toc input { flex: 1 0 100%; }
  .help-link { padding: 6px 10px; background: #f8fafc; }
  .header { height: auto; min-height: 52px; padding: 6px 10px; padding-top: calc(6px + env(safe-area-inset-top)); flex-wrap: wrap; row-gap: 6px; }
  .header-right { flex: 1; justify-content: flex-end; }
  .header .search-box { flex: 1; width: auto; min-width: 0; }
  .sidebar { position: sticky; top: 0; z-index: 20; }
  .nav-btn { padding: 9px 12px; font-size: 13px; }
  .q-actions .btn, .kb-next { min-height: 38px; }
  .kb-next { width: 40px; height: 34px; font-size: 16px; }
  .page-head { align-items: flex-start; }
  .toolbar select, .toolbar input[type="search"] { flex: 1 1 140px; min-width: 0; width: auto !important; }
  .batch-bar { top: 0; }
  .tbl td, .tbl th { padding: 8px 6px; }
}
@media (max-width: 640px) {
  .modal { padding: 0; align-items: stretch; }
  .modal-box, .modal-box.sm, .modal-box.wide { max-width: none; width: 100vw; max-height: 100vh; height: 100%; border-radius: 0; }
  .modal-head { position: sticky; top: 0; background: #fff; z-index: 2; padding-top: calc(14px + env(safe-area-inset-top)); }
  .modal-close { font-size: 30px; padding: 0 6px; }
  .modal-body { padding-bottom: calc(18px + env(safe-area-inset-bottom)); }
  .metrics { gap: 8px; } .metric { padding: 10px 12px; } .metric-value { font-size: 17px; }
  .q-grid { grid-template-columns: 1fr; }
  .cal-cell { min-height: 64px; padding: 4px; } .cal-cell .chip { display: none; } .cal-more { display: none; }
  .cal-d { flex-direction: column; align-items: flex-start; gap: 2px; } .cal-n { margin-left: 0; }
  .cal-head .cal-hd { font-size: 11px; }
  .pager .pg-jump { display: none; }
  .detail .tbl img { width: 44px; height: 32px; }
  .user-btn { padding: 6px 8px; font-size: 12px; }
  .logo { font-size: 15px; } #hPlan { display: none; }
}
@media (max-width: 380px) {  /* 갤럭시 폴드 커버 화면 등 아주 좁은 화면 */
  .content { padding: 10px; }
  .metrics { grid-template-columns: 1fr 1fr; }
  .metric-label { font-size: 11px; } .metric-foot { display: none; }
  .btn { padding: 8px 10px; font-size: 12.5px; }
  .kanban { grid-auto-columns: minmax(200px, 88vw); }
}

/* ---------- 휴대폰: 아래 고정 메뉴(엄지로 누르기 쉬운 하단 탭바) */
@media (max-width: 900px) {
  .sidebar { position: fixed; top: auto; bottom: 0; left: 0; right: 0; z-index: 900; flex-direction: row; gap: 0; padding: 4px 4px calc(4px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); border-bottom: none; background: rgba(255,255,255,.97); backdrop-filter: blur(6px); box-shadow: 0 -2px 10px rgba(15,23,42,.08); overflow-x: auto; scrollbar-width: none; }
  .sidebar::-webkit-scrollbar { display: none; }
  .sidebar .nav-btn { flex: 1 0 64px; flex-direction: column; gap: 2px; padding: 6px 2px; font-size: 10.5px; font-weight: 700; border-radius: 8px; white-space: nowrap; justify-content: center; }
  .sidebar .nav-btn .ic { font-size: 17px; width: auto; }
  .content { padding-bottom: calc(86px + env(safe-area-inset-bottom)); }
  .toast { bottom: calc(80px + env(safe-area-inset-bottom)); left: 12px; right: 12px; max-width: none; }
  #globalBanners .banner { font-size: 12px; padding: 8px 10px; margin-bottom: 8px; }
  .banner.view-as .btn { padding: 5px 8px; }
}
/* ---------- 휴대폰: 견적 상세 품목 표 → 카드형 */
@media (max-width: 640px) {
  .detail > div { min-width: 0; }
  .detail .tbl thead { display: none; }
  .detail .tbl, .detail .tbl tbody { display: block; width: 100%; }
  .detail .tbl tr { display: flex; flex-wrap: wrap; gap: 4px 10px; padding: 10px 2px; border-bottom: 1px solid var(--line); }
  .detail .tbl td { border: none; padding: 0; text-align: left !important; font-size: 12.5px; }
  .detail .tbl td:nth-child(1) { flex: 0 0 56px; }
  .detail .tbl td:nth-child(2) { flex: 1 1 calc(100% - 70px); min-width: 0; }
  .detail .tbl td:nth-child(2) b { font-size: 14px; }
  .detail .tbl td:nth-child(n+3) { flex: 0 0 calc(33% - 8px); }
  .detail .tbl td:nth-child(n+3)::before { display: block; font-size: 10.5px; color: var(--muted); font-weight: 600; }
  .detail .tbl td:nth-child(3)::before { content: "재질"; } .detail .tbl td:nth-child(4)::before { content: "수량"; }
  .detail .tbl td:nth-child(5)::before { content: "개당 시간 h"; } .detail .tbl td:nth-child(6)::before { content: "단가"; }
  .detail .tbl td:nth-child(7)::before { content: "공급가"; } .detail .tbl td:nth-child(8)::before { content: "실제 h"; }
  .detail .tbl td:nth-child(8) input { width: 100% !important; }
  .detail .panel > div[style*="display:flex"] { flex-wrap: wrap; }
  .detail .seg { display: flex; } .detail .seg button { flex: 1; }
}

/* ---------- 메일 · 수금 */
.mail-att { background: var(--bg); border: 1px dashed var(--line-2); border-radius: 8px; padding: 8px 10px; font-size: 12.5px; font-weight: 700; }
.pay-row { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; padding: 5px 0; border-top: 1px dashed var(--line); color: var(--ink-2); }

/* ---- 4.9 거래처 · 엑셀 불러오기 · 엑셀 양식 · 외주 */
.tbl tr.click { cursor: pointer; }
.cl-tbl td:first-child { min-width: 150px; }
.tbl tr.click:hover td { background: #f8fafc; }
.reorder-bar { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; margin-top: 12px; padding: 10px 12px; background: var(--blue-50); border-radius: 8px; font-size: 12.5px; }
.reorder-bar label { display: flex; gap: 6px; align-items: center; }
.imp-file { font-size: 13px; margin-bottom: 10px; }
.imp-map { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0 12px; }
.imp-tbl td.dim { color: var(--faint); }
.imp-tbl th { vertical-align: top; }
.imp-errs { max-height: 200px; overflow: auto; font-size: 12px; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; line-height: 1.7; }
.banner.ok { background: var(--ok-bg); color: var(--ok); }
.tpl-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid #f1f5f9; flex-wrap: wrap; }
.tpl-acts { display: flex; gap: 6px; flex-wrap: wrap; }
.tpl-up { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 12px; padding: 10px; background: var(--bg); border-radius: 8px; }
.tpl-up input:not([type=file]) { max-width: 220px; }
.tm-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 14px; }
.tm-grid { overflow: auto; max-height: 72vh; border: 1px solid var(--line); border-radius: 8px; }
.xl-grid { border-collapse: collapse; font-size: 11.5px; table-layout: auto; }
.xl-grid th { position: sticky; top: 0; background: #f1f5f9; color: var(--muted); font-weight: 700; border: 1px solid #e2e8f0; padding: 2px 4px; z-index: 1; }
.xl-grid th.g-rn { position: sticky; left: 0; z-index: 2; min-width: 30px; }
.xl-grid th.g-corner { z-index: 3; left: 0; }
.xl-grid td { border: 1px solid #e5e7eb; padding: 3px 5px; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; height: 22px; }
.xl-grid td:hover { outline: 2px solid #93c5fd; outline-offset: -2px; }
.xl-grid tr.g-table td { background: #f0f7ff; }
.xl-grid td.g-on { background: #dbeafe; }
.xl-grid td.g-sel { outline: 2px solid var(--navy); outline-offset: -2px; }
.g-chip { display: inline-block; background: var(--navy); color: #fff; border-radius: 4px; padding: 0 5px; font-size: 10.5px; font-weight: 700; }
.g-col { font-size: 10px; color: #fff; background: var(--navy-2); border-radius: 4px; padding: 0 4px; margin-top: 2px; white-space: nowrap; }
.out-row { display: flex; justify-content: space-between; gap: 8px; align-items: center; padding: 7px 0; border-bottom: 1px solid #f1f5f9; font-size: 12.5px; }
.out-items { display: flex; flex-direction: column; gap: 4px; max-height: 160px; overflow: auto; font-size: 12.5px; border: 1px solid var(--line); border-radius: 8px; padding: 8px; }
.out-items label { display: flex; gap: 6px; align-items: center; }
@media (max-width: 900px) {
  .imp-map { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tm-wrap { grid-template-columns: 1fr; }
  .tm-grid { max-height: 50vh; }
  .cl-tbl th:nth-child(2), .cl-tbl td:nth-child(2), .cl-tbl th:nth-child(8), .cl-tbl td:nth-child(8) { display: none; }
}

/* ---- 4.10 현장 · QR · 도장 */
.hist-line { display: flex; gap: 6px; align-items: center; padding: 2px 0; }
.hist-stamp { width: 26px; height: 26px; flex-shrink: 0; }
.scan .scan-part { display: flex; gap: 12px; align-items: center; margin-bottom: 12px; }
.scan .scan-part img { width: 120px; height: 84px; object-fit: contain; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.scan-name { font-size: 17px; font-weight: 800; color: var(--ink); }
.scan-steps { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 12px; }
.scan-steps span { font-size: 11.5px; padding: 4px 9px; border-radius: 999px; background: #f1f5f9; color: var(--muted); font-weight: 700; }
.scan-steps span.done { background: var(--ok-bg); color: var(--ok); }
.scan-steps span.cur { background: var(--navy); color: #fff; }
.scan-now { font-size: 14px; }
.stamp-pick { display: flex; gap: 8px; flex-wrap: wrap; }
.stamp-pick button { border: 2px solid var(--line); background: #fff; border-radius: 10px; padding: 6px; display: flex; flex-direction: column; align-items: center; gap: 2px; cursor: pointer; font-size: 11.5px; width: 92px; }
.stamp-pick button img { width: 64px; height: 64px; object-fit: contain; }
.stamp-pick button.on { border-color: var(--navy); background: var(--blue-50); }
.scan-go { display: block; white-space: normal; word-break: keep-all; text-align: center; padding: 14px; font-size: 16px; line-height: 1.3; }
.scan-go small { display: block; margin-top: 3px; font-size: 12px; font-weight: 600; opacity: .85; }
.scan-done { text-align: center; padding: 28px 18px; }
.scan-done img { width: 150px; height: 150px; animation: stampIn .35s ease-out; }
@keyframes stampIn { from { transform: scale(1.6) rotate(-8deg); opacity: 0; } to { transform: scale(1) rotate(0); opacity: 1; } }
.stamp-list { display: flex; gap: 10px; flex-wrap: wrap; }
.stamp-card { border: 1px solid var(--line); border-radius: 10px; padding: 10px; width: 150px; display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; font-size: 12.5px; }
.stamp-card img { object-fit: contain; max-width: 128px; max-height: 128px; }
.stamp-card.on { border-color: var(--navy); background: var(--blue-50); }
.stamp-card.add { justify-content: center; gap: 6px; border-style: dashed; }
.stamp-edit { display: grid; grid-template-columns: minmax(0, 1fr) 220px; gap: 16px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.stamp-preview { display: flex; flex-direction: column; align-items: center; gap: 8px; background: repeating-conic-gradient(#f8fafc 0 25%, #fff 0 50%) 0 0 / 16px 16px; border: 1px solid var(--line); border-radius: 10px; padding: 12px; min-height: 180px; justify-content: center; }
.stamp-preview img { max-width: 200px; max-height: 200px; object-fit: contain; }
.color-dot { width: 26px; height: 26px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line); cursor: pointer; }
.color-dot.on { box-shadow: 0 0 0 2px var(--navy); }
.stage-checks { display: flex; flex-wrap: wrap; gap: 6px 12px; font-size: 12.5px; }
.stage-checks label { display: flex; gap: 4px; align-items: center; }
.qr-hint { align-self: center; }
@media (max-width: 900px) { .stamp-edit { grid-template-columns: 1fr; } .qr-hint { display: none; } }

/* ---- 4.13 품목별 공정 · 알림함 · 메일 보낼 준비 */
.kb-split { font-size: 11.5px; color: #92400e; background: #fef3c7; border-radius: 6px; padding: 3px 7px; margin: 4px 0 2px; display: inline-block; }
.item-stages .ist-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr) auto; gap: 6px; align-items: center; margin-top: 6px; }
.item-stages .ist-name { font-size: 12.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-stages select { font-size: 12px; padding: 4px 6px; }
.hist-items { display: inline-block; font-size: 11px; background: #eef2ff; color: #3730a3; border-radius: 5px; padding: 0 5px; margin-right: 2px; }
.scan-tog { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 4px 0 10px; font-size: 13px; font-weight: 600; }
.scan-tog input { width: auto; }
.scan-tog .hint { width: 100%; font-weight: 400; }
.scan-other { display: flex; justify-content: space-between; align-items: center; gap: 8px; width: 100%; background: none; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; margin-top: 6px; cursor: pointer; font-size: 13px; text-align: left; color: var(--ink); }
.bell-btn { position: relative; background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.2); color: #fff; padding: 5px 10px; border-radius: 8px; cursor: pointer; font-size: 14px; line-height: 1.2; }
.bell-n { position: absolute; top: -6px; right: -6px; background: #dc2626; color: #fff; border-radius: 999px; font-size: 10.5px; font-weight: 800; min-width: 18px; height: 18px; line-height: 18px; padding: 0 4px; text-align: center; }
.bell-panel { width: 360px; max-width: calc(100vw - 24px); padding: 0; }
.bell-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.bell-list { max-height: 60vh; overflow-y: auto; padding: 4px; }
.menu .bell-item { display: flex; gap: 8px; align-items: flex-start; padding: 8px; border-radius: 8px; }
.bell-item .hint { display: block; margin-top: 2px; }
.bell-item b { font-size: 12.5px; }
.bell-item.new { background: #f0f7ff; }
.bell-item.lv3 b { color: #b91c1c; }
.bell-ic { font-size: 15px; line-height: 1.3; }
.mail-steps { margin: 12px 0; padding-left: 0; list-style: none; }
.mail-steps li { margin-bottom: 10px; }

/* ---- 4.14 휴대폰 알림 */
.menu .bell-push { display: block; width: calc(100% - 8px); margin: 4px; text-align: center; background: #f1f5f9; border-radius: 8px; padding: 9px; font-weight: 700; color: var(--ink); }
.push-state { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font-weight: 700; background: #f8fafc; }
.push-state.on { background: #ecfdf5; border-color: #a7f3d0; color: #065f46; }

/* ---- 4.14 최종 단가 · 최종 공급가 */
.final-price { display: grid; grid-template-columns: auto auto minmax(140px, 200px) minmax(150px, 1fr); gap: 10px; align-items: end; margin: 8px 0 4px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fbfdff; }
.final-price .form-group { margin-bottom: 0; }
.final-price .fp-arrow { color: var(--faint); padding-bottom: 8px; }
.final-price > div:first-child { padding-bottom: 8px; white-space: nowrap; }
.final-price .fp-side { display: flex; flex-direction: column; gap: 3px; align-items: flex-start; padding-bottom: 4px; }
.final-price .fp-side .link-btn, .final-price .fp-side span { white-space: normal; word-break: keep-all; text-align: left; line-height: 1.35; }
@media (max-width: 1400px) and (min-width: 701px) { .final-price { grid-template-columns: auto auto minmax(140px, 1fr); } .final-price .fp-side { grid-column: 1 / -1; flex-direction: row; flex-wrap: wrap; gap: 4px 12px; padding-bottom: 0; } }
@media (max-width: 700px) { .final-price { grid-template-columns: 1fr; } .final-price .fp-arrow { display: none; } }

/* ---- 4.14.1 휴대폰 화면 정리 (갤럭시 S·아이폰 360~430px) */
.asset-empty { width: 120px; height: 64px; flex: 0 0 auto; display: grid; place-items: center; background: var(--bg); border-radius: 6px; color: var(--faint); font-size: 11px; }
.asset-box img { flex: 0 0 auto; }
.asset-info { flex: 1; min-width: 0; }
.asset-actions { display: flex; gap: 6px; margin-top: 6px; align-items: center; flex-wrap: wrap; }
.asset-actions input[type="file"] { flex: 1 1 160px; min-width: 0; max-width: 100%; font-size: 12px; }
.asset-actions .btn { flex: 0 0 auto; }
@media (max-width: 900px) {
  /* 2열일 때 이름 길이가 달라도 입력칸 줄이 맞도록 이름 칸 높이를 두 줄로 맞춤 */
  .grid-2 > .form-group > label:first-child, .grid-3 > .form-group > label:first-child, .grid-4 > .form-group > label:first-child { min-height: 2.7em; display: flex; align-items: flex-end; line-height: 1.35; }
  /* 아이폰: 16px보다 작은 입력칸은 누르면 화면이 확대됨 */
  input:not([type]), input[type="text"], input[type="search"], input[type="password"], input[type="number"], input[type="date"], input[type="email"], input[type="tel"], select, textarea { font-size: 16px; }
  .set-tabs { scrollbar-width: none; }
  .set-tabs::-webkit-scrollbar { display: none; }
}
@media (max-width: 560px) {
  /* 1열에서는 'span 2' 칸이 보이지 않는 둘째 열을 만들어 줄이 어긋남 → 모두 한 칸 */
  .grid-2 > *, .grid-3 > *, .grid-4 > * { grid-column: auto !important; }
  .grid-2 > .form-group > label:first-child, .grid-3 > .form-group > label:first-child, .grid-4 > .form-group > label:first-child { min-height: 0; }
  .asset-box { flex-direction: column; align-items: stretch; }
  .asset-box img, .asset-empty { width: 100%; height: 96px; }
  .asset-actions input[type="file"] { flex: 1 1 0; }
}
.tbl-scroll { overflow-x: auto; max-width: 100%; }

/* 1.0.6 현장 편의: 품목 탭 · 칸반 썸네일 · 큰 글씨 */
.unit-tog { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.unit-tog button { border: 0; background: #fff; padding: 7px 12px; font-size: 13px; cursor: pointer; color: var(--ink); }
.unit-tog button.on { background: var(--navy); color: #fff; font-weight: 700; }
.kb-thumb { display: block; width: 100%; height: 64px; object-fit: contain; background: #f8fafc; border: 1px solid var(--line); border-radius: 6px; margin: 6px 0 4px; }
.kb-more { display: inline-block; font-size: 12px; font-weight: 700; color: #1d4ed8; background: #eff6ff; border-radius: 999px; padding: 1px 8px; margin-left: 2px; white-space: nowrap; }
.kb-pos { display: inline-block; font-size: 11.5px; font-weight: 800; color: #1d4ed8; background: #eff6ff; border-radius: 999px; padding: 0 7px; margin-left: 4px; }
.toast-act { margin-left: 10px; background: #fff; color: #0f172a; border: 0; border-radius: 6px; padding: 4px 10px; font-weight: 700; cursor: pointer; }
.scan-items-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 6px; font-size: 15px; }
.scan-items { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 10px; margin-bottom: 10px; scroll-snap-type: x mandatory; }
.scan-it { flex: 0 0 136px; scroll-snap-align: start; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 8px; border: 2px solid var(--line); border-radius: 10px; background: #fff; cursor: pointer; text-align: left; color: var(--ink); font: inherit; }
.scan-it img, .scan-noimg { width: 100%; height: 76px; object-fit: contain; border-radius: 6px; background: #f8fafc; border: 1px solid var(--line); }
.scan-noimg { display: flex; align-items: center; justify-content: center; font-size: 12px; color: var(--muted); }
.scan-it-name { font-weight: 800; font-size: 14px; line-height: 1.3; word-break: break-all; }
.scan-it-sub { font-size: 13px; color: var(--muted); }
.scan-it.on { border-color: var(--blue); background: #eff6ff; box-shadow: 0 0 0 3px rgba(37,99,235,.18); }
.scan .scan-part img { width: 150px; height: 106px; }
.scan-name { font-size: 20px; line-height: 1.3; }
.scan-pos { display: inline-block; font-size: 13px; font-weight: 800; color: #fff; background: var(--blue); border-radius: 999px; padding: 1px 9px; vertical-align: middle; }
.scan-meta { font-size: 14px; color: var(--muted); margin-top: 2px; }
.scan-steps span { font-size: 13px; padding: 5px 10px; }
.scan-now { font-size: 17px; margin: 2px 0 10px; }
.scan-with { border: 1px solid #fde68a; background: #fffbeb; border-radius: 10px; padding: 10px 12px; margin-bottom: 10px; }
.scan-with-t { font-weight: 700; font-size: 14px; margin-bottom: 4px; }
.scan-with-it { display: flex; align-items: center; gap: 10px; padding: 8px 2px; font-size: 15px; cursor: pointer; }
.scan-with-it input { width: 22px; height: 22px; flex-shrink: 0; }
.scan-with-it img { width: 52px; height: 36px; object-fit: contain; border: 1px solid var(--line); border-radius: 4px; background: #fff; }
.scan-go { padding: 16px; font-size: 18px; }
.scan-more { margin: 10px 0 14px; font-size: 14px; }
.scan-more summary { cursor: pointer; padding: 10px 0; color: var(--muted); font-weight: 600; }
.field-ui .kb-name { font-size: 16px; }
.field-ui .kb-sub, .field-ui .kb-dw, .field-ui .kb-foot .hint { font-size: 14px; }
.field-ui .kb-thumb { height: 86px; }
.field-ui .kb-card { padding: 10px 12px; }
.field-ui .dd { font-size: 13px; }

/* 1.0.7 휴대폰 공정 목록 · 납기 목록 */
.ml-top { display: flex; gap: 8px; margin-bottom: 8px; }
.ml-top input { flex: 1; font-size: 16px; padding: 11px 12px; }
.ml-filt { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 8px; padding: 10px; background: #f8fafc; border: 1px solid var(--line); border-radius: 10px; }
.ml-filt select { flex: 1 1 140px; }
.ml-chips { display: flex; gap: 6px; overflow-x: auto; padding: 2px 0 10px; position: sticky; top: 0; background: var(--bg, #f8fafc); z-index: 5; }
.ml-chip { flex: 0 0 auto; border: 1px solid var(--line); background: #fff; color: var(--ink); border-radius: 999px; padding: 9px 14px; font-size: 15px; font-weight: 600; cursor: pointer; }
.ml-chip b { margin-left: 2px; color: var(--blue); }
.ml-chip.on { background: var(--navy); border-color: var(--navy); color: #fff; }
.ml-chip.on b { color: #fff; }
.ml-list { display: flex; flex-direction: column; gap: 8px; }
.ml-card { display: grid; grid-template-columns: 96px minmax(0,1fr); gap: 12px; align-items: center; width: 100%; text-align: left; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 10px; cursor: pointer; color: var(--ink); font: inherit; box-shadow: 0 1px 2px rgba(15,23,42,.05); }
.ml-card:active { background: #eff6ff; }
.ml-card.tent { border-style: dashed; }
.ml-thumb { display: flex; align-items: center; justify-content: center; width: 96px; height: 72px; border: 1px solid var(--line); border-radius: 8px; background: #f8fafc; font-size: 12px; color: var(--muted); overflow: hidden; }
.ml-thumb img { width: 100%; height: 100%; object-fit: contain; }
.ml-body { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.ml-name { font-size: 17px; font-weight: 800; line-height: 1.3; word-break: break-all; }
.ml-sub { font-size: 14px; color: var(--muted); }
.ml-tags { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 13px; }
.ml-empty { padding: 28px 12px; text-align: center; color: var(--muted); font-size: 15px; background: #fff; border: 1px dashed var(--line); border-radius: 12px; }
.ml-foot { text-align: center; margin: 14px 0 4px; }
.sl-group { margin-bottom: 16px; }
.sl-head { font-size: 16px; font-weight: 800; margin: 4px 2px 8px; color: var(--ink); }
.sl-head b { color: var(--blue); margin-left: 2px; }
.sl-head.err { color: var(--err); } .sl-head.err b { color: var(--err); }
.sl-head.warn { color: #b45309; } .sl-head.warn b { color: #b45309; }
.ds-quick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.ds-quick .btn { padding: 10px 0; font-size: 15px; }
.as-result { background: #f8fafc; border: 1px solid var(--line); border-radius: 10px; padding: 12px; font-size: 15px; }
.hms { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.hms label { display: flex; align-items: center; gap: 4px; margin: 0; font-weight: 600; color: var(--ink); }
.hms input { width: 64px; text-align: right; font-size: 16px; }
.hms span { font-size: 14px; }
/* 1.0.9 사무실 화면 정리 */
button.kb-more { border: 0; cursor: pointer; font: inherit; font-size: 12px; font-weight: 700; color: #1d4ed8; background: #eff6ff; border-radius: 999px; padding: 1px 8px; }
button.kb-more:hover { background: #dbeafe; }
@media (min-width: 901px) {
  .kanban { display: flex; }
  .kanban > .kb-col { flex: 1 1 0; min-width: 155px; }
  .kanban > .kb-ship { flex: 0 0 104px; min-width: 104px; }
  .kb-ship .kb-drop { font-size: 12px; padding: 18px 6px; }
}
@media (max-width: 900px) { .page-sub { font-size: 12.5px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; } }

/* ===== 도면 보기 (DWG·DXF) — 캔버스 + 치수 측정 */
.viewer-body.cad { display: block; overflow: hidden; position: relative; background: #fff; }
.cad-wrap { position: absolute; inset: 0; touch-action: none; user-select: none; -webkit-user-select: none; }
.cad-canvas, .cad-over { position: absolute; inset: 0; display: block; }
.cad-over { cursor: grab; }
.cad-over:active { cursor: grabbing; }
.cad-wrap[data-tool="dist"] .cad-over, .cad-wrap[data-tool="dia"] .cad-over, .cad-wrap[data-tool="ang"] .cad-over { cursor: crosshair; }
.cad-hud { position: absolute; left: 10px; bottom: 8px; font: 12px/1.4 ui-monospace, Consolas, monospace; color: #475569; background: rgba(255,255,255,.85); padding: 2px 8px; border-radius: 6px; pointer-events: none; }
.cad-result { position: absolute; left: 50%; top: 10px; transform: translateX(-50%); background: #fff; border: 2px solid #e11d48; color: #9f1239; border-radius: 10px; padding: 8px 14px; font-size: 15px; box-shadow: 0 4px 16px rgba(0,0,0,.15); max-width: calc(100% - 20px); text-align: center; pointer-events: none; }
.cad-result .hint { color: #64748b; font-size: 13px; }
.cad-result .cad-r-miss { color: #b45309; font-size: 13px; }
.cad-layers { position: absolute; right: 10px; top: 10px; z-index: 5; background: #fff; border: 1px solid var(--line-2); border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.18); padding: 10px 12px; max-height: calc(100% - 20px); overflow: auto; min-width: 200px; font-size: 13px; }
.cad-layers-h { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.cad-layers label { display: flex; align-items: center; gap: 8px; padding: 3px 0; cursor: pointer; white-space: nowrap; }
.cad-layers input { width: auto; }
.cad-layers i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; border: 1px solid rgba(0,0,0,.15); }
.cad-note { background: #f1f5f9; color: #475569; font-size: 12px; padding: 5px 14px; border-bottom: 1px solid var(--line); }
@media (max-width: 900px) {
  .cad-tools button { padding: 9px 10px; font-size: 13px; }
  .cad-result { font-size: 14px; top: 6px; }
}
.cad-snap.on { background: #dcfce7; border-color: #86efac; color: #166534; }
@media (max-width: 600px) {
  .modal-box.viewer .viewer-tools { gap: 4px; }
  .modal-box.viewer .viewer-tools .btn, .modal-box.viewer .cad-tools button { padding: 6px 8px; font-size: 12px; }
  .cad-note { font-size: 11px; padding: 3px 10px; }
}
.cad-layers-opt { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 6px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); margin: 4px 0; }
.cad-layers-opt label { display: flex; gap: 6px; align-items: center; font-weight: 600; }
.cad-ly { display: flex; align-items: center; gap: 8px; padding: 3px 0; white-space: nowrap; }
.cad-ly input[type="checkbox"] { width: auto; }
.cad-ly input[type="color"] { width: 28px; height: 22px; padding: 0; border: 1px solid var(--line-2); border-radius: 4px; background: none; cursor: pointer; }
.cad-ly-n.chg { font-weight: 700; }
.cad-ly-n.chg::after { content: " (색 변경)"; color: var(--muted, #64748b); font-weight: 400; font-size: 11px; }
.cad-mono.on { background: #111827; color: #fff; border-color: #111827; }

/* ===== 관련 자료 (첨부) */
.att-grid { display: grid; grid-template-columns: 1fr; gap: 8px; }
.att-card { display: flex; gap: 10px; align-items: center; border: 1px solid var(--line); border-radius: 10px; padding: 8px; background: #fff; }
.att-thumb { width: 72px; height: 54px; flex: 0 0 72px; border: 1px solid var(--line); border-radius: 6px; background: #f8fafc; display: flex; align-items: center; justify-content: center; overflow: hidden; padding: 0; cursor: zoom-in; }
.att-thumb:disabled { cursor: default; }
.att-thumb img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.att-ic { color: #fff; font: 700 12px/1 system-ui, sans-serif; padding: 6px 7px; border-radius: 5px; letter-spacing: .3px; }
.att-meta { min-width: 0; flex: 1; }
.att-name { font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin: 3px 0 1px; }
.att-act { font-size: 12px; margin-top: 2px; }
.link-btn.danger { color: #b91c1c; }
.att-up { display: flex; gap: 6px; margin-top: 10px; align-items: stretch; }
.att-up select { width: auto; flex: 0 0 auto; font-size: 13px; }
.att-drop { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; border: 2px dashed var(--line-2); border-radius: 10px; padding: 10px; cursor: pointer; text-align: center; color: var(--ink-2); background: #f8fafc; }
.att-drop b { font-size: 13px; }
.att-drop span { font-size: 11px; color: #64748b; }
.att-drop.over, .att-drop:hover { border-color: var(--navy-2); background: #eff6ff; }
.att-drop.busy { opacity: .7; pointer-events: none; }

/* ===== 되돌릴 수 없는 삭제 — 확인 문구 입력 */
.tc-overlay { position: fixed; inset: 0; z-index: 10000; background: rgba(15,23,42,.55); display: flex; align-items: center; justify-content: center; padding: 16px; }
.tc-box { background: #fff; border-radius: 14px; width: min(460px, 100%); padding: 20px; box-shadow: 0 20px 60px rgba(0,0,0,.35); border-top: 5px solid #dc2626; }
.tc-title { font-size: 17px; font-weight: 800; color: #991b1b; margin-bottom: 10px; }
.tc-body { font-size: 14px; line-height: 1.6; }
.tc-list { margin: 8px 0; padding-left: 18px; font-size: 13px; max-height: 160px; overflow: auto; }
.tc-alert { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; border-radius: 8px; padding: 8px 10px; font-size: 13px; margin-bottom: 8px; }
.tc-warn { margin: 12px 0 8px; font-size: 13px; color: #334155; }
.tc-word { background: #fee2e2; color: #991b1b; padding: 1px 6px; border-radius: 4px; }
.tc-input { width: 100%; font-size: 16px; padding: 10px 12px; border: 2px solid #fca5a5; border-radius: 8px; }
.tc-input:focus { outline: none; border-color: #dc2626; }
.tc-btns { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
.tc-btns .btn-danger:disabled { opacity: .4; }
.tc-btns .btn-danger:not(:disabled) { background: #dc2626; color: #fff; border-color: #dc2626; }
.trash-bar { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.trash-bar label { display: flex; align-items: center; gap: 6px; font-weight: 600; }
.trash-bar input { width: auto; }

/* ===== 다품일도 · 도면 좌표 */
.sheet-banner { margin-top: 8px; border: 1px solid #bfdbfe; background: #eff6ff; border-radius: 10px; padding: 8px 10px; display: flex; flex-direction: column; gap: 4px; }
.sheet-banner .hint { font-size: 12px; }
.sheet-banner .btn { align-self: flex-start; }
.vec-btn { border-color: #86efac; color: #166534; background: #f0fdf4; }
.vec-btn small { font-weight: 500; opacity: .8; }
.cad-sheet { width: auto; max-width: 220px; font-size: 12px; padding: 5px 8px; }

/* ===== 보안: 2단계 인증 · 권한 */
.tf-steps { padding-left: 18px; font-size: 13px; line-height: 1.7; margin: 0 0 10px; }
.tf-qr { text-align: center; margin: 8px 0 12px; }
.tf-qr img { width: 180px; height: 180px; image-rendering: pixelated; border: 1px solid var(--line); border-radius: 8px; padding: 6px; background: #fff; }
.tf-qr code, .tf-codes code { font-family: ui-monospace, Consolas, monospace; background: #f1f5f9; padding: 2px 6px; border-radius: 4px; word-break: break-all; }
.tf-codes { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.tf-codes code { text-align: center; padding: 6px; font-size: 14px; }
.perm-row { display: flex; gap: 12px; margin-top: 4px; font-size: 12px; color: #475569; flex-wrap: wrap; }
.perm-row label { display: flex; gap: 4px; align-items: center; font-weight: 500; }
.perm-row input, .sec-row input { width: auto; }
.sec-row { display: flex; gap: 8px; align-items: flex-start; margin-top: 8px; font-size: 13px; }

/* 계산 근거 표: 품목 칸이 좁으면(창이 작거나 옆 패널이 열려 있을 때) 설명을 아래 줄로 — 글자가 세로로 찌그러지지 않게 */
.ai-box { container-type: inline-size; }
.ai-box .bk td.det { word-break: keep-all; overflow-wrap: anywhere; }
.ai-box .bk td.lab { white-space: nowrap; }
@container (max-width: 460px) {
  .ai-box .bk tr { display: grid; grid-template-columns: 1fr auto; column-gap: 8px; padding: 4px 0; border-bottom: 1px solid #e2e8f0; }
  .ai-box .bk td { border: 0; padding: 1px 0; }
  .ai-box .bk td.det { grid-column: 1 / -1; grid-row: 2; font-size: 12px; color: #64748b; }
}

/* 새 버전 안내 */
.ver-bar{position:fixed;left:50%;bottom:18px;transform:translateX(-50%);z-index:9000;display:flex;align-items:center;gap:10px;max-width:calc(100% - 32px);padding:10px 12px 10px 16px;background:#1e293b;color:#fff;border-radius:10px;box-shadow:0 8px 24px rgba(0,0,0,.25);font-size:14px;}
.ver-bar .ver-x{background:none;border:0;color:#cbd5e1;font-size:20px;cursor:pointer;line-height:1;}
@media (max-width:600px){.ver-bar{flex-wrap:wrap;}}

/* ---------- BOM 관리 (1.2.0) */
.bom-drop { min-height: 120px; }
.bom-title { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.bom-title input { font-size: 18px; font-weight: 800; border-color: transparent; padding: 4px 8px; max-width: 520px; }
.bom-title input:hover, .bom-title input:focus { border-color: var(--line-2); }
.bom-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.bom-head .form-group { margin-bottom: 8px; }
.bom-files { display: flex; flex-direction: column; gap: 2px; padding-top: 4px; max-height: 64px; overflow: auto; }
.bom-files .link-btn { text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.bom-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.bom-chips span { background: var(--bg); border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; font-size: 12px; color: var(--ink-2); }
.bom-chips b { color: var(--ink); }
.bom-chips .bk-flag { background: var(--warn-bg); border-color: #fcd34d; color: var(--warn); }
.seg button.on { background: var(--blue-50); color: var(--navy); }
.bom-sel { top: -22px; }
.bom-scroll { border: 1px solid var(--line); border-radius: var(--radius); background: #fff; max-height: calc(100vh - 230px); overflow: auto; }
.bom-tbl { font-size: 12px; }
.bom-tbl thead th { position: sticky; top: 0; z-index: 2; }
.bom-tbl td { padding: 3px 4px; border-bottom: 1px solid #eef2f7; white-space: nowrap; }
.bom-tbl th { padding: 7px 6px; }
.bom-tbl td.ck, .bom-tbl th.ck { width: 46px; text-align: left; }
.bom-tbl td.ck input { width: auto; vertical-align: middle; }
.bom-tbl .bm-grip { cursor: grab; color: var(--faint); font-size: 11px; letter-spacing: -2px; padding: 0 4px 0 0; user-select: none; }
.bom-tbl .bm-num { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 11.5px; }
.bom-tbl td.nm { min-width: 240px; white-space: normal; }
.bm-nm { display: flex; align-items: center; gap: 2px; }
.bm-tog { border: none; background: none; cursor: pointer; width: 18px; color: var(--ink-2); font-size: 11px; padding: 0; flex: none; }
.bm-tog-sp { display: inline-block; width: 18px; flex: none; }
.bom-tbl input.bm-in, .bom-tbl select.bm-in { padding: 4px 6px; font-size: 12px; border-color: transparent; background: transparent; border-radius: 4px; }
.bom-tbl input.bm-in:hover, .bom-tbl select.bm-in:hover { border-color: var(--line-2); background: #fff; }
.bom-tbl input.bm-in:focus { border-color: #3b82f6; background: #fff; }
.bom-tbl td.nm input.bm-in { flex: 1; min-width: 120px; }
.bom-tbl tr.has-kids td { background: #f8fafc; }
.bom-tbl tr.has-kids.lv1 td { background: var(--blue-100); }
.bom-tbl tr.has-kids.lv2 td { background: var(--blue-50); }
.bom-tbl tr.has-kids td.nm input { font-weight: 800; }
.bom-tbl tr.sel td { background: #fff7d6 !important; }
.bom-tbl .bm-total { font-weight: 700; font-variant-numeric: tabular-nums; }
.bm-kind { min-width: 74px; font-weight: 700; }
.bm-kind.k-구매품 { color: #9a3412; }
.bm-kind.k-외주 { color: #6b21a8; }
.bm-kind.k-조립품 { color: var(--navy); }
.bm-flags { display: flex; flex-wrap: wrap; gap: 3px; margin: 1px 0 2px; }
.bm-flag { background: var(--warn-bg); color: var(--warn); border-radius: 4px; font-size: 10.5px; padding: 1px 5px; font-weight: 700; max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
.bom-tbl tr.dragging { opacity: .45; }
.bom-tbl tr.drop-before td { box-shadow: inset 0 2px 0 var(--blue); }
.bom-tbl tr.drop-after td { box-shadow: inset 0 -2px 0 var(--blue); }
.bom-tbl tr.drop-into td { background: var(--blue-100) !important; box-shadow: inset 0 0 0 1px var(--blue); }
.bom-file-row { display: flex; gap: 10px; align-items: center; justify-content: space-between; padding: 5px 0; border-bottom: 1px solid var(--line); font-size: 12.5px; }
.bom-file-row span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 900px) {
  .bom-head .grid-4 { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .bom-scroll { max-height: none; }
}
@media (max-width: 560px) {
  .bom-head .grid-4 { grid-template-columns: minmax(0,1fr); }
  .bom-actions .btn { flex: 1 1 auto; }
  #view-bom .page-head > div:first-child { flex: 1 1 100% !important; }
  .bom-actions { width: 100%; }
  .bom-title input { font-size: 16px; }
}

/* ---------- NC 보관함 (1.3.0) */
.modal-box.wide-nc { max-width: 1100px; }
.nc-tbl td { vertical-align: middle; }
.nc-cards { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 10px; margin-bottom: 12px; }
.nc-cards > div { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: var(--bg); display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.nc-cards span { font-size: 11.5px; color: var(--muted); font-weight: 700; }
.nc-cards b { font-size: 19px; color: var(--ink); font-variant-numeric: tabular-nums; }
.nc-cards small { font-size: 11px; color: var(--muted); line-height: 1.4; }
.nc-cards > div.ok { background: var(--ok-bg); border-color: #86efac; }
.nc-cards > div.ok b { color: var(--ok); }
.nc-cards > div.bad { background: var(--err-bg); border-color: #fca5a5; }
.nc-cards > div.bad b { color: var(--err); }
.nc-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.seg button.on { background: var(--blue-50); color: var(--navy); }
.nc-ops td { padding: 6px 8px; font-variant-numeric: tabular-nums; }
.nc-ops tr.nc-sum td { background: var(--bg); border-top: 1px solid var(--line); }
.nc-ops tr.nc-same td { color: var(--muted); }
.nc-bar { height: 4px; background: #eef2f7; border-radius: 2px; margin-top: 3px; min-width: 70px; }
.nc-bar i { display: block; height: 100%; border-radius: 2px; }
.nc-up { color: var(--err); font-weight: 700; }
.nc-down { color: var(--ok); font-weight: 700; }
.nc-groups { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.nc-groups span { background: var(--bg); border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; font-size: 12px; }
.nc-canvas { width: 100%; height: 440px; border: 1px solid var(--line); border-radius: 10px; background: #fff; touch-action: none; cursor: grab; }
.nc-trash { margin-top: 14px; }
.nc-trash summary { cursor: pointer; font-weight: 700; font-size: 12.5px; color: var(--ink-2); }
.nc-measure-in { display: flex; gap: 12px; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; }
.nc-measure-in input { width: 80px; }
.nc-mach input, .nc-mach select { padding: 5px 6px; font-size: 12.5px; }
.nc-mach td { padding: 4px; }
.sw-now { display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; padding: 6px 0 10px; }
.sw-now b { font-size: 16px; }
.sw-clock { font-size: 40px; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--navy); letter-spacing: -1px; }
.sw-go { padding: 18px 14px; font-size: 17px; flex-direction: column; gap: 2px; }
.sw-go small { font-weight: 600; opacity: .85; font-size: 12px; }
.sw-list { margin-top: 12px; border-top: 1px solid var(--line); }
.sw-list > div { display: grid; grid-template-columns: 1fr auto 80px; gap: 8px; padding: 6px 2px; border-bottom: 1px solid #f1f5f9; font-size: 12.5px; align-items: center; }
.sw-list > div b { text-align: right; font-variant-numeric: tabular-nums; }
.sw-list > div.cur { background: #fff7d6; }
.sw-list > div.done { color: var(--muted); }
.nc-scan { box-shadow: none; padding: 12px 14px; }
.nc-scan-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 7px 0; border-top: 1px solid #f1f5f9; flex-wrap: wrap; }
.nc-scan-row:first-of-type { border-top: none; }
.nc-scan-btns { display: flex; gap: 6px; align-items: center; }
@media (max-width: 900px) { .nc-cards { grid-template-columns: repeat(2, minmax(0,1fr)); } .nc-canvas { height: 320px; } }
