/* 경비 증빙 화면 꾸밈. 색은 여기 변수로만 쓴다(밝은/어두운 테마). 글꼴은 Pretendard(저장소 안 vendor/). */
@font-face {
  font-family: 'Pretendard Variable';
  font-weight: 45 920;
  font-style: normal;
  font-display: swap;
  src: url('/vendor/pretendard-1.3.9/PretendardVariable.woff2') format('woff2-variations'),
       url('/vendor/pretendard-1.3.9/PretendardVariable.woff2') format('woff2');
}
:root {
  --bg: #f1f3f2; --surface: #ffffff; --surface-2: #e9ecea; --ink: #1b2221; --ink-soft: #56615f; --ink-faint: #5f6a68;
  --line: #d6dbd9; --accent: #0f6e56; --accent-ink: #ffffff; --accent-soft: #e1f2ec;
  --ok: #2f6b1f; --ok-bg: #e7f1df; --warn: #7a4b06; --warn-bg: #f8ecd4; --danger: #8c3a2b; --danger-bg: #f5e4e0; --muted-bg: #eceeed;
  --shadow: 0 1px 2px rgba(20, 24, 24, 0.06), 0 8px 24px rgba(20, 24, 24, 0.06);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #131817; --surface: #1a201f; --surface-2: #232a29; --ink: #e7ecea; --ink-soft: #a3adab; --ink-faint: #929d9b;
    --line: #2f3836; --accent: #5dcaa5; --accent-ink: #04342c; --accent-soft: #143a30;
    --ok: #a6d38a; --ok-bg: #1f2d17; --warn: #f2c879; --warn-bg: #33270f; --danger: #e8a99b; --danger-bg: #36211c; --muted-bg: #262d2c;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 10px 28px rgba(0, 0, 0, 0.4);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #131817; --surface: #1a201f; --surface-2: #232a29; --ink: #e7ecea; --ink-soft: #a3adab; --ink-faint: #929d9b;
  --line: #2f3836; --accent: #5dcaa5; --accent-ink: #04342c; --accent-soft: #143a30;
  --ok: #a6d38a; --ok-bg: #1f2d17; --warn: #f2c879; --warn-bg: #33270f; --danger: #e8a99b; --danger-bg: #36211c; --muted-bg: #262d2c;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 10px 28px rgba(0, 0, 0, 0.4);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  min-height: 100vh; background: var(--bg); color: var(--ink); font-size: 15px; line-height: 1.55; word-break: keep-all;
  font-family: 'Pretendard Variable', Pretendard, -apple-system, BlinkMacSystemFont, 'Malgun Gothic', system-ui, sans-serif;
}
body.center { display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
h1, h2, h3 { margin: 0 0 12px; line-height: 1.3; }
h2 { font-size: 17px; font-weight: 700; }
h3 { font-size: 15px; font-weight: 700; }
a { color: var(--accent); }
small { font-size: 12px; }
[hidden] { display: none !important; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); padding: 22px 20px; margin: 0 0 16px; }
.card > :last-child { margin-bottom: 0; }   /* 카드 맨 아래 글이 카드 안쪽 여백에 또 여백을 더하지 않게 */
.card.narrow { width: 100%; max-width: 380px; padding: 32px 28px 26px; margin: 0; }
.brand { font-size: 21px; font-weight: 800; margin-bottom: 6px; }
.lede, .hint { color: var(--ink-soft); font-size: 13.5px; margin: 0 0 18px; }
.foot { margin: 18px 0 0; text-align: center; font-size: 12.5px; color: var(--ink-faint); }
.foot a + a { margin-left: 14px; }
.muted { color: var(--ink-faint); }
.mono { font-family: ui-monospace, Consolas, 'Malgun Gothic', monospace; letter-spacing: 0.02em; }
.empty { padding: 24px 8px; text-align: center; color: var(--ink-faint); }

