/* EXPAY Plus 공용 스타일 — 색·글꼴·모서리는 /api/config 값으로 덮어쓴다(커스터마이징) */
:root {
  --primary: #0E8C8F;
  --primary-ink: #FFFFFF;
  --primary-hover: #0B7477;
  --primary-soft: #E7F4F4;
  --ink: #16324F;
  --text: #1F2933;
  --text-2: #52606D;
  --text-3: #7B8794;
  --line: #E1E6EB;
  --line-2: #EEF1F4;
  --bg: #F5F7F9;
  --surface: #FFFFFF;
  --radius: 8px;
  --shadow: 0 1px 2px rgba(22, 50, 79, .06), 0 4px 12px rgba(22, 50, 79, .06);
  --shadow-lg: 0 8px 28px rgba(22, 50, 79, .16);
  --ok: #1A7F37; --ok-bg: #E6F4EA;
  --warn: #9A6700; --warn-bg: #FFF6DB;
  --err: #B42318; --err-bg: #FDECEA;
  --info: #1F5FA8; --info-bg: #E8F0FB;
  --mute: #52606D; --mute-bg: #EEF1F4;
  --font: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
  --ease: cubic-bezier(.2, .8, .2, 1);
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 15px; line-height: 1.55; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; word-break: keep-all; overflow-wrap: anywhere; }
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, h4 { margin: 0; color: var(--ink); line-height: 1.3; letter-spacing: -0.01em; }
h1 { font-size: 22px; font-weight: 700; }
h2 { font-size: 18px; font-weight: 700; }
h3 { font-size: 16px; font-weight: 600; }
p { margin: 0; }
.num, .money { font-variant-numeric: tabular-nums; }
.muted { color: var(--text-2); }
.small { font-size: 13px; }
.xs { font-size: 12px; }
.hidden { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.ti { font-size: 1.15em; line-height: 1; vertical-align: -0.12em; }

/* 버튼 */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 44px; padding: 0 18px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); color: var(--text); font-weight: 600; font-size: 15px; white-space: nowrap; transition: background-color .15s var(--ease), border-color .15s var(--ease), transform .1s var(--ease); }
.btn:hover { border-color: #C9D2DB; background: #FAFBFC; }
.btn:active { transform: scale(.98); }
.btn[disabled] { opacity: .45; pointer-events: none; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.btn.primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn.dark { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.danger { color: var(--err); border-color: #F2C9C4; }
.btn.danger:hover { background: var(--err-bg); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--line-2); }
.btn.sm { height: 34px; padding: 0 12px; font-size: 13px; }
.btn.lg { height: 52px; font-size: 16px; }
.btn.block { width: 100%; }
.btn.icon { width: 40px; padding: 0; }
.btn.is-loading { position: relative; color: transparent !important; pointer-events: none; }
.btn.is-loading::after { content: ""; position: absolute; width: 18px; height: 18px; border: 2px solid currentColor; border-color: var(--primary-ink) transparent var(--primary-ink) transparent; border-radius: 50%; animation: spin .7s linear infinite; }
.btn:not(.primary).is-loading::after { border-color: var(--text-2) transparent var(--text-2) transparent; }
@keyframes spin { to { transform: rotate(360deg); } }

/* 폼 */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field > label, .label { font-size: 13px; font-weight: 600; color: var(--ink); }
.field .req { color: var(--err); margin-left: 2px; }
.field .hint, .hint { font-size: 12px; color: var(--text-2); }
.field .err { font-size: 12px; color: var(--err); }
.input, .select, .textarea { width: 100%; height: 44px; padding: 0 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); transition: border-color .15s var(--ease), box-shadow .15s var(--ease); }
.textarea { height: auto; min-height: 96px; padding: 10px 12px; resize: vertical; line-height: 1.6; }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2352606D' stroke-width='2.5'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 34px; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.input.is-invalid, .select.is-invalid, .textarea.is-invalid { border-color: var(--err); }
.input[readonly] { background: var(--bg); color: var(--text-2); }
.input-row { display: flex; gap: 8px; }
.input-row > .input, .input-row > .select { flex: 1; min-width: 0; }
.input-unit { position: relative; }
.input-unit .input { padding-right: 36px; text-align: right; }
.input-unit span { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--text-2); font-size: 14px; }
.check { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; padding: 6px 0; }
.check input { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--primary); flex: none; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 16px; }
@media (max-width: 767px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

/* 토글 */
.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch .track { width: 40px; height: 24px; border-radius: 999px; background: #C9D2DB; position: relative; transition: background-color .2s var(--ease); flex: none; }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: transform .2s var(--ease); }
.switch input:checked + .track { background: var(--primary); }
.switch input:checked + .track::after { transform: translateX(16px); }
.switch input:focus-visible + .track { outline: 2px solid var(--primary); outline-offset: 2px; }

/* 면 */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.panel-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line-2); }
.panel-b { padding: 20px; }
.panel + .panel { margin-top: 16px; }
.divider { height: 1px; background: var(--line-2); margin: 16px 0; border: 0; }

