/* KPF CI 색상 (www.koreabolt.co.kr/page/14)
   메인: 그린 R0 G163 B62 · 딥블루 R0 G94 B149 · 오렌지 R235 G110 B0
   보조: R72 G81 B87 · R114 G113 B113 · R148 G148 B149 */
:root {
  --kpf-green: #00a33e;
  --kpf-blue: #005e95;
  --kpf-orange: #eb6e00;
  --bg: #f3f5f7;
  --panel: #ffffff;
  --ink: #232a2f;
  --muted: #646d73;
  --line: #dce1e5;
  --accent: #005e95;
  --accent-ink: #ffffff;
  --accent-soft: #e4eef6;
  --ok: #00843a;
  --ok-soft: #e2f4e8;
  --warn: #b35300;
  --warn-soft: #fdefe0;
  --bad: #c8102e;
  --bad-soft: #fbe5e8;
  --info: #005e95;
  --info-soft: #e4eef6;
  --radius: 8px;
  --font: "Malgun Gothic", "맑은 고딕", "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
  --mono: var(--font);
}
/* 기본은 기기 설정을 따르고, 전환 버튼으로 고른 값(data-theme)이 있으면 그걸 우선한다 */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #11161a; --panel: #192026; --ink: #e3e8eb; --muted: #98a2a9; --line: #2b343b;
    --accent: #5aaade; --accent-ink: #08131b; --accent-soft: #16304a;
    --ok: #4cc77a; --ok-soft: #153323; --warn: #f2a14a; --warn-soft: #3a2914;
    --bad: #f28b8b; --bad-soft: #3d1d20; --info: #5aaade; --info-soft: #16304a;
  }
}
:root[data-theme="dark"] {
    --bg: #11161a; --panel: #192026; --ink: #e3e8eb; --muted: #98a2a9; --line: #2b343b;
    --accent: #5aaade; --accent-ink: #08131b; --accent-soft: #16304a;
    --ok: #4cc77a; --ok-soft: #153323; --warn: #f2a14a; --warn-soft: #3a2914;
    --bad: #f28b8b; --bad-soft: #3d1d20; --info: #5aaade; --info-soft: #16304a;
}
/* 로고: 밝은 화면은 컬러, 어두운 화면은 흰색 로고 (CI 배경과의 조화 규정) */
img.logo-dark { display: none; }
:root[data-theme="dark"] .logo-light { display: none; }
:root[data-theme="dark"] .logo-dark { display: inline; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .logo-light { display: none; }
  :root:not([data-theme="light"]) .logo-dark { display: inline; }
}
.theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: inline; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-sun { display: inline; }
  :root:not([data-theme="light"]) .theme-toggle .icon-moon { display: none; }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.55 var(--font);
  /* 숫자 열이 세로로 맞도록 고정폭 숫자 */
  font-variant-numeric: tabular-nums;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 0 0 4px; letter-spacing: -0.02em; }
.page-head h1 { padding-left: 12px; border-left: 4px solid var(--kpf-blue); line-height: 1.25; }
h2 { font-size: 16px; margin: 0 0 12px; }
.sub { color: var(--muted); margin: 0 0 20px; font-size: 14px; }

/* 상단 바 */
.topbar {
  background: var(--panel); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 10;
}
/* CI 메인 컬러 세 가지를 띠로 */
.ci-strip { height: 4px; background: linear-gradient(90deg, var(--kpf-green) 0 33.4%, var(--kpf-blue) 33.4% 66.7%, var(--kpf-orange) 66.7% 100%); }
.topbar-inner {
  max-width: 1240px; margin: 0 auto; padding: 0 16px; display: flex; align-items: center; gap: 18px;
  min-height: 56px; flex-wrap: wrap;
}
.brand { font-weight: 700; color: var(--ink); white-space: nowrap; display: flex; align-items: center; gap: 12px; font-size: 15px; }
.brand:hover { text-decoration: none; }
.brand img { height: 26px; width: auto; }
.brand .sys { padding-left: 12px; border-left: 1px solid var(--line); letter-spacing: -0.01em; }
.nav { display: flex; gap: 2px; flex-wrap: wrap; flex: 1; }
.nav a {
  color: var(--muted); padding: 6px 10px; border-radius: 6px; font-size: 14px; white-space: nowrap;
}
.nav a:hover { background: var(--bg); color: var(--ink); text-decoration: none; }
.nav a.active { color: var(--accent); background: var(--accent-soft); font-weight: 700; }
.who { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); }
.who form { margin: 0; }
.who a, .who .btn { white-space: nowrap; }

