/* 현장메이트 사무실 PC 화면. 큰 글씨·큰 버튼, 인쇄용 스타일 포함. */
:root {
  --bg: #f4f6f9;
  --surface: #ffffff;
  --text: #16202c;
  --muted: #5f6b7a;
  --line: #d9dee6;
  --primary: #1f5fbf;
  --primary-ink: #ffffff;
  --ok: #1b7f3b;
  --ok-bg: #e7f5ec;
  --warn: #a35a00;
  --warn-bg: #fff3df;
  --danger: #b3261e;
  --hl: #fffbd1;
  --radius: 10px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { font-size: 17px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Malgun Gothic", "Apple SD Gothic Neo", "Noto Sans KR", system-ui, sans-serif;
  line-height: 1.45;
}
h1 { font-size: 1.5rem; margin: 0 0 12px; }
h2 { font-size: 1.2rem; margin: 0; }
h3 { font-size: 1.05rem; margin: 0 0 8px; }
a { color: var(--primary); }
img { display: block; }
.muted { color: var(--muted); }
.boot { padding: 24px; }
.error { color: var(--danger); font-weight: 700; }
.warn-text { color: var(--warn); font-weight: 700; }
.empty { padding: 32px 16px; text-align: center; color: var(--muted); background: var(--surface); border-radius: var(--radius); }
.print-only { display: none; }

/* 상단 메뉴 */
.top {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  padding: 10px 20px; background: var(--surface); border-bottom: 1px solid var(--line);
}
.brand { font-weight: 800; font-size: 1.2rem; color: var(--primary); }
.top nav { display: flex; gap: 4px; flex-wrap: wrap; flex: 1; }
.top nav a { padding: 8px 14px; border-radius: 8px; text-decoration: none; color: var(--text); font-weight: 600; }
.top nav a.on { background: var(--primary); color: var(--primary-ink); }
main { max-width: 1200px; margin: 0 auto; padding: 18px 20px 60px; }

/* 버튼 */
.btn {
  font: inherit; font-weight: 700; cursor: pointer;
  padding: 9px 16px; border-radius: 8px; border: 1px solid var(--primary);
  background: var(--primary); color: var(--primary-ink); text-decoration: none; display: inline-block;
}
.btn:disabled { opacity: .5; cursor: default; }
.btn.small { padding: 5px 11px; font-size: .9rem; }
.btn.big { padding: 13px 22px; font-size: 1.1rem; width: 100%; }
.btn.ghost { background: transparent; color: var(--primary); }
.btn.danger { background: transparent; color: var(--danger); border-color: var(--danger); }
button:focus-visible, a:focus-visible, .dropzone:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid #f0a500; outline-offset: 2px; }
.chip {
  font: inherit; cursor: pointer; padding: 7px 14px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); color: var(--text); font-weight: 600;
}
.chip.on { background: var(--text); color: #fff; border-color: var(--text); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.switch { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; cursor: pointer; }
.switch input { width: 20px; height: 20px; }
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: .85rem; font-weight: 700; background: var(--line); }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.busy { background: #e6efff; color: var(--primary); }
.badge.muted { color: var(--muted); }
select, input[type=text], input[type=number], input[type=search], input[type=password], input[type=date], input[type=month] {
  font: inherit; padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--text);
}

/* 로그인 */
.login { max-width: 460px; margin: 10vh auto; background: var(--surface); padding: 28px; border-radius: 14px; box-shadow: 0 2px 12px rgba(0,0,0,.06); }
.login form { display: grid; gap: 12px; margin-top: 16px; }
.login input { width: 100%; padding: 12px; font-size: 1.05rem; }