/* 배지 */
.badge { display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--mute-bg); color: var(--mute); }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.err { background: var(--err-bg); color: var(--err); }
.badge.info { background: var(--info-bg); color: var(--info); }
.badge.brand { background: var(--primary-soft); color: var(--primary-hover); }

/* 표 */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-weight: 600; font-size: 12px; color: var(--text-2); padding: 10px 12px; background: #F8FAFB; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 12px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr.click { cursor: pointer; }
.table tbody tr.click:hover td { background: #FAFBFC; }
.table .r { text-align: right; }
.table .c { text-align: center; }
.table .nowrap { white-space: nowrap; }

/* 탭 */
.tabs { display: flex; gap: 4px; overflow-x: auto; border-bottom: 1px solid var(--line); scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { flex: none; height: 44px; padding: 0 14px; border: 0; background: none; color: var(--text-2); font-weight: 600; font-size: 14px; border-bottom: 2px solid transparent; margin-bottom: -1px; display: inline-flex; align-items: center; gap: 6px; }
.tab:hover { color: var(--ink); }
.tab.on { color: var(--ink); border-bottom-color: var(--primary); }
.tab .cnt { font-size: 12px; color: var(--text-3); font-weight: 600; }
.tab.on .cnt { color: var(--primary); }
.seg { display: inline-flex; padding: 3px; background: var(--line-2); border-radius: calc(var(--radius) + 2px); gap: 2px; }
.seg button { height: 34px; padding: 0 14px; border: 0; border-radius: var(--radius); background: transparent; font-weight: 600; font-size: 13px; color: var(--text-2); }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(22,50,79,.1); }
.seg-field { display: flex; flex-wrap: wrap; width: 100%; }
.seg-field button { flex: 1 1 auto; height: 38px; white-space: nowrap; transition: background-color .15s var(--ease), color .15s var(--ease); }
.seg-field button:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.seg-field button:not(.on):hover { color: var(--ink); }

/* 빈 상태·스켈레톤 */
.empty { text-align: center; padding: 48px 20px; color: var(--text-2); }
.empty .ti { font-size: 36px; color: #B6C0CA; display: block; margin: 0 auto 10px; }
.empty b { display: block; color: var(--ink); font-size: 15px; margin-bottom: 4px; }
.sk { background: linear-gradient(90deg, #EEF1F4 0%, #F6F8FA 50%, #EEF1F4 100%); background-size: 200% 100%; animation: sk 1.2s ease-in-out infinite; border-radius: var(--radius); }
@keyframes sk { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* 알림 상자 */
.note { display: flex; gap: 10px; padding: 12px 14px; border-radius: var(--radius); background: var(--info-bg); color: #1B4A82; font-size: 13px; line-height: 1.6; }
.note .ti { font-size: 18px; flex: none; margin-top: 1px; }
.note.warn { background: var(--warn-bg); color: #7A5200; }
.note.err { background: var(--err-bg); color: #8F1C13; }
.note.ok { background: var(--ok-bg); color: #145C29; }
.note.brand { background: var(--primary-soft); color: var(--ink); }

/* 토스트 */
#toasts { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 1000; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: calc(100% - 32px); max-width: 420px; }
.toast { pointer-events: auto; background: var(--ink); color: #fff; padding: 12px 16px; border-radius: var(--radius); box-shadow: var(--shadow-lg); font-size: 14px; display: flex; gap: 8px; align-items: center; animation: toastIn .2s var(--ease); }
.toast.err { background: #8F1C13; }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* 모달·시트 */
.modal-bg { position: fixed; inset: 0; background: rgba(15, 30, 45, .45); z-index: 900; display: flex; align-items: center; justify-content: center; padding: 16px; animation: fadeIn .15s var(--ease); }
.modal { overflow: hidden; background: var(--surface); border-radius: calc(var(--radius) + 4px); width: 100%; max-width: 480px; max-height: calc(100dvh - 32px); display: flex; flex-direction: column; box-shadow: var(--shadow-lg); animation: popIn .2s var(--ease); }
.modal.wide { max-width: 760px; }
.modal-h { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px 12px; }
.modal-b { padding: 4px 20px 20px; overflow-y: auto; }
.modal-f { display: flex; gap: 8px; padding: 12px 20px 20px; }
.modal-f .btn { flex: 1; }
@media (max-width: 767px) {
  .modal-bg.sheet { align-items: flex-end; padding: 0; }
  .modal-bg.sheet .modal { max-width: none; border-radius: 16px 16px 0 0; max-height: 92dvh; animation: sheetIn .25s var(--ease); padding-bottom: env(safe-area-inset-bottom); }
}
@keyframes fadeIn { from { opacity: 0; } }
@keyframes popIn { from { opacity: 0; transform: translateY(6px) scale(.99); } }
@keyframes sheetIn { from { transform: translateY(100%); } }

/* 정의 목록 */
.dl { display: grid; grid-template-columns: 110px 1fr; gap: 8px 12px; font-size: 14px; }
.dl dt { color: var(--text-2); }
.dl dd { margin: 0; color: var(--text); }
.sum-row { display: flex; justify-content: space-between; align-items: baseline; padding: 6px 0; font-size: 14px; }
.sum-row.total { border-top: 1px solid var(--line); margin-top: 6px; padding-top: 12px; font-weight: 700; color: var(--ink); font-size: 16px; }
.sum-row.total .money { font-size: 20px; color: var(--primary-hover); }

/* 진행 단계 */
.steps { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-3); }
.steps .st { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; white-space: nowrap; }
.steps .st i { width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid #C9D2DB; display: inline-flex; align-items: center; justify-content: center; font-style: normal; font-size: 12px; }
.steps .st.on { color: var(--ink); }
.steps .st.on i { border-color: var(--primary); background: var(--primary); color: #fff; }
.steps .st.done { color: var(--primary-hover); }
.steps .st.done i { border-color: var(--primary); color: var(--primary); }
.steps .bar { flex: 1; height: 1.5px; background: var(--line); min-width: 8px; }

/* 이미지 업로드 칸 */
.thumbs { display: flex; flex-wrap: wrap; gap: 8px; }
.thumb { position: relative; width: 88px; height: 88px; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); background: var(--bg); }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb .x { position: absolute; top: 4px; right: 4px; width: 24px; height: 24px; border-radius: 50%; border: 0; background: rgba(15,30,45,.7); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 14px; }
.thumb .first { position: absolute; left: 4px; bottom: 4px; background: var(--ink); color: #fff; font-size: 11px; padding: 1px 6px; border-radius: 4px; }
.thumb-add { width: 88px; height: 88px; border-radius: var(--radius); border: 1.5px dashed #C9D2DB; background: var(--surface); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--text-2); font-size: 12px; }
.thumb-add:hover { border-color: var(--primary); color: var(--primary-hover); }
.thumb-add .ti { font-size: 22px; }

/* 상품 사진 없을 때 */
.ph { background: #EEF2F5; display: flex; align-items: center; justify-content: center; color: #A3B0BC; }
.ph .ti { font-size: 32px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

.has-buybar #toasts { bottom: calc(92px + env(safe-area-inset-bottom)); }

.logo-img { height: 28px; width: auto; }
.logo-txt { font-weight: 800; font-size: 20px; color: var(--ink); letter-spacing: -0.02em; }
.logo-txt em { font-style: normal; color: var(--primary); font-weight: 700; }
/* 연동 설정: 회사·서비스별 한 줄 */
.ig-row { display: grid; grid-template-columns: minmax(150px, 1.3fr) minmax(150px, 1fr) 210px 104px; align-items: center; gap: 16px; padding: 14px 20px; border-top: 1px solid var(--line-2); }
.ig-row:first-child { border-top: 0; }
.ig-name { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ig-state { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.ig-mode { justify-self: end; }
.ig-act { justify-self: end; }
.ig-mode .seg button { height: 30px; padding: 0 12px; }
@media (max-width: 900px) {
  .ig-row { grid-template-columns: 1fr auto; gap: 10px; padding: 14px 16px; }
  .ig-mode { justify-self: start; }
  .ig-state { grid-column: 1 / -1; order: 3; }
  .ig-mode { grid-column: 1 / -1; order: 4; }
  .ig-act { grid-row: 1; grid-column: 2; }
}
/* 카드 매출전표: 승인·취소 같은 모양 */
.rcpts { display: grid; gap: 14px; }
.rcpt-tools { display: flex; align-items: center; justify-content: space-between; }
.rcpts.standalone { padding: 0; }
body.rcpt-page { background: #E9ECF0; padding: 20px 12px 40px; }
.slip { --cut: #E9ECF0; position: relative; max-width: 440px; width: 100%; margin: 0 auto; background: #fff; padding: 22px 0 18px; filter: drop-shadow(0 1px 2px rgba(22,50,79,.08)); }
.slip::before, .slip::after { content: ""; position: absolute; left: 0; right: 0; height: 12px; background: radial-gradient(circle at 8px 0, var(--cut) 6px, transparent 6.5px) 0 0 / 16px 12px repeat-x; }
.slip::before { top: 0; }
.slip::after { bottom: 0; transform: rotate(180deg); }
.slip-acts { display: flex; justify-content: center; gap: 8px; padding: 8px 14px 4px; flex-wrap: wrap; }
.slip-btn { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border: 0; border-radius: 4px; font-size: 12.5px; font-weight: 700; color: #fff; cursor: pointer; }
.slip-btn .ti { font-size: 14px; }
.slip-btn.b-link { background: #F5A045; }
.slip-btn.b-copy { background: #6A84ED; }
.slip-btn.b-down { background: #1F2933; }
.slip-btn:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.slip-body { padding: 10px 22px 6px; }
.slip-title { text-align: center; font-size: 17px; font-weight: 800; color: #1F2933; margin: 6px 0 16px; letter-spacing: -.01em; }
.slip-part { position: relative; }
.slip-sec { font-size: 13px; font-weight: 700; color: #3E4C59; margin: 0 0 10px; padding-bottom: 9px; border-bottom: 1px solid #E1E6EB; }
.slip-part + .slip-part .slip-sec { margin-top: 16px; }
.slip-dl { display: grid; grid-template-columns: 76px 1fr; gap: 7px 12px; margin: 0 0 0 4px; font-size: 13px; line-height: 1.45; }
.slip-dl dt { color: #52606D; }
.slip-dl dd { margin: 0; color: #1F2933; word-break: break-all; font-variant-numeric: tabular-nums; }
.slip-dl dd.slip-total { font-size: 15px; font-weight: 800; }
.slip-dl dd.strike { text-decoration: line-through; text-decoration-thickness: 1.5px; }
.slip-stamp { position: absolute; left: 22%; top: 18px; padding: 4px 18px; font-size: 30px; font-weight: 900; letter-spacing: .35em; color: rgba(214, 48, 49, .78); border: 4px solid rgba(214, 48, 49, .7); border-radius: 6px; transform: rotate(-9deg); box-shadow: inset 0 0 0 2px rgba(255,255,255,.6); pointer-events: none; mix-blend-mode: multiply; }
.slip-law { margin: 16px 0 6px; padding: 10px 6px; border-top: 1px solid #E1E6EB; border-bottom: 1px solid #E1E6EB; font-size: 11.5px; color: #52606D; line-height: 1.6; }
.rcpt-sec .slip, .modal-b .slip { --cut: var(--bg); }
.modal-b .rcpts, .panel-b .rcpts { background: var(--bg); padding: 12px 8px; border-radius: var(--radius); }
.panel-b .slip { --cut: var(--bg); }
@media print { .slip-acts { display: none; } .slip { filter: none; } }
.rcpt-total { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.rcpt-total > div { padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; }
.rcpt-total > div + div { border-left: 1px solid var(--line-2); }
.rcpt-total span { font-size: 12px; color: var(--text-2); }
.rcpt-total b { font-size: 15px; color: var(--ink); }
.rcpt-total b.neg { color: var(--err); }
.modal-b { --rcpt-cut: var(--surface); }
.rcpt-sec { margin: 8px 0 0; padding: 18px 16px 20px; background: var(--bg); --rcpt-cut: var(--bg); }
.rcpt-sec > h2 { font-size: 16px; margin: 0 0 12px; color: var(--ink); }
@media print {
  body.printing-rcpt * { visibility: hidden !important; }
  body.printing-rcpt .rcpt-printing, body.printing-rcpt .rcpt-printing * { visibility: visible !important; }
  body.printing-rcpt .rcpt-printing { position: absolute; left: 0; top: 0; width: 100%; }
  body.printing-rcpt .rcpt-tools { display: none; }
  .slip { box-shadow: none; break-inside: avoid; page-break-after: always; }
}