.field { display: block; margin: 0 0 14px; }
.field > span { display: block; font-size: 13px; font-weight: 600; color: var(--ink-soft); margin-bottom: 6px; }
.field small { font-weight: 400; color: var(--ink-faint); }
input, select, textarea {
  width: 100%; min-height: 44px; font: inherit; color: var(--ink); background: var(--surface-2);
  border: 1px solid var(--line); border-radius: 9px; padding: 10px 12px;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
::placeholder { color: var(--ink-faint); opacity: 1; }   /* 브라우저 기본 흐린 회색은 배경과 대비가 모자라다 */
input[type="checkbox"] { width: 18px; min-height: 18px; height: 18px; margin: 0; accent-color: var(--accent); }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; margin: 0 0 14px; min-height: 44px; }
.grid-form .check { align-self: end; }   /* 옆 칸 입력창과 같은 줄 높이에 맞춘다 */
.check-row { display: flex; flex-wrap: wrap; gap: 0 18px; margin: -6px 0 6px; }
.check-row .check { margin: 0; }

button, .button {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 0 16px;
  font: inherit; font-size: 14px; font-weight: 600; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: 9px; cursor: pointer; text-decoration: none; white-space: nowrap;
}
button:hover, .button:hover { background: var(--surface-2); }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
button.primary:hover { filter: brightness(1.06); }
button.danger { color: var(--danger); border-color: var(--danger); }   /* 되돌리기 어려운 동작(사용 중지)에만 */
button.small { min-height: 36px; padding: 0 12px; font-size: 13px; }
button.wide { width: 100%; margin-top: 6px; }
button:disabled { opacity: 0.55; cursor: default; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.actions.end { justify-content: flex-end; }
.actions .push { margin-left: auto; }   /* 같은 줄에서 이 단추만 오른쪽 끝으로 */

.alert { background: var(--danger-bg); color: var(--danger); border-radius: 8px; padding: 10px 12px; font-size: 13.5px; font-weight: 600; margin: 0 0 14px; }
.notice { background: var(--warn-bg); color: var(--warn); border-radius: 8px; padding: 10px 12px; font-size: 13.5px; margin: 0 0 14px; }

.topbar {
  position: sticky; top: 0; z-index: 5; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px;
  padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--line);
}
.brand-sm { font-weight: 800; font-size: 16px; color: var(--ink); text-decoration: none; }
.who { margin-left: auto; display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: center; font-size: 13px; color: var(--ink-soft); }
.tabs { display: flex; gap: 4px; }
.tabs button { min-height: 38px; border-color: transparent; background: transparent; }
.tabs button[aria-selected="true"] { background: var(--accent-soft); color: var(--accent); }
.page { max-width: 1100px; margin: 0 auto; padding: 16px; }