.wrap { max-width: 1240px; margin: 0 auto; padding: 24px 16px 60px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head .sub { margin: 0; }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 18px; box-shadow: 0 1px 2px rgb(0 0 0 / 0.04); }
.panel.flush { padding: 0; overflow: hidden; }
.panel.flush > h2 { padding: 16px 18px 0; }

/* KPI */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 18px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-top: 3px solid var(--kpf-blue); border-radius: var(--radius); padding: 14px 16px; }
.kpi.bad { border-top-color: var(--bad); }
.kpi.warn { border-top-color: var(--kpf-orange); }
.kpi .label { font-size: 13px; color: var(--muted); }
.kpi .value { font-size: 22px; font-weight: 700; font-family: var(--mono); letter-spacing: -0.02em; margin-top: 2px; }
.kpi .note { font-size: 12px; color: var(--muted); }
.kpi.bad .value { color: var(--bad); }
.kpi.warn .value { color: var(--warn); }

/* 표 */
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { padding: 9px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { font-size: 12px; color: var(--muted); font-weight: 600; background: var(--bg); white-space: nowrap; }
tbody tr:hover { background: color-mix(in srgb, var(--accent-soft) 40%, transparent); }
td.num, th.num { text-align: right; font-family: var(--mono); white-space: nowrap; }
td.code { font-family: var(--mono); font-size: 13px; white-space: nowrap; }
tfoot td { font-weight: 700; background: var(--bg); }
.neg { color: var(--bad); }
.pos { color: var(--info); }
.empty { color: var(--muted); text-align: center; padding: 28px; }

/* 상태 배지 */
.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--bg); color: var(--muted); }
.pill.REQUESTED, .pill.DRAFT { background: var(--warn-soft); color: var(--warn); }
.pill.SHIPPED, .pill.SUBMITTED, .pill.CLAIMED { background: var(--info-soft); color: var(--info); }
.pill.RECEIVED, .pill.CONFIRMED, .pill.SETTLED { background: var(--ok-soft); color: var(--ok); }
.pill.CANCELLED, .pill.WAIVED { background: var(--bg); color: var(--muted); }
.pill.RECEIPT, .pill.OPENING { background: var(--ok-soft); color: var(--ok); }
.pill.USAGE { background: var(--info-soft); color: var(--info); }
.pill.DAMAGE { background: var(--bad-soft); color: var(--bad); }
.pill.ADJUST, .pill.RETURN { background: var(--warn-soft); color: var(--warn); }

/* 폼 */
label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
input, select, textarea {
  font: inherit; color: var(--ink); background: var(--panel); border: 1px solid var(--line);
  border-radius: 6px; padding: 8px 10px; width: 100%; min-height: 38px;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }
input.qty { text-align: right; font-family: var(--mono); max-width: 130px; }
.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.inline { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.inline > div { min-width: 140px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 38px;
  font: inherit; font-size: 14px; font-weight: 600; padding: 8px 16px; border-radius: 6px; cursor: pointer;
  border: 1px solid var(--line); background: var(--panel); color: var(--ink); white-space: nowrap;
}
.btn:hover { text-decoration: none; border-color: var(--muted); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--bad); border-color: var(--bad); }
.btn.small { min-height: 30px; padding: 4px 10px; font-size: 13px; }
.btn.link { border: 0; background: none; color: var(--muted); padding: 0; min-height: 0; font-weight: 400; }

/* 알림 */
.flash { padding: 10px 14px; border-radius: 6px; margin-bottom: 14px; font-size: 14px; }
.flash.ok { background: var(--ok-soft); color: var(--ok); }
.flash.error { background: var(--bad-soft); color: var(--bad); }
.hint { font-size: 13px; color: var(--muted); }
.checks { display: flex; gap: 16px; flex-wrap: wrap; }
label.check { display: inline-flex; align-items: center; gap: 6px; margin: 0; color: var(--ink); font-size: 14px; cursor: pointer; }
label.check input { width: auto; min-height: 0; margin: 0; }
.callout { background: var(--warn-soft); color: var(--warn); border-radius: 6px; padding: 10px 14px; font-size: 14px; margin-bottom: 14px; }