/* 올리기 */
.upload { margin-bottom: 16px; }
.dropzone {
  border: 3px dashed #9fb3d1; border-radius: 14px; background: var(--surface);
  padding: 26px 20px; text-align: center; cursor: pointer;
}
.dropzone.over { border-color: var(--primary); background: #eef4ff; }
.dz-title { font-size: 1.3rem; font-weight: 800; color: var(--primary); }
.dz-sub { color: var(--muted); margin-top: 6px; }
.jobs { display: grid; gap: 6px; margin-top: 10px; }
.job { padding: 8px 12px; border-radius: 8px; background: var(--surface); border-left: 5px solid var(--line); }
.job.busy { border-left-color: var(--primary); }
.job.ok { border-left-color: var(--ok); }
.job.warn { border-left-color: var(--warn); }
.job.error { border-left-color: var(--danger); color: var(--danger); }
.job-name { font-weight: 700; }

/* 필터·요약 */
.filters { display: grid; gap: 10px; margin-bottom: 14px; }
.summary { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin: 6px 0 12px; }
.summary .big { font-size: 1.35rem; font-weight: 800; }
.tabs { display: flex; gap: 6px; }
.actions { display: flex; gap: 8px; align-items: center; margin-left: auto; flex-wrap: wrap; }

/* 주문서 카드 */
.sheet { background: var(--surface); border-radius: 14px; padding: 14px 16px; margin-bottom: 16px; box-shadow: 0 1px 4px rgba(0,0,0,.05); }
.sheet-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.sheet-actions { display: flex; gap: 6px; margin-left: auto; flex-wrap: wrap; align-items: center; }
.group { padding: 10px 0; border-bottom: 1px dashed var(--line); }
.group:last-child { border-bottom: 0; }
.group-head { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.cust-img { max-width: 360px; max-height: 70px; border-radius: 6px; border: 1px solid var(--line); background: #fff; }
.cust-text { font-size: 1.25rem; font-weight: 800; }
.item { display: grid; grid-template-columns: 1fr auto; gap: 6px 8px; align-items: center; margin: 6px 0 6px 24px; }
.item-main {
  font: inherit; text-align: left; cursor: pointer; width: 100%;
  display: grid; grid-template-columns: minmax(0, 560px) 1fr 52px; gap: 12px; align-items: center;
  padding: 6px; border-radius: 10px; border: 2px solid #efe7a6; background: var(--hl); color: var(--text);
}
.row-img { width: 100%; max-height: 110px; object-fit: contain; object-position: left; border-radius: 6px; background: #fff; }
.item-text { font-size: 1.1rem; font-weight: 700; }
.check {
  width: 46px; height: 46px; border-radius: 50%; border: 3px solid var(--muted);
  display: grid; place-items: center; font-size: 1.6rem; color: #fff;
}
.item.picked .item-main { background: #f1f3f5; border-color: var(--line); }
.item.picked .row-img, .item.picked .item-text { opacity: .4; }
.item.picked .check { background: var(--ok); border-color: var(--ok); }
.edit { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 10px; align-items: end; padding: 10px; background: #f7f8fa; border-radius: 8px; }
.edit label { display: grid; gap: 3px; font-size: .9rem; font-weight: 600; }
.edit input { width: 150px; }

/* 표 */
.table { width: 100%; border-collapse: collapse; background: var(--surface); border-radius: 10px; overflow: hidden; margin-bottom: 18px; }
.table th, .table td { padding: 9px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.table th { background: #eef1f5; font-size: .92rem; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .strong { font-weight: 800; font-size: 1.1rem; }
.table tr.picked td { color: var(--muted); }
.table tr.muted td { color: var(--muted); }
.card { background: var(--surface); border-radius: 12px; padding: 14px 16px; margin-bottom: 14px; }
.card .table { margin: 0; }
.stops { margin: 0; padding-left: 24px; }
.datebar { margin: 0 0 14px; font-weight: 700; }

.toasts { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); display: grid; gap: 8px; z-index: 50; }
.toast { padding: 12px 18px; border-radius: 10px; background: #1f2937; color: #fff; font-weight: 600; box-shadow: 0 4px 14px rgba(0,0,0,.2); }
.toast.error { background: var(--danger); }

@media (max-width: 760px) {
  main { padding: 12px 16px 40px; }
  .item { margin-left: 0; }
  .item-main { grid-template-columns: 1fr 46px; }
  .item-main .item-text { grid-column: 1; }
  .item-main .check { grid-row: 1 / span 2; grid-column: 2; }
  .actions { margin-left: 0; }
}

/* 인쇄: 화면 대신 인쇄용 영역만 */
@media print {
  @page { size: A4; margin: 12mm; }
  html { font-size: 11pt; }
  body { background: #fff; }
  body[data-print] #app > *:not(main), body[data-print] main > *:not(#print) { display: none !important; }
  body[data-print] main { padding: 0; max-width: none; }
  .no-print { display: none !important; }
  #print { display: block; }
  #print h1 { font-size: 14pt; margin: 0 0 6mm; }
  .p-sheet { break-after: page; }
  .p-sheet:last-child { break-after: auto; }
  .p-group { break-inside: avoid; margin-bottom: 4mm; padding-bottom: 2mm; border-bottom: 0.3mm solid #999; }
  .p-cust { display: flex; align-items: center; gap: 4mm; font-size: 13pt; margin-bottom: 1mm; }
  .p-cust img { max-height: 11mm; max-width: 70mm; }
  .p-row { display: grid; grid-template-columns: 7mm 88mm 1fr; gap: 3mm; align-items: center; margin: 1mm 0 1mm 5mm; }
  .p-row.no-img { grid-template-columns: 7mm 1fr; }
  .p-box { width: 6mm; height: 6mm; border: 0.5mm solid #000; display: grid; place-items: center; font-size: 10pt; }
  .p-text { font-size: 12pt; font-weight: 700; }
  .p-row img { max-height: 10mm; max-width: 88mm; }
  .table { font-size: 11pt; }
  .table th { background: #eee !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