.grid-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.grid-form .span2 { grid-column: 1 / -1; }
.facts { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 8px 12px; margin: 0; }
.facts dt { color: var(--ink-soft); font-size: 13.5px; }
.facts dd { margin: 0; }

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.list { width: 100%; border-collapse: collapse; font-size: 14px; }
table.list th { text-align: left; font-size: 12.5px; font-weight: 600; color: var(--ink-soft); padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.list td { padding: 0 10px; height: 48px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.list .num { text-align: right; font-variant-numeric: tabular-nums; }
table.list td.act { width: 1%; white-space: nowrap; text-align: right; }
table.list th:first-child, table.list td:first-child { padding-left: 0; }   /* 첫 칸 글자가 카드 안쪽 여백과 나란히 */
table.list th:last-child, table.list td:last-child { padding-right: 0; }
table.list th.status, table.list td.status { padding-left: 20px; white-space: nowrap; }   /* 배지 칸은 앞 칸과 떼어 둔다 */
.sub { margin-top: 2px; font-size: 12px; line-height: 16px; }   /* 이름 아래 작은 보조 줄(폰 폭에서 숨긴 칸을 모아 보여 줌) */
.sm-only { display: none; }
.nobreak, table.list td.nobreak { white-space: nowrap; overflow-wrap: normal; }   /* 임시 비밀번호 · 아이디는 글자 중간에서 끊기면 옮겨 적다 틀린다 */
#previewErrors table.list th:first-child, #previewItems table.list th:first-child { width: 48px; }   /* 두 미리보기 표의 "줄" 칸 폭을 맞춘다 */
.subhead { margin: 16px 0 8px; font-size: 13.5px; font-weight: 700; color: var(--ink-soft); }
.subhead small { font-weight: 400; margin-left: 6px; }

.badge { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.danger { background: var(--danger-bg); color: var(--danger); }
.badge.muted { background: var(--muted-bg); color: var(--ink-soft); }
.badge.info { background: var(--accent-soft); color: var(--accent); }
.summary { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; }
.filters input { flex: 1 1 220px; width: auto; }
.filters select { flex: 0 1 200px; width: auto; }
details { margin: 12px 0; font-size: 14px; }
summary { cursor: pointer; color: var(--ink-soft); }

dialog { border: 1px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--ink); padding: 22px 20px; width: min(440px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(0, 0, 0, 0.45); }
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 20; max-width: calc(100vw - 32px);
  background: var(--ink); color: var(--surface); padding: 10px 16px; border-radius: 10px; font-size: 14px;
  opacity: 0; pointer-events: none; transition: opacity 0.2s;
}
.toast.show { opacity: 1; }
.toast.error { background: var(--danger); color: var(--surface); }

@media (max-width: 640px) {
  .grid-form { grid-template-columns: minmax(0, 1fr); }
  .who { margin-left: 0; width: 100%; }
  .card { padding: 18px 14px; }
  .page { padding: 16px; }
  /* 폰에서 iOS가 16px보다 작은 입력칸을 누르면 화면을 멋대로 확대한다 */
  input, select, textarea { font-size: 16px; }
  /* 손가락으로 누르는 것은 높이 44px 이상 */
  .tabs button, button.small { min-height: 44px; }
  .who a, .foot a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 4px; }
  summary { padding: 10px 0; line-height: 24px; }
  .filters select { flex: 1 1 100%; width: 100%; }
  /* 표: 둘째 칸들은 숨기고 줄마다 이름 · 배지 · 단추만 남겨 옆으로 밀지 않게 한다(숨긴 내용은 이름 아래 작은 줄로) */
  .topbar { position: static; }   /* 폰에서는 머리줄이 두세 줄이라 따라다니면 화면을 너무 먹는다 */
  .sm-hide { display: none; }
  .sm-only { display: block; }
  /* 이름 아래 작은 줄은 줄마다 한 줄로 고정하고 넘치면 …로: 어떤 줄이든 높이가 같다 */
  .clip { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  table.list.fit { table-layout: fixed; }   /* 칸 폭을 정해 두어야 … 줄임이 듣는다 */
  table.list.fit th.status { width: 112px; }
  table.list.fit th.act { width: 64px; }
  table.list tr.sub-row td { height: 76px; }   /* 이름 + 작은 줄 둘 = 21.7 + 2 + 32 + 위아래 여백 20 */
  table.list td { height: 60px; padding: 10px; overflow-wrap: anywhere; }   /* 표 칸의 height는 최소 높이처럼 늘어난다 */
  table.list th.status, table.list td.status { padding-left: 10px; }
  table.list td.status, table.list td.act { white-space: nowrap; }
  .badge.wrap { white-space: normal; overflow-wrap: anywhere; border-radius: 12px; }
}
/* 사진 자르기 시험(관리자) */
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); gap: 16px; }
.photo-item { margin: 0; padding: 14px; min-width: 0; }
.photo-item h3 { font-size: 14px; margin: 0 0 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.photo-pair { display: flex; gap: 8px; align-items: flex-start; }
.photo-pair .thumb { height: 260px; width: auto; max-width: 50%; object-fit: contain; border-radius: 6px; background: var(--surface-2); }
p.small, ul.small { font-size: 12.5px; margin: 8px 0; }
ul.notice { padding-left: 26px; }
.verdicts button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
/* 직원 화면: 바구니 카드 · 제출 막대 · 진행 막대 · 모서리 고치기 */
.progress { margin-top: 12px; }
.progress .bar { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.progress .bar span { display: block; height: 100%; width: 0; background: var(--accent); transition: width 0.2s; }
.progress p { margin: 6px 0 0; }
.items { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 480px), 1fr)); gap: 14px; }
.item { border: 1px solid var(--line); border-radius: 12px; padding: 12px; background: var(--surface); min-width: 0; }
.item-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.pick-label { display: inline-flex; align-items: center; gap: 8px; min-height: 36px; font-size: 16px; }
.item-badges { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.item-body { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 12px; align-items: start; }
.receipt-thumb { display: block; border-radius: 8px; overflow: hidden; background: var(--surface-2); border: 1px solid var(--line); }
.receipt-thumb img { display: block; width: 100%; height: auto; max-height: 260px; object-fit: contain; object-position: top; }
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 10px; }
.fields .f { display: block; min-width: 0; }
.fields .f > span { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; font-size: 12.5px; font-weight: 600; color: var(--ink-soft); margin-bottom: 4px; }
.fields .f:has(> [name="description"]), .fields .f:has(> [name="partnerName"]) { grid-column: 1 / -1; }   /* 적요 · 거래처 이름은 한 줄 전체 */
.fields .need-check input, .fields .need-check select { border-color: var(--warn); background: var(--warn-bg); }
.fields .missing input, .fields .missing select { border-color: var(--danger); }
.cands { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: -2px; }
button.chip { min-height: 32px; padding: 0 10px; font-size: 13px; border-radius: 99px; }
.item .notice { margin: 10px 0 0; padding-left: 26px; }
.item > .actions { margin-top: 10px; }
.submit-bar {
  position: sticky; bottom: 0; z-index: 6; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px;
  padding: 10px 16px; background: var(--surface); border-top: 1px solid var(--line); box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.08);
}
.submit-sum { font-size: 15px; }
.corner-dialog { width: min(760px, calc(100vw - 24px)); }
.corner-stage { display: flex; justify-content: center; background: var(--surface-2); border-radius: 8px; margin-bottom: 12px; }
.corner-stage canvas { display: block; max-width: 100%; max-height: 62vh; touch-action: none; cursor: grab; }
@media (max-width: 640px) {
  .item-body { grid-template-columns: minmax(0, 1fr); }
  .receipt-thumb img { max-height: 200px; }
  .fields { grid-template-columns: minmax(0, 1fr); }
  .submit-bar .actions { width: 100%; }
  .submit-bar .actions button { flex: 1 1 auto; }
  button.chip { min-height: 44px; }
}