/* 로그인 */
.login-page { min-height: 100vh; display: flex; flex-direction: column; justify-content: center; }
.login-box { max-width: 400px; width: 100%; margin: 0 auto; padding: 24px 16px; }
.login-box .panel { padding: 0; overflow: hidden; box-shadow: 0 8px 28px rgb(0 0 0 / 0.08); }
.login-box .login-body { padding: 30px 28px 26px; }
.login-box .login-logo { display: block; text-align: center; margin: 0 0 14px; }
.login-box .login-logo img { height: 46px; width: auto; }
.login-box h1 { text-align: center; font-size: 19px; margin: 0 0 4px; }
.login-box .login-sub { text-align: center; color: var(--muted); font-size: 13px; margin: 0 0 22px; }
.login-contact { margin-top: 14px; padding: 12px 14px; background: var(--bg); border-radius: 6px; }
.login-contact p { margin: 0; }
.login-contact .contact-name { font-size: 14px; font-weight: 700; color: var(--ink); }
.login-contact .contact-line { font-size: 13px; margin-top: 2px; }
.login-foot { text-align: center; color: var(--muted); font-size: 12px; margin-top: 18px; }
.login-box .field { margin-bottom: 14px; }

/* 막대 추이 */
.bars { display: flex; align-items: flex-end; gap: 10px; height: 160px; padding-top: 10px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 0; }
.bar-stack { width: 100%; max-width: 46px; display: flex; flex-direction: column-reverse; height: 120px; justify-content: flex-start; }
.bar-supplied { background: var(--accent); border-radius: 3px 3px 0 0; opacity: 0.85; }
.bar-loss { background: var(--bad); }
.bar-label { font-size: 11px; color: var(--muted); font-family: var(--mono); }
.legend { display: flex; gap: 16px; font-size: 12px; color: var(--muted); margin-top: 8px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }

/* 인쇄 */
.print-sheet { background: #fff; color: #000; max-width: 820px; margin: 0 auto; padding: 32px; }
.print-sheet .sheet-logo { height: 30px; width: auto; }
.print-sheet table th { background: #f0f0f0; color: #000; }
.print-sheet .sign { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-top: 40px; }
.print-sheet .sign div { border-top: 1px solid #000; padding-top: 6px; font-size: 13px; }
@media print {
  .topbar, .no-print, .flash { display: none !important; }
  body { background: #fff; }
  .wrap { padding: 0; }
  .print-sheet .logo-light { display: inline !important; }
  .print-sheet .logo-dark { display: none !important; }
  .print-sheet { padding: 0; }
}

@media (max-width: 640px) {
  .topbar-inner { gap: 8px; padding-top: 8px; padding-bottom: 8px; }
  .nav { order: 3; flex: 0 0 100%; width: 100%; overflow-x: auto; flex-wrap: nowrap; }
  h1 { font-size: 19px; }
  th, td { padding: 8px; }
  .kpi .value { font-size: 19px; }
  .brand img { height: 22px; }
  .who { margin-left: auto; }
  .who-name { display: none; }
  .brand .sys { font-size: 14px; padding-left: 10px; }
}

/* 서명 */
.signpad { position: relative; border: 1px dashed var(--muted); border-radius: 8px; background: #fff; height: 190px; touch-action: none; }
.signpad canvas { width: 100%; height: 100%; display: block; border-radius: 8px; cursor: crosshair; }
.signpad .sign-guide { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); color: #9aa3a8; font-size: 14px; pointer-events: none; }
.signpad.signed .sign-guide { display: none; }
.signpad .sign-clear { position: absolute; right: 8px; top: 8px; }
.sign-view img { max-width: 320px; width: 100%; background: #fff; border: 1px solid var(--line); border-radius: 6px; }
.print-sheet .sign-box { position: relative; min-height: 90px; }
.print-sheet .sign-stamp { display: block; max-height: 70px; max-width: 220px; margin-top: 4px; }
.print-sheet .sign-meta { display: block; font-size: 11px; color: #444; }
.btn.big { min-height: 48px; font-size: 16px; padding: 10px 22px; }

/* 과다 요청 */
.over-box { border: 1px solid var(--kpf-orange); background: var(--warn-soft); color: var(--ink); border-radius: 8px; padding: 14px 16px; margin-bottom: 18px; }
.over-box ul { margin: 6px 0 10px; padding-left: 18px; color: var(--warn); }
td .cover { display: block; font-size: 12px; color: var(--muted); }
td .cover.over { color: var(--warn); font-weight: 700; }

/* 사진 */
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.photo-card { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--panel); }
.photo-card img { width: 100%; height: 150px; object-fit: cover; display: block; background: #000; }
.photo-card .meta { padding: 8px 10px; font-size: 12px; color: var(--muted); }
.photo-card .flag { color: var(--warn); font-weight: 700; }
.thumbs { display: flex; gap: 4px; flex-wrap: wrap; }
.thumbs img { width: 44px; height: 44px; object-fit: cover; border-radius: 4px; border: 1px solid var(--line); }
input[type=file] { padding: 6px; font-size: 13px; }

/* 운영 설정 */
.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px 20px; }
.setting .hint { margin: 4px 0 0; font-size: 12px; }
input.short { max-width: 140px; }
.sub-h { font-size: 14px; margin: 14px 0 6px; }
ul.plain { margin: 0 0 8px; padding-left: 18px; font-size: 14px; }

/* QR 라벨 (A4 8칸) */
.qr-sheet { display: grid; grid-template-columns: repeat(2, 95mm); gap: 4mm; justify-content: center; }
.qr-label { width: 95mm; height: 65mm; border: 1px dashed #bbb; border-radius: 3mm; background: #fff; color: #111;
  display: flex; align-items: center; gap: 4mm; padding: 4mm; break-inside: avoid; page-break-inside: avoid; }
.qr-code { width: 40mm; height: 40mm; flex: 0 0 40mm; }
.qr-code svg { width: 100%; height: 100%; display: block; }
.qr-info { flex: 1; min-width: 0; overflow: hidden; }
.qr-logo { height: 7mm; width: auto; display: block; margin-bottom: 2mm; }
.qr-cat { font-size: 9pt; color: #555; }
.qr-name { font-size: 10.5pt; font-weight: 700; line-height: 1.3; overflow-wrap: anywhere; }
.qr-code-text { font-size: 12pt; font-weight: 700; color: #005e95; margin-top: 1mm; }
.qr-pack { font-size: 9pt; margin-top: 1mm; }
.qr-hint { font-size: 7.5pt; color: #777; margin-top: 2mm; }
@media print {
  @page { size: A4; margin: 10mm; }
  .qr-sheet { gap: 3mm; }
  .qr-label { border-color: #ccc; }
}
@media (max-width: 640px) {
  .qr-sheet { grid-template-columns: 1fr; }
  .qr-label { width: 100%; height: auto; }
}

/* ---------------------------------------------------------------- 모바일 전용 (/m) */
body.m { padding-bottom: calc(68px + env(safe-area-inset-bottom)); font-size: 16px; }
.m-top { background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.m-top-inner { display: flex; align-items: center; gap: 10px; padding: 8px 14px; min-height: 52px; }
.m-back { font-size: 30px; line-height: 1; color: var(--ink); padding: 0 6px 4px 0; }
.m-back:hover { text-decoration: none; }
.m-brand img { height: 22px; width: auto; display: block; }
.m-brand img.logo-dark { display: none; }
:root[data-theme="dark"] .m-brand img.logo-dark { display: block; }
:root[data-theme="dark"] .m-brand img.logo-light { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .m-brand img.logo-dark { display: block; }
  :root:not([data-theme="light"]) .m-brand img.logo-light { display: none; }
}
.m-title { font-weight: 700; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-pc { font-size: 13px; color: var(--muted); }
.m-wrap { max-width: 640px; margin: 0 auto; padding: 14px 14px 24px; }
.m-tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: grid; grid-template-columns: repeat(5, 1fr);
  background: var(--panel); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.m-tabs a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 0 9px; font-size: 12px; color: var(--muted); position: relative; }
.m-tabs a span { font-size: 19px; line-height: 1; }
.m-tabs a.on { color: var(--accent); font-weight: 700; }
.m-tabs a:hover { text-decoration: none; }
.m-tabs .badge { position: absolute; top: 4px; left: 56%; background: var(--kpf-orange); color: #fff; font-size: 11px; border-radius: 999px; padding: 0 6px; }
.m-card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin-bottom: 14px; }
.m-card label { margin-top: 8px; }
.m-card label:first-child { margin-top: 0; }
.m-pick select { font-size: 16px; }
.m-hello { color: var(--muted); font-size: 14px; margin: 2px 0 12px; }
.m-scan { background: var(--accent); color: var(--accent-ink); border-radius: 12px; padding: 16px; margin-bottom: 14px; }
.m-scan b { display: block; font-size: 17px; margin-bottom: 4px; }
.m-scan span { font-size: 14px; opacity: 0.9; }
.m-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.m-tile { background: var(--panel); border: 1px solid var(--line); border-top: 3px solid var(--kpf-blue); border-radius: 12px; padding: 14px; color: var(--muted); font-size: 14px; }
.m-tile b { display: block; font-size: 24px; color: var(--ink); margin-bottom: 2px; }
.m-tile.warn { border-top-color: var(--kpf-orange); }
.m-tile.warn b { color: var(--warn); }
.m-tile:hover { text-decoration: none; }
.m-h { font-size: 16px; margin: 18px 0 8px; }
.m-list { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; margin-bottom: 14px; }
.m-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 16px; border-bottom: 1px solid var(--line); color: var(--ink); }
.m-row:last-child { border-bottom: 0; }
.m-row:hover { text-decoration: none; background: var(--bg); }
.m-row b { display: block; font-size: 15px; }
.m-row small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.m-qty { font-weight: 700; font-size: 17px; white-space: nowrap; }
.m-row-edit { display: flex; align-items: center; gap: 8px; }
.m-row-edit input.qty { width: 96px; font-size: 16px; }
.m-empty { color: var(--muted); text-align: center; padding: 26px 16px; }
.m-item h1 { font-size: 21px; margin: 2px 0 12px; border: 0; padding: 0; }
.m-item small { color: var(--muted); }
.m-facts { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.m-facts div { background: var(--bg); border-radius: 8px; padding: 8px 10px; }
.m-facts span { display: block; font-size: 12px; color: var(--muted); }
.m-facts b { font-size: 18px; }
.m-seg { display: grid; grid-template-columns: repeat(3, 1fr); background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 3px; margin-bottom: 12px; }
.m-seg button { font: inherit; font-size: 15px; border: 0; background: none; color: var(--muted); padding: 10px 0; border-radius: 8px; cursor: pointer; }
.m-seg button.on { background: var(--panel); color: var(--accent); font-weight: 700; box-shadow: 0 1px 3px rgb(0 0 0 / 0.1); }
.m-stepper { display: grid; grid-template-columns: 56px 1fr 56px; gap: 8px; margin-bottom: 12px; }
.m-stepper button { font-size: 24px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); border-radius: 10px; cursor: pointer; }
.m-stepper input { text-align: center; font-size: 22px; font-weight: 700; min-height: 54px; }
.m-radio { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.m-radio label { display: flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line); border-radius: 10px; padding: 12px; font-size: 15px; color: var(--ink); margin: 0; cursor: pointer; }
.m-radio label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.m-radio input { width: auto; min-height: 0; }
.btn.wide { width: 100%; }
.m-progress { height: 8px; background: var(--bg); border-radius: 999px; overflow: hidden; margin-top: 10px; }
.m-progress i { display: block; height: 100%; background: var(--kpf-green); }
body.m input, body.m select { font-size: 16px; }  /* iOS 확대 방지 */
.m .receive-form { border-radius: 12px; }
.to-mobile { display: none; }
@media (max-width: 900px) { .to-mobile { display: inline; } }

/* 공문 */
.letter { line-height: 1.7; }
.letter-head { display: flex; align-items: center; justify-content: space-between; border-bottom: 3px solid #005e95; padding-bottom: 10px; margin-bottom: 18px; }
.letter-head img { height: 34px; width: auto; }
.letter-org { font-size: 18px; font-weight: 700; }
.print-sheet .letter-meta th, .print-sheet .letter-foot th { width: 90px; background: #f3f5f7; }
.letter-meta { margin-bottom: 22px; }
.letter-body { white-space: pre-wrap; font-size: 15px; min-height: 260px; }
.letter-attach { margin: 22px 0 0; font-size: 14px; }
.letter-sign { text-align: center; font-size: 22px; font-weight: 700; letter-spacing: 0.3em; margin: 48px 0 30px; }
.letter-foot { font-size: 13px; }
.letter-photos { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.letter-photos figure { margin: 0; break-inside: avoid; }
.letter-photos img { width: 100%; height: 220px; object-fit: cover; border: 1px solid #ccc; }
.letter-photos figcaption { font-size: 11px; color: #333; }
.page-break { margin-top: 24px; }
@media print { .page-break { break-before: page; page-break-before: always; margin-top: 0; } }
tr.waived td { color: var(--muted); text-decoration: line-through; }
tr.waived td:last-child, tr.waived td:nth-last-child(2) { text-decoration: none; }
textarea { font: inherit; line-height: 1.6; }
input[type=radio], input[type=checkbox] { width: auto; min-height: 0; padding: 0; accent-color: var(--accent); }
.m-alert { display: block; background: var(--warn-soft); border: 1px solid var(--kpf-orange); border-radius: 12px; padding: 14px 16px; margin-bottom: 14px; color: var(--ink); }
.m-alert b { display: block; color: var(--warn); margin-bottom: 4px; }
.m-alert span { font-size: 14px; }
.m-alert:hover { text-decoration: none; }
.m-chips { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 12px; padding-bottom: 2px; }
.m-chips a { flex: 0 0 auto; border: 1px solid var(--line); background: var(--panel); color: var(--muted); border-radius: 999px; padding: 6px 14px; font-size: 14px; }
.m-chips a.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 700; }
.m-chips a:hover { text-decoration: none; }
.m-row > span:first-child { min-width: 0; }
.m-row b, .m-row small { overflow-wrap: anywhere; }
.sign-missing { border: 1px solid var(--kpf-orange); background: var(--warn-soft); }
.sign-missing h2 { color: var(--warn); }
.sign-steps { margin: 8px 0 14px; padding-left: 20px; line-height: 1.8; }
.my-sign { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 6px; }
.my-sign img { width: 180px; max-width: 100%; height: auto; background: #fff; border: 1px solid var(--line); border-radius: 8px; }
.my-sign > div { display: flex; flex-direction: column; gap: 2px; }

/* PC 화면을 휴대폰으로 볼 때: 표는 줄이지 않고 옆으로 밀어서 본다 */
@media (max-width: 640px) {
  .table-wrap { -webkit-overflow-scrolling: touch; position: relative; }
  .table-wrap table { width: max-content; min-width: 100%; }
  .table-wrap th, .table-wrap td { white-space: nowrap; }
  .table-wrap td { max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
  .page-head .actions { width: 100%; }
  .kpis { grid-template-columns: 1fr 1fr; }
  .kpi .value { font-size: 17px; }
  .wrap { padding: 16px 12px 40px; }
}
.mobile-hint { display: none; }
@media (max-width: 640px) {
  .mobile-hint { display: block; background: var(--accent-soft); color: var(--accent); border-radius: 8px; padding: 10px 12px; font-size: 14px; margin-bottom: 14px; }
}
.btn.wide-m { min-width: 220px; } @media (max-width: 640px) { .btn.wide-m { width: 100%; } }

/* 회사 공문 양식 (주식회사 케이피에프) */
.kpf-letter { font-size: 15px; line-height: 1.75; padding: 44px 52px; }
.kl-company { text-align: center; font-size: 30px; font-weight: 700; letter-spacing: 0.04em; margin: 0 0 26px; }
.print-sheet table.kl-head { width: 100%; border-collapse: collapse; border-bottom: 1.5px solid #000; margin-bottom: 22px; }
.print-sheet .kl-head th, .print-sheet .kl-head td { background: none; border: 0; padding: 2px 0; font-size: 16px; font-weight: 400; vertical-align: bottom; }
.print-sheet .kl-head th { width: 72px; text-align: left; white-space: nowrap; }
.print-sheet .kl-head td.kl-date { text-align: right; font-size: 14px; white-space: nowrap; padding-bottom: 6px; }
.kl-body { margin: 0; padding-left: 26px; }
.kl-body > li { margin: 0 0 22px; padding-left: 4px; }
.kl-pre { white-space: pre-line; }
.kl-sub { margin: 6px 0 0 4px; }
.print-sheet table.kl-table { width: 100%; border-collapse: collapse; margin: 8px 0 6px; font-size: 14px; }
.print-sheet .kl-table th { background: #dde6f3; color: #000; border: 1px solid #333; padding: 8px 6px; text-align: center; font-weight: 400; }
.print-sheet .kl-table td { border: 1px solid #333; padding: 8px 6px; text-align: center; vertical-align: middle; }
.print-sheet .kl-table tfoot td { background: #f3f5f7; font-weight: 700; }
.kl-code { font-size: 11px; color: #555; }
.kl-sender { text-align: center; font-size: 28px; font-weight: 700; letter-spacing: 0.03em; margin: 56px 0 0; padding-bottom: 14px; border-bottom: 1.5px solid #000; }
.kl-attach-title { font-size: 18px; margin: 0 0 4px; }
.kl-attach-sub, .kl-note { font-size: 12px; color: #444; }
@media (max-width: 640px) {
  .kpf-letter { padding: 22px 16px; font-size: 14px; }
  .kl-company { font-size: 22px; }
  .kl-sender { font-size: 19px; }
  .print-sheet .kl-head td.kl-date { display: block; text-align: left; }
}
