/* 인보이스 화면 (STAFF 포털 style.css 변수 사용: --bg --card --ink --mute --line --pink --pink2 --ok --warn --bad) */
body.iv { background: var(--bg, #f6f5f3); color: var(--ink, #1f1f22); margin: 0; min-width: 1100px; }
.ivbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 22px; padding: 10px 24px; background: #fff; border-bottom: 1px solid var(--line, #e3e1dc); }
.ivbrand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; font-weight: 700; }
.ivbrand img { height: 22px; }
.ivbrand span { font-size: 14px; color: var(--mute, #6b6b73); font-weight: 600; }
#ivNav { display: flex; gap: 4px; }
#ivNav a { padding: 7px 14px; border-radius: 8px; color: var(--ink); text-decoration: none; font-size: 14px; font-weight: 600; }
#ivNav a:hover { background: #f3f1ee; }
#ivNav a.on { background: var(--ink, #1f1f22); color: #fff; }
.ivwho { margin-left: auto; font-size: 13px; color: var(--mute); }
.ivback { font-size: 13px; color: var(--pink, #e5566f); text-decoration: none; }
#ivMain { max-width: 1480px; margin: 0 auto; padding: 22px 24px 60px; }
.ivhead { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.ivhead h1 { font-size: 21px; margin: 0; display: flex; align-items: center; gap: 8px; }
.ivhead .btnlink { margin-left: auto; }
.btnlink { display: inline-flex; align-items: center; padding: 8px 14px; border-radius: 9px; border: 1px solid var(--line); background: #fff; color: var(--ink); text-decoration: none; font-weight: 600; font-size: 14px; }
.btnlink.primary { background: var(--pink, #e5566f); border-color: var(--pink); color: #fff; }
.mono { font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; letter-spacing: .2px; }
.mute { color: var(--mute, #6b6b73); }
.sm, small { font-size: 12px; }
.center { text-align: center; }
.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
button.sm { padding: 4px 10px; font-size: 12px; }
button.danger { color: var(--bad, #d0342c); border-color: #f0c3c0; }
button.primary.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
button.primary.ok { background: var(--ok, #1d7a4d); border-color: var(--ok); }

/* 상태 배지 */
.ivb { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.st-draft { background: #eceff3; color: #555c66; }
.st-issued { background: #e3eefc; color: #1d4f91; }
.st-reissued { background: #efe6fb; color: #5b2d91; }
.st-closed { background: #e4e7ec; color: #3d4757; }
.pay-unpaid { background: #ffe7c7; color: #9a4b00; }
.pay-paid { background: #d9f2df; color: #13612f; }

/* 목록 */
.ivtoolbar { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.ivchips { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.ivchips > .mute { width: 64px; font-size: 13px; }
.ivchip { border: 1.5px solid transparent; border-radius: 99px; padding: 3px 12px; font-size: 12.5px; font-weight: 600; cursor: pointer; background: #eceff3; color: #444; }
.ivchip.on { border-color: currentColor; box-shadow: 0 0 0 1px currentColor inset; }
.ivchip:not([class*="st-"]):not([class*="pay-"]).on { background: var(--ink); color: #fff; border-color: var(--ink); box-shadow: none; }
.ivsearch { display: flex; align-items: center; gap: 14px; margin: 6px 0 10px; }
.ivsearch input { width: 340px; }
.ivsum { display: flex; gap: 16px; flex-wrap: wrap; font-size: 13px; }
.ivfilter { margin-bottom: 8px; font-size: 14px; }
.ivtablewrap { background: #fff; border: 1px solid var(--line); border-radius: 12px; overflow: auto; }
table.ivlist { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.ivlist th { text-align: left; font-size: 12px; color: var(--mute); font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--line); background: #fbfaf8; white-space: nowrap; }
.ivlist td { padding: 9px 12px; border-bottom: 1px solid #f0eeea; vertical-align: middle; }
.ivlist tr.click { cursor: pointer; }
.ivlist tr.click:hover td { background: #fdf6f7; }
.ivlist td.ttl { max-width: 360px; }
.ivlist td.ok { color: var(--ok); }
.ivlist td.warn { color: var(--warn, #a65b00); font-weight: 700; }
.ivempty { text-align: center; padding: 80px 0; }

/* 양식 선택 */
.ivtpls { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.ivtpl { display: flex; flex-direction: column; gap: 6px; padding: 18px; background: #fff; border: 1px solid var(--line); border-radius: 12px; text-decoration: none; color: var(--ink); }
.ivtpl:hover { border-color: var(--pink); box-shadow: 0 2px 10px rgba(229, 86, 111, .12); }

/* 입력 화면: 왼쪽 입력, 오른쪽 합계·버튼·PDF 미리보기 */
.ivedit { display: grid; grid-template-columns: minmax(780px, 1fr) minmax(420px, 520px); gap: 20px; align-items: start; }
.ivsticky { position: sticky; top: 64px; display: flex; flex-direction: column; gap: 10px; }
.ivsec { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; margin-bottom: 14px; }
.ivsec h3 { margin: 0 0 10px; font-size: 15px; }
.ivgrid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 14px; }
.ivf { display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.ivf > span { color: var(--mute); font-weight: 600; }
.ivf.req > span::after { content: " *"; color: var(--pink); }
.ivf.wide { grid-column: 1 / -1; }
.ivf input, .ivf select, .ivf textarea, .ivtable input, .ivtable textarea { width: 100%; box-sizing: border-box; padding: 7px 9px; border: 1px solid var(--line); border-radius: 8px; font: inherit; font-size: 13.5px; background: #fffef6; }
.ivf input:focus, .ivtable input:focus, .ivtable textarea:focus, .ivf textarea:focus { outline: 2px solid #f2b8c2; border-color: var(--pink); }
input.need, textarea.need { border-color: var(--bad) !important; }
.ivtable { width: 100%; border-collapse: collapse; font-size: 13px; table-layout: fixed; }
.ivtable th { background: #f79646; color: #fff; font-size: 12px; padding: 6px; text-align: center; white-space: nowrap; }
.ivtable td { padding: 5px 4px; border-bottom: 1px solid #f0eeea; vertical-align: top; }
.ivtable td.num { padding-top: 12px; }
.ivtable input.num { text-align: right; padding: 7px 6px; }
.ivtable td.dates > * { display: block; }
.ivtable td.dates input { padding: 6px 4px; font-size: 12.5px; }
.ivtable td.dates span { text-align: center; color: var(--mute); font-size: 11px; }
.ivtable textarea { resize: vertical; min-width: 0; }
.ivtable td:last-child button { padding: 4px 6px; white-space: nowrap; }
.ivrowbtn { display: flex; align-items: center; gap: 12px; margin-top: 8px; }
.ivbank { border-collapse: collapse; font-size: 13px; width: 100%; }
.ivbank th { background: #f79646; color: #fff; text-align: left; padding: 5px 10px; width: 180px; font-weight: 600; }
.ivbank td { padding: 5px 10px; border-bottom: 1px solid #f0eeea; }
.ivtotal { display: flex; flex-wrap: wrap; gap: 6px 16px; padding: 12px 14px; background: #fff; border: 1px solid var(--line); border-radius: 12px; font-size: 13.5px; }
.ivtotal .grand { width: 100%; font-size: 16px; }
.ivtotal .grand b { color: var(--pink2, #c93f58); }
.ivbtns { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.ivbtns.wrap { justify-content: flex-start; margin: 12px 0; }
.ivpdf { width: 100%; height: calc(100vh - 230px); min-height: 520px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.ivpdf.tall { height: calc(100vh - 150px); }
.ivpdfbar { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.ivpdfbar select { flex: 1; }

/* 상세 */
.ivinfo { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 8px 16px; }
.ivkv { display: grid; grid-template-columns: 110px 1fr; gap: 10px; padding: 7px 0; border-bottom: 1px solid #f3f1ee; font-size: 14px; align-items: center; }
.ivkv:last-child { border-bottom: 0; }
.ivlogs { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; }
.ivlogs h3 { margin: 0 0 8px; font-size: 15px; }
.ivlogs ol { margin: 0; padding-left: 18px; font-size: 13px; line-height: 1.9; }

/* 확인 창 · 알림 */
.ivmodal { position: fixed; inset: 0; background: rgba(20, 20, 25, .38); display: flex; align-items: center; justify-content: center; z-index: 50; }
.ivdlg { background: #fff; border-radius: 14px; padding: 20px 22px; width: min(480px, 92vw); display: flex; flex-direction: column; gap: 10px; box-shadow: 0 10px 40px rgba(0, 0, 0, .2); }
.ivdlg h3 { margin: 0; font-size: 17px; }
.ivdlgmsg { margin: 0; font-size: 14px; line-height: 1.6; color: #333; }
.ivdlgbtn { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }
.ivtoast { position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 20px); opacity: 0; background: #1f1f22; color: #fff; padding: 10px 18px; border-radius: 10px; font-size: 14px; transition: .2s; pointer-events: none; z-index: 60; max-width: 80vw; }
.ivtoast.show { opacity: 1; transform: translate(-50%, 0); }
.ivtoast.err { background: var(--bad, #d0342c); }
.upd-banner { position: sticky; top: 0; z-index: 100; background: #fff4d6; color: #6b4a00; padding: 9px 16px; text-align: center; font-size: 14px; border-bottom: 1px solid #f1d58a; }
.upd-banner button { margin-left: 8px; }