.read-values { display: grid; grid-template-columns: auto 1fr; gap: 4px 10px; font-size: 13.5px; margin: 8px 0; }
.read-values dt { color: var(--ink-soft); }
.read-values dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.read-values .unread { color: var(--ink-faint); }

@media print {
  /* 어두운 테마로 열어 둔 채 인쇄해도 흰 종이에 어두운 글씨가 되도록, 색 변수를 밝은 값으로 되돌린다. */
  :root, :root:not([data-theme="light"]), :root[data-theme="dark"] {
    --bg: #f1f3f2; --surface: #ffffff; --surface-2: #e9ecea; --ink: #1b2221; --ink-soft: #56615f; --ink-faint: #5f6a68;
    --line: #d6dbd9; --accent: #0f6e56; --accent-ink: #ffffff; --accent-soft: #e1f2ec;
    --ok: #2f6b1f; --ok-bg: #e7f1df; --warn: #7a4b06; --warn-bg: #f8ecd4; --danger: #8c3a2b; --danger-bg: #f5e4e0; --muted-bg: #eceeed;
    --shadow: none;
    color-scheme: light;
  }
  body * { visibility: hidden; }
  .print-area, .print-area * { visibility: visible; }
  .print-area { position: absolute; left: 0; top: 0; width: 100%; box-shadow: none; border: 0; }
  .no-print { display: none !important; }
}
/* 제출 막대가 떠 있는 화면에서는 알림이 막대를 가리지 않게 위로 */
body:has(.submit-bar:not([hidden])) .toast { bottom: 96px; }
@media (max-width: 640px) { body:has(.submit-bar:not([hidden])) .toast { bottom: 150px; } }
/* 임원 '누구와' · 근처/먼 곳 단추 */
.fields .wide { grid-column: 1 / -1; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
button.chip[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.fields .missing .chips button { border-color: var(--danger); }
