:root {
  --bg: #f4f6f9;
  --panel: #ffffff;
  --line: #dde2ea;
  --line-strong: #c5ccd8;
  --text: #1f2633;
  --muted: #6b7484;
  --primary: #1f5fbf;
  --primary-dark: #174a96;
  --primary-soft: #e8f0fc;
  --ok: #1d8a52;
  --ok-soft: #e5f5ec;
  --warn: #b86e00;
  --warn-soft: #fff4e0;
  --bad: #c62f2f;
  --bad-soft: #fdeaea;
  --side: #1b2433;
  --side-text: #c7cfdc;
  --radius: 6px;
  --font: "Malgun Gothic", "맑은 고딕", "Apple SD Gothic Neo", "Noto Sans KR", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--font); font-size: 13px; color: var(--text); background: var(--bg); }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font-family: inherit; font-size: 13px; }

/* ───── 레이아웃 ───── */
#app { display: flex; height: 100vh; }
#side { width: 208px; flex: none; background: var(--side); color: var(--side-text); display: flex; flex-direction: column; overflow-y: auto; }
#side .brand { padding: 16px 16px 12px; font-size: 15px; font-weight: 700; color: #fff; border-bottom: 1px solid #2c3850; }
#side .brand small { display: block; font-size: 11px; font-weight: 400; color: #8f9bb0; margin-top: 3px; }
#side nav { padding: 6px 0 20px; flex: 1; }
#side .group { padding: 12px 16px 4px; font-size: 11px; color: #7f8ba1; letter-spacing: .5px; }
#side a.item { display: block; padding: 6px 16px 6px 22px; color: var(--side-text); text-decoration: none; border-left: 3px solid transparent; }
#side a.item:hover { background: #243048; color: #fff; }
#side a.item.active { background: #26385a; color: #fff; border-left-color: #5b9bff; font-weight: 600; }
#side .me { padding: 10px 16px; border-top: 1px solid #2c3850; font-size: 12px; }
#side .me button { margin-top: 6px; }
#main { flex: 1; overflow: auto; display: flex; flex-direction: column; min-width: 0; }
#page { padding: 18px 22px 40px; max-width: 1700px; width: 100%; }
.page-head { display: flex; align-items: flex-end; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.page-head h1 { font-size: 19px; margin: 0; }
.page-head .sub { color: var(--muted); font-size: 12px; }
.page-head .spacer { flex: 1; }

/* ───── 공통 요소 ───── */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 14px; }
.panel h2 { font-size: 14px; margin: 0 0 10px; display: flex; align-items: center; gap: 8px; }
.panel h2 .muted { font-weight: 400; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.grow { flex: 1; }
.grid { display: grid; gap: 12px; }
.grid.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.c4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1100px) { .grid.c3, .grid.c4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.btn { display: inline-flex; align-items: center; gap: 5px; height: 30px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: var(--radius);
  background: #fff; color: var(--text); cursor: pointer; white-space: nowrap; }
.btn:hover { background: #f1f4f8; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-dark); }
.btn.danger { color: var(--bad); border-color: #e7b4b4; }
.btn.danger:hover { background: var(--bad-soft); }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.sm { height: 24px; padding: 0 8px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.link { border: 0; background: none; color: var(--primary); padding: 0 4px; height: auto; }

input[type=text], input[type=number], input[type=date], input[type=month], input[type=password], input[type=search], input:not([type]), select, textarea {
  height: 30px; padding: 0 8px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: #fff; color: var(--text); min-width: 0; }
textarea { height: auto; padding: 6px 8px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid #9cc1f5; outline-offset: -1px; border-color: var(--primary); }
input.num { text-align: right; }
label.chk { display: inline-flex; align-items: center; gap: 5px; cursor: pointer; }

.form { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px 14px; }
.form .f { display: flex; flex-direction: column; gap: 4px; }
.form .f > span { font-size: 12px; color: var(--muted); }
.form .f.wide { grid-column: 1 / -1; }
.form .f input, .form .f select, .form .f textarea { width: 100%; }

.badge { display: inline-block; padding: 1px 7px; border-radius: 10px; font-size: 11px; background: #eef1f5; color: #4a5263; white-space: nowrap; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.info { background: var(--primary-soft); color: var(--primary); }
.neg { color: var(--bad); font-weight: 600; }
.pos { color: var(--ok); }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; margin-bottom: 14px; }
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; cursor: default; }
.card.link { cursor: pointer; }
.card.link:hover { border-color: var(--primary); }
.card .k { font-size: 12px; color: var(--muted); }
.card .v { font-size: 20px; font-weight: 700; margin-top: 4px; }
.card.warn .v { color: var(--warn); }
.card.bad .v { color: var(--bad); }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 12px; flex-wrap: wrap; }
.tabs button { border: 0; background: none; padding: 8px 14px; cursor: pointer; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }

/* ───── 표 ───── */
.tbl-wrap { overflow: auto; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; max-height: calc(100vh - 230px); }
.tbl-wrap.auto { max-height: none; }
table.tbl { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 12.5px; }
table.tbl th { position: sticky; top: 0; z-index: 1; background: #f0f3f7; color: #3d4554; font-weight: 600; text-align: left; padding: 7px 8px;
  border-bottom: 1px solid var(--line-strong); white-space: nowrap; user-select: none; }
table.tbl th.sortable { cursor: pointer; }
table.tbl th.sortable:hover { background: #e5eaf1; }
table.tbl th .arrow { color: var(--primary); margin-left: 3px; }
table.tbl td { padding: 5px 8px; border-bottom: 1px solid #edf0f4; vertical-align: middle; }
table.tbl tbody tr:hover td { background: #f6f9fe; }
table.tbl tr.clickable { cursor: pointer; }
table.tbl tr.selected td { background: var(--primary-soft) !important; }
table.tbl td.r, table.tbl th.r { text-align: right; }
table.tbl td.c, table.tbl th.c { text-align: center; }
table.tbl td.nowrap { white-space: nowrap; }
table.tbl tfoot td { position: sticky; bottom: 0; background: #f7f9fb; font-weight: 600; border-top: 1px solid var(--line-strong); }
table.tbl input { height: 26px; }
table.tbl tr.muted-row td { color: #9aa3b2; }
table.tbl tr.warn-row td { background: #fffaf0; }
table.tbl tr.bad-row td { background: #fff5f5; }
.tbl-empty { padding: 30px; text-align: center; color: var(--muted); }
.tbl-info { display: flex; justify-content: space-between; align-items: center; padding: 6px 2px; color: var(--muted); font-size: 12px; }

/* ───── 모달·알림 ───── */
.modal-back { position: fixed; inset: 0; background: rgba(20, 28, 40, .42); display: flex; align-items: flex-start; justify-content: center; z-index: 50; padding: 40px 16px; overflow: auto; }
.modal { background: #fff; border-radius: 8px; width: 720px; max-width: 100%; box-shadow: 0 10px 40px rgba(0,0,0,.25); display: flex; flex-direction: column; max-height: calc(100vh - 80px); }
.modal.wide { width: 1100px; }
.modal.xwide { width: 1400px; }
.modal.narrow { width: 440px; }
.modal-head { padding: 14px 18px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }
.modal-head h3 { margin: 0; font-size: 15px; flex: 1; }
.modal-head .x { border: 0; background: none; font-size: 20px; cursor: pointer; color: var(--muted); }
.modal-body { padding: 16px 18px; overflow: auto; }
.modal-foot { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; }
#toasts { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 100; }
.toast { background: #263246; color: #fff; padding: 10px 14px; border-radius: 6px; max-width: 460px; box-shadow: 0 4px 16px rgba(0,0,0,.25); white-space: pre-wrap; }
.toast.ok { background: #1d7a4b; }
.toast.bad { background: #b42c2c; }
.toast.warn { background: #9a5d00; }

/* 자동완성 */
.ac { position: relative; }
.ac-list { position: absolute; top: 100%; left: 0; z-index: 60; background: #fff; border: 1px solid var(--line-strong); border-radius: 6px; box-shadow: 0 6px 20px rgba(0,0,0,.15);
  min-width: 420px; max-height: 320px; overflow: auto; }
.ac-list div { padding: 6px 10px; cursor: pointer; border-bottom: 1px solid #f0f2f5; }
.ac-list div:hover, .ac-list div.on { background: var(--primary-soft); }
.ac-list b { margin-right: 6px; }

/* 로그인 */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(160deg, #1b2433, #2b3d5c); }
.login-box { background: #fff; border-radius: 10px; padding: 30px 32px; width: 360px; box-shadow: 0 20px 60px rgba(0,0,0,.35); }
.login-box h1 { font-size: 20px; margin: 0 0 6px; }
.login-box p { margin: 0 0 18px; color: var(--muted); font-size: 12px; }
.login-box .f { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.login-box input { height: 36px; }
.login-box .btn { width: 100%; justify-content: center; height: 38px; }

.note { background: #f7f9fc; border: 1px solid var(--line); border-left: 3px solid var(--primary); padding: 8px 12px; border-radius: 4px; color: #4a5263; font-size: 12px; margin-bottom: 12px; }
.note.warn { border-left-color: var(--warn); background: #fffaf2; }
.note.bad { border-left-color: var(--bad); background: #fff7f7; }
.kv { display: grid; grid-template-columns: 110px 1fr; gap: 5px 10px; font-size: 12.5px; }
.kv > div:nth-child(odd) { color: var(--muted); }
.chart-box { position: relative; height: 260px; }
.loading { padding: 30px; text-align: center; color: var(--muted); }
hr.sep { border: 0; border-top: 1px solid var(--line); margin: 14px 0; }

/* SCM 수집 상태 카드 */
.scm-card { border: 1px solid var(--line, #dde3ea); border-left: 5px solid #9aa5b1; border-radius: 8px; padding: 10px 12px; margin-bottom: 8px; background: #fff; }
.scm-card.ok { border-left-color: #1d7a4b; } .scm-card.bad { border-left-color: #b42c2c; background: #fff7f7; }
.scm-card.info { border-left-color: #1f5fbf; } .scm-card.warn { border-left-color: #c88a00; background: #fffbf0; }
.scm-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.scm-head .dot { width: 10px; height: 10px; border-radius: 50%; background: #9aa5b1; }
.scm-card.ok .dot { background: #1d7a4b; } .scm-card.bad .dot { background: #b42c2c; } .scm-card.info .dot { background: #1f5fbf; } .scm-card.warn .dot { background: #c88a00; }
.scm-head .state { font-weight: 700; margin-left: auto; }
.scm-card.ok .state { color: #1d7a4b; } .scm-card.bad .state { color: #b42c2c; } .scm-card.warn .state { color: #9a5d00; } .scm-card.info .state { color: #1f5fbf; }
.scm-msg { margin: 6px 0 2px; font-size: 13px; color: #8a1f1f; }
.scm-card.warn .scm-msg { color: #7a4a00; }
.scm-items { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-top: 6px; font-size: 13px; }

/* 예전 프로그램식 큰 메뉴 + 화면 위 탭 */
#side a.menu { display: block; padding: 9px 14px 9px 16px; color: var(--side-text); text-decoration: none; border-left: 4px solid transparent; }
#side a.menu b { display: block; font-size: 14px; font-weight: 600; color: #e8edf5; }
#side a.menu small { display: block; font-size: 11px; color: #8f9bb0; margin-top: 2px; line-height: 1.35; }
#side a.menu:hover { background: #243048; }
#side a.menu.active { background: #26385a; border-left-color: #5b9bff; }
#side a.menu.active b { color: #fff; } #side a.menu.active small { color: #c2d3f0; }
#subtabs .subtabs { display: flex; align-items: stretch; gap: 2px; padding: 0 20px; background: #fff; border-bottom: 1px solid var(--line, #dde3ea); position: sticky; top: 0; z-index: 5; overflow-x: auto; }
#subtabs .subtabs .title { font-weight: 700; padding: 12px 14px 10px 0; margin-right: 6px; border-right: 1px solid var(--line, #dde3ea); white-space: nowrap; }
#subtabs .subtabs a { padding: 12px 14px 10px; text-decoration: none; color: #4a5566; border-bottom: 3px solid transparent; white-space: nowrap; }
#subtabs .subtabs a:hover { color: #1f5fbf; background: #f4f7fb; }
#subtabs .subtabs a.on { color: #1f5fbf; font-weight: 700; border-bottom-color: #1f5fbf; }
/* 입력 양식 안 체크칸: 체크칸과 글자를 한 줄로 */
.form label.chk.f { flex-direction: row; align-items: center; justify-content: flex-start; gap: 6px; padding-top: 18px; }
.form label.chk.f input { width: auto; }


/* ════════ 예전(Codex) 프로그램 화면 규칙 ════════
   맑은 고딕 · 배경 #f3f6fa · 흰 패널(모서리 10) · 입력/버튼 38~40px · 표 머리글 38px #eef2f7 · 상자형 탭 · 파란 강조 #2d63d7 */
:root {
  --bg: #f3f6fa; --panel: #ffffff; --line: #dde3ec; --line-strong: #cfd7e3; --text: #172033; --muted: #667085;
  --primary: #2d63d7; --primary-dark: #2453b5; --primary-soft: #edf4ff; --side: #172230; --side-text: #c8d1dd; --radius: 7px;
}
body, button, input, select, textarea { font-size: 14px; }
body { color: var(--text); background: var(--bg); }

/* 왼쪽 메뉴: 한 줄 버튼, 선택 시 파란 배경 */
#side { width: 214px; background: var(--side); }
#side .brand { padding: 18px 16px 14px; font-size: 17px; font-weight: 800; border-bottom: 0; }
#side .brand small { color: #9eacbe; font-size: 12px; margin-top: 4px; }
#side nav { padding: 6px 10px 20px; display: flex; flex-direction: column; gap: 3px; }
#side a.menu { display: flex; align-items: center; min-height: 40px; padding: 0 14px; border: 0; border-left: 0; border-radius: 7px;
  color: var(--side-text); font-size: 14.5px; text-decoration: none; }
#side a.menu:hover { background: #223247; color: #fff; text-decoration: none; }
#side a.menu.active { background: #2d63d7; color: #fff; font-weight: 700; border-left: 0; }
#side .me { font-size: 13px; color: #9eacbe; }

/* 화면 위 탭: 상자형(회색 탭 · 선택 시 흰색/파란 글자) */
#subtabs .subtabs { gap: 4px; padding: 14px 24px 0; background: var(--bg); border-bottom: 1px solid #d7dee8; position: sticky; top: 0; z-index: 5; }
#subtabs .subtabs .title { display: none; }
#subtabs .subtabs a { display: inline-flex; align-items: center; min-height: 38px; padding: 0 18px; border: 1px solid #d7dee8; border-bottom: 0;
  border-radius: 8px 8px 0 0; background: #edf2f8; color: #53647d; font-weight: 700; margin-bottom: -1px; }
#subtabs .subtabs a:hover { background: #f6f9fd; color: #1f56ba; text-decoration: none; }
#subtabs .subtabs a.on { background: #fff; color: #1f56ba; border-bottom: 1px solid #fff; }

#page { padding: 20px 24px 48px; }
.page-head { margin-bottom: 16px; }
.page-head h1 { font-size: 22px; font-weight: 800; }
.page-head .sub { font-size: 13px; }

.panel { border-color: var(--line); border-radius: 10px; padding: 16px 18px; margin-bottom: 16px; }
.panel h2 { font-size: 16px; font-weight: 800; margin-bottom: 12px; }

/* 입력·버튼 */
.btn { height: 38px; padding: 0 16px; border-color: var(--line-strong); border-radius: 7px; font-weight: 650; color: #344054; }
.btn:hover { background: #f5f7fb; }
.btn.primary { height: 40px; padding: 0 18px; background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 750; }
.btn.primary:hover { background: var(--primary-dark); }
.btn.sm { height: 30px; padding: 0 11px; font-size: 13px; }
input[type=text], input[type=number], input[type=date], input[type=month], input[type=password], input[type=search], input:not([type]), select {
  height: 38px; padding: 0 10px; border-color: var(--line-strong); border-radius: 7px; }
input:focus, select:focus, textarea:focus { outline: 0; border: 2px solid var(--primary); padding: 0 9px; }
textarea:focus { padding: 7px 9px; }
input[type=checkbox] { width: 17px; height: 17px; accent-color: var(--primary); }
.form { gap: 12px 16px; }
.form .f > span { font-size: 13px; color: #475467; font-weight: 600; }
.form .sec { grid-column: 1 / -1; font-size: 15px; font-weight: 800; color: #1f2a44; margin-top: 8px; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.form .sec:first-child { margin-top: 0; }

/* 설정 체크칸: 2열 카드(체크 + 이름 + 설명) */
.form .opts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 12px; }
@media (max-width: 900px) { .form .opts { grid-template-columns: 1fr; } }
label.opt { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: #fafbfd; cursor: pointer; }
label.opt:hover { border-color: #9db8ee; }
label.opt:has(input:checked) { border-color: #9db8ee; background: #edf4ff; }
label.opt input { margin-top: 2px; flex: none; }
label.opt b { display: block; font-size: 14px; }
label.opt small { display: block; color: var(--muted); font-size: 12.5px; margin-top: 2px; }

/* 표: 머리글 38px, 줄무늬, 선택 연파랑 */
.tbl-wrap { border-color: var(--line); border-radius: 8px; }
table.tbl { font-size: 13.5px; }
table.tbl th { background: #eef2f7; color: #3a4658; font-weight: 750; height: 38px; padding: 0 10px; border-bottom: 1px solid #d5dce6; border-right: 1px solid #e3e8ef; }
table.tbl td { padding: 8px 10px; border-bottom: 1px solid #e7ebf1; }
table.tbl tbody tr:nth-child(even) td { background: #f8fafc; }
table.tbl tbody tr:hover td { background: #eef4ff; }
table.tbl tr.selected td { background: #dce8ff !important; }
table.tbl tfoot td { background: #eef2f7; font-weight: 750; }
.tbl-info { font-size: 13px; }

/* 화면 안 탭(상자형) */
.tabs { gap: 4px; border-bottom: 1px solid #d7dee8; margin-bottom: 14px; }
.tabs button { min-height: 36px; padding: 0 16px; border: 1px solid #d7dee8; border-bottom: 0; border-radius: 8px 8px 0 0; background: #edf2f8;
  color: #53647d; font-weight: 700; margin-bottom: -1px; }
.tabs button:hover { background: #f6f9fd; color: #1f56ba; }
.tabs button.active { background: #fff; color: #1f56ba; border-bottom: 1px solid #fff; }

/* 숫자 카드: 굵은 제목 + 큰 파란 숫자 */
.cards { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; margin-bottom: 16px; }
.card { border-color: var(--line); border-radius: 10px; padding: 14px 16px; }
.card .k { font-size: 13px; color: #475467; font-weight: 750; }
.card .v { font-size: 25px; font-weight: 850; color: #174ea6; margin-top: 6px; }
.card.warn .v { color: #b86e00; } .card.bad .v { color: #c4322b; }

.badge { padding: 2px 9px; font-size: 12.5px; font-weight: 600; }
.note { border-radius: 7px; }

/* 창(모달) */
.modal { border-radius: 12px; }
.modal-head { padding: 16px 22px; }
.modal-head h3 { font-size: 18px; font-weight: 800; }
.modal-body { padding: 18px 22px; background: #fff; }
.modal-foot { padding: 14px 22px; background: #f6f8fb; border-radius: 0 0 12px 12px; }
.modal-foot .btn { min-width: 92px; justify-content: center; }
.note { font-size: 13.5px; padding: 10px 14px; }
.form .opts input[type=checkbox], label.opt input[type=checkbox] { width: 17px !important; height: 17px; flex: none; }
.form .opts label.opt { width: auto; }
.form .f.w2 { grid-column: span 2; }

/* ───── 화천 SCM 수주현황 카드(기존 프로그램 12분류) ───── */
.scm-filter .row { gap: 14px; flex-wrap: wrap; align-items: center; }
.scm-filter label { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; color: #344054; }
.scm-filter #stamp { margin-left: auto; }
.ocards { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; margin-bottom: 16px; }
@media (max-width: 1500px) { .ocards { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 1000px) { .ocards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.ocard { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; text-align: left; background: #fff; border: 1px solid #d5dde8;
  border-top: 5px solid #8a97a8; border-radius: 10px; padding: 11px 13px 12px; cursor: pointer; font: inherit; color: #1d2939; min-height: 112px;
  transition: box-shadow .12s, transform .12s; }
.ocard:hover { box-shadow: 0 4px 14px rgba(23, 78, 166, .14); transform: translateY(-1px); }
.ocard.active { outline: 3px solid #2d63d7; outline-offset: -1px; box-shadow: 0 4px 16px rgba(45, 99, 215, .22); }
.ocard .ol { font-size: 14px; font-weight: 800; color: #344054; }
.ocard .ov { font-size: 28px; font-weight: 850; line-height: 1.15; color: #174ea6; }
.ocard .ov small { font-size: 13px; font-weight: 700; margin-left: 3px; color: #667085; }
.ocard .os { font-size: 12px; color: #5b6575; }
.ocard.go { border-top-color: #1d7a4b; } .ocard.go .ov { color: #1d7a4b; }
.ocard.info { border-top-color: #2d63d7; }
.ocard.warn { border-top-color: #d48a00; } .ocard.warn .ov { color: #b86e00; }
.ocard.bad { border-top-color: #c4322b; } .ocard.bad .ov { color: #c4322b; }
.ocard.muted { border-top-color: #98a2b3; } .ocard.muted .ov { color: #475467; }
.ocard.main { border-top-color: #172230; background: #f6f9ff; }
.ocard.zero .ov { color: #98a2b3; }
.detail-panel .dhead { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.detail-panel .dhead h2 { margin: 0 auto 0 0; }
.detail-panel .dhead input[type=search] { width: 240px; }
.grid.two-col { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); }
@media (max-width: 1100px) { .grid.two-col { grid-template-columns: 1fr; } }
.ocard { text-decoration: none; }
table.tbl tr.grp-first td { border-top: 2px solid #c9d3e1; }

/* ───── 표 · 화면 크기 정리(1.5.0) ───── */
table.tbl th, table.tbl td { white-space: nowrap; }
table.tbl td { max-width: 420px; overflow: hidden; text-overflow: ellipsis; }
table.tbl td.wrap { white-space: normal; }
.tbl-info { display: flex; justify-content: space-between; align-items: center; font-size: 12.5px; color: #667085; margin: 4px 2px 6px; }
.me .zoom { display: flex; align-items: center; gap: 6px; margin: 4px 0 8px; font-size: 12px; color: #b7c2d3; }
.me .zoom b { min-width: 42px; text-align: center; color: #fff; }
.me .zoom .btn.sm { min-width: 28px; padding: 0 6px; height: 26px; }
.page-head { align-items: flex-end; }
.panel .row { row-gap: 8px; }
table.tbl td:has(button, input, select, a.btn) { overflow: visible; max-width: none; }

/* 좌우 나눔(끌어서 크기 조절) */
.split { display: grid !important; grid-template-columns: var(--left, 300px) 10px minmax(0, 1fr) !important; gap: 0 !important; align-items: start; }
.split > .gutter { align-self: stretch; cursor: col-resize; position: relative; min-height: 120px; }
.split > .gutter::before { content: ''; position: absolute; left: 4px; top: 0; bottom: 0; width: 2px; border-radius: 2px; background: #d5dce6; }
.split > .gutter:hover::before, .split > .gutter.drag::before { background: #2d63d7; width: 4px; left: 3px; }
.split > :first-child, .split > :last-child { min-width: 0; }
.split .tbl-wrap { resize: vertical; max-height: none; height: calc(100vh - 360px); min-height: 160px; }
.split.split-right { grid-template-columns: minmax(0, 1fr) 10px var(--left, 300px) !important; }
.dist-tbl td { line-height: 1.25; }
.chip { display: inline-block; background: #eef4ff; border: 1px solid #c9d8f5; border-radius: 12px; padding: 2px 10px; margin: 2px; font-size: 12.5px; } .chip a { color: #b42c2c; margin-left: 4px; text-decoration: none; }
/* 선택 목록 + 직접 입력 */
.combo { position: relative; display: flex; }
.combo input { flex: 1; padding-right: 26px; }
.combo-btn { position: absolute; right: 2px; top: 50%; transform: translateY(-50%); border: 0; background: transparent; color: #667; cursor: pointer; font-size: 14px; padding: 2px 6px; }
.combo-list { position: fixed; z-index: 80; background: #fff; border: 1px solid var(--line-strong); border-radius: 6px; box-shadow: 0 6px 20px rgba(0,0,0,.15); overflow-y: auto; overscroll-behavior: contain; }
.combo-list div { padding: 7px 10px; cursor: pointer; border-bottom: 1px solid #f0f2f5; white-space: nowrap; }
.combo-list div:hover, .combo-list div.on { background: var(--primary-soft); }
.combo-list div.sel { font-weight: 600; color: var(--primary); }
table.tbl tbody tr.active td { background: var(--primary-soft); }
a.link { color: var(--primary); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
/* 품번 통합 고르기 목록 */
.picked { margin: 8px 0; min-height: 26px; }
.picklist { max-height: 340px; overflow: auto; border: 1px solid var(--line); border-radius: 6px; }
.tbl.pick { width: 100%; font-size: 12.5px; }
.tbl.pick thead th { position: sticky; top: 0; background: #f5f7fa; z-index: 1; }
.tbl.pick tbody tr { cursor: pointer; }
.tbl.pick tbody tr:hover { background: var(--primary-soft); }
.tbl.pick tbody tr.on { background: #dfeafe; font-weight: 600; }
/* 중복 의심 목록 */
table.tbl.dup tr.grp td { background: #f3f6fb; border-top: 2px solid var(--line-strong); padding: 6px 8px; }
table.tbl.dup tr.keep td { background: #e6f4ea; }
table.tbl.dup tr.mrg td { background: #fff4e5; }
table.tbl.dup td.c { text-align: center; }
/* 가로 스크롤: 화면 아래에 따라다니는 스크롤바 + 굵은 스크롤바 */
.hscroll { position: sticky; bottom: 0; z-index: 7; overflow-x: auto; overflow-y: hidden; height: 16px; background: rgba(240,243,247,.95); border: 1px solid var(--line); border-radius: 0 0 6px 6px; }
.hscroll > div { height: 1px; }
.tbl-wrap::-webkit-scrollbar, .picklist::-webkit-scrollbar, .hscroll::-webkit-scrollbar, .modal-body::-webkit-scrollbar { width: 12px; height: 12px; }
.tbl-wrap::-webkit-scrollbar-thumb, .picklist::-webkit-scrollbar-thumb, .hscroll::-webkit-scrollbar-thumb, .modal-body::-webkit-scrollbar-thumb { background: #b7c0cd; border-radius: 6px; border: 2px solid #f0f3f7; }
.tbl-wrap::-webkit-scrollbar-thumb:hover, .picklist::-webkit-scrollbar-thumb:hover, .hscroll::-webkit-scrollbar-thumb:hover { background: #8d99ab; }
.tbl-wrap::-webkit-scrollbar-track, .picklist::-webkit-scrollbar-track, .hscroll::-webkit-scrollbar-track { background: #f0f3f7; }
table.tbl.dup td.wrap { min-width: 180px; } table.tbl.pick td.wrap { min-width: 140px; }
/* 구매대장(매입장) */
table.tbl.book tr.subtot td { background: #f3f6fb; font-weight: 600; border-top: 1px solid var(--line-strong); }
table.tbl tr.neg td { color: #b42318; }
.warn-text { color: #b54708; font-weight: 600; }
table.tbl.book td.wrap { min-width: 220px; } table.tbl.book td, table.tbl.book th { white-space: nowrap; } table.tbl.book td.wrap { white-space: normal; }
/* 구매 3단계 안내줄(① 소요·발주 → ② 발주서 보내기 → ③ 입고검수 → 구매대장) */
.flow { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 26px; margin: 0 0 14px; }
.flow a.fs { position: relative; display: block; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 9px 14px 10px; color: inherit; text-decoration: none; min-width: 0; }
.flow a.fs:hover { border-color: var(--primary); }
.flow a.fs:not(:last-child)::after { content: '➜'; position: absolute; right: -21px; top: 50%; transform: translateY(-50%); color: #98a2b3; font-size: 15px; }
.flow a.fs.on { border-color: var(--primary); background: var(--primary-soft); box-shadow: inset 0 0 0 1px var(--primary); }
.flow .t { font-weight: 800; font-size: 14.5px; color: #1d2939; }
.flow .d { font-size: 12.5px; color: #475467; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.flow .d b { font-size: 15.5px; color: var(--primary-dark); }
.flow .d b.warn { color: var(--warn); } .flow .d b.bad { color: var(--bad); } .flow .d .ok { color: var(--ok); font-weight: 700; }
/* 소요·발주: 요약줄 · 거래처 칩 · 아래에 따라다니는 선택 합계줄 */
.sumline { font-size: 15px; margin: 2px 0 10px; } .sumline b { color: var(--primary-dark); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 8px; }
.chipbtn { border: 1px solid var(--line); background: #fff; border-radius: 16px; padding: 4px 12px; font-size: 13px; cursor: pointer; color: #344054; }
.chipbtn b { margin-left: 4px; } .chipbtn:hover { border-color: var(--primary); }
.chipbtn.on { background: var(--primary); border-color: var(--primary); color: #fff; }
.chipbtn.warn { border-color: #f5c97a; } .chipbtn.bad { border-color: #f1a5a5; }
.actionbar { position: sticky; bottom: 0; z-index: 8; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; background: #fff; border: 1px solid var(--line-strong);
  border-radius: 10px; padding: 10px 14px; margin-top: 10px; box-shadow: 0 -4px 14px rgba(16, 24, 40, .08); font-size: 14px; }
.actionbar b { color: var(--primary-dark); }
input.need { border-color: #f0b04a; background: #fffaf0; }
.btn.sm.warn { background: var(--warn-soft); border-color: #f0b04a; color: #8a4b00; font-weight: 700; }
/* 수량 근거(왜?) */
.calc { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 10px 0 14px; }
.calc > div { border: 1px solid var(--line); border-radius: 8px; padding: 6px 12px; background: #fff; text-align: center; min-width: 86px; }
.calc > div span { display: block; font-size: 11.5px; color: #667085; } .calc > div b { font-size: 17px; }
.calc > div.on { border-color: var(--primary); background: var(--primary-soft); } .calc > div.on b { color: var(--primary-dark); }
.calc > i { font-style: normal; color: #667085; font-size: 13px; }
.explain h3 { font-size: 13.5px; margin: 14px 0 6px; }
/* 입고검수: 발주서별 카드 */
.po-card { padding: 10px 14px; margin-bottom: 10px; } .po-card.late { border-left: 4px solid var(--bad); }
.po-card .head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.po-card .head .sup { font-size: 15.5px; font-weight: 800; }
.po-card table.tbl { width: 100%; }
/* 줄 색(확인 필요·늦음)이 줄무늬 배경에 가리지 않게 */
table.tbl tbody tr.warn-row td { background: #fff8eb; }
table.tbl tbody tr.bad-row td { background: #fff1f1; }
table.tbl tbody tr.warn-row:hover td, table.tbl tbody tr.bad-row:hover td { background: #eef4ff; }
@media (max-width: 1100px) { .flow { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; } .flow a.fs::after { display: none; } }
/* 그대로/켜기/끄기 같은 한 줄 선택 */
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 8px; overflow: hidden; background: #fff; }
.seg label { padding: 5px 13px; cursor: pointer; font-size: 13px; border-left: 1px solid var(--line); user-select: none; white-space: nowrap; }
.seg label:first-child { border-left: 0; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label:has(input:checked) { background: var(--primary); color: #fff; font-weight: 700; }
.seg label:has(input[value="0"]:checked) { background: #475467; }
.seg label:has(input[value=""]:checked) { background: #eef2f6; color: #344054; font-weight: 600; }

/* 견적서 */
table.qt { table-layout: fixed; }
table.qt.wide { min-width: 1180px; }
table.qt td { padding: 3px 4px; }
table.qt td input, table.qt td select { width: 100%; height: 28px; padding: 0 6px; font-size: 12.5px; }
table.qt td input.b { font-weight: 700; }
table.qt td input.c { text-align: center; }
table.qt input.bad { border-color: var(--bad) !important; background: #fff5f5; }
table.qt tr.k-TEXT td { background: #f8fafc; }
table.qt tr.k-SUBTOTAL td { background: #eef4ff; font-weight: 700; }
table.qt tr.k-TOTAL td { background: #e3ecfd; font-weight: 800; }
table.qt tr.k-FEE td { background: #fffaf0; }
table.qt td.amt { font-weight: 650; white-space: nowrap; }
table.qt td.act { white-space: nowrap; }
table.qt td.act .btn.sm { padding: 0 5px; min-width: 22px; height: 26px; margin-right: 2px; }
table.qt td.last { line-height: 1.2; }
table.qt td.last a { font-weight: 650; }
.qsum { display: flex; gap: 8px 22px; flex-wrap: wrap; align-items: baseline; margin-top: 12px; padding: 10px 12px; background: #f7f9fc; border: 1px solid var(--line); border-radius: 8px; }
.qsum .big { font-size: 21px; font-weight: 850; color: var(--primary-dark); }
.form .ro { min-height: 30px; padding: 6px 2px; border-bottom: 1px dashed var(--line); }
#loadnote:empty { display: none; }
/* 배관피팅 단가표 */
.fp-best { color: var(--ok); font-weight: 700; }
.fp-up { color: var(--bad); font-size: 10.5px; white-space: nowrap; }
.fp-down { color: var(--primary); font-size: 10.5px; white-space: nowrap; }
.fp-quote { color: #7a4b00; }
/* 긴 글자는 칸 안에서 … 로 줄임(전체는 마우스를 올리면) */
.ell-row { display: flex; align-items: baseline; gap: 4px; max-width: 220px; }
.ell-row .ell { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }

/* 단가 칸 옆 '바뀌기 전 단가' 말풍선 */
.price-tip { position: fixed; z-index: 10050; background: #fffbe6; border: 1px solid #e3c766; border-radius: 4px; padding: 3px 8px; font-size: 12px; color: #4a3b00;
  box-shadow: 0 2px 6px rgba(0,0,0,.15); pointer-events: none; white-space: nowrap; }
.price-tip .pos { color: #1a7f37; } .price-tip .neg { color: #c62828; }
/* 발주서 전자결재 칸(담당 · 검토 · 승인) */
.signbox { display: inline-grid; grid-template-columns: repeat(4, 76px); border: 1px solid var(--line-strong); border-radius: 6px; overflow: hidden; }
.signbox .sign { text-align: center; border-left: 1px solid var(--line-strong); }
.signbox .sign:first-child { border-left: 0; }
.signbox .sign .k { font-size: 11px; background: #eef1f5; padding: 2px 0; color: var(--muted); }
.signbox .sign .v { font-weight: 700; font-size: 13px; padding: 4px 2px 0; min-height: 20px; }
.signbox .sign .t { font-size: 10.5px; color: var(--muted); min-height: 15px; padding-bottom: 2px; }
.signbox .sign.wait .k { background: var(--warn-soft); color: #8a4b00; font-weight: 700; }
/* 사용자 권한 체크(가지런히) · 전자결재 사인 */
.perm-grid { display: flex; flex-direction: column; border: 1px solid var(--line-strong); border-radius: 8px; overflow: hidden; margin: 2px 0 4px; }
.perm-row { display: grid; grid-template-columns: 22px 78px 1fr; align-items: center; gap: 6px; padding: 7px 10px; cursor: pointer; font-weight: 400; }
.perm-grid .perm-row + .perm-row { border-top: 1px solid var(--line); }
.perm-row input[type=checkbox] { width: 16px !important; height: 16px; margin: 0; }
.perm-row b { font-size: 13px; } .perm-row small { color: var(--muted); font-size: 12px; }
.f > .perm-row { border: 1px solid var(--line-strong); border-radius: 8px; }
.sign-row { display: flex; align-items: center; gap: 10px; min-height: 44px; }
.sign-now { max-height: 40px; max-width: 160px; border: 1px dashed var(--line-strong); border-radius: 4px; background: #fff; padding: 2px 4px; }
.sign-thumb { max-height: 22px; max-width: 80px; vertical-align: middle; }
.sign-pad { position: relative; border: 1px dashed var(--line-strong); border-radius: 8px; background: #fff; }
.sign-pad canvas { display: block; width: 100%; height: 180px; touch-action: none; cursor: crosshair; }
.sign-pad .hint { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #c5ccd6; font-size: 22px; pointer-events: none; }
.signbox .sign .v img { max-height: 26px; max-width: 70px; display: block; margin: 0 auto; }
.me .row { flex-wrap: wrap; gap: 4px; }
/* 환율 연동 단가조정: 고른 분기 · 세부내역 품번 줄 */
table.tbl tr.sel td { background: #e8f0ff !important; }
table.tbl tr.sec-row td { background: #f3f6fa; border-top: 1px solid #d5dbe5; }
