* { box-sizing: border-box; }
body { margin: 0; background: #f4f6f7; color: #1f2937; font-family: "Malgun Gothic", "맑은 고딕", -apple-system, sans-serif; font-size: 14px; }
button, input, select { font: inherit; }
.muted { color: #6b7280; }
.r { text-align: right; }
.b { font-weight: 700; }
[hidden] { display: none !important; }

/* 로그인 */
.login-body { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: #e5f1f2; }
.login-box { width: 360px; max-width: calc(100vw - 32px); background: #fff; border-radius: 12px; padding: 28px 26px 22px; box-shadow: 0 6px 24px rgba(0,0,0,.08); }
.login-box h1 { margin: 0 0 6px; font-size: 20px; }
.login-box h1 span, .brand span { color: #157a85; }
.login-box .sub { margin: 0 0 18px; font-size: 13px; color: #6b7280; line-height: 1.55; }
.login-box label { display: block; font-size: 13px; color: #4b5563; margin: 12px 0 4px; }
.login-box input { width: 100%; padding: 11px 12px; font-size: 16px; border: 1px solid #cddcdd; border-radius: 8px; }
.login-box .remember { display: flex; align-items: center; gap: 6px; cursor: pointer; }
.login-box .remember input { width: auto; margin: 0; }
.login-box button { width: 100%; margin-top: 18px; padding: 12px; font-size: 16px; font-weight: 700; color: #fff; background: #157a85; border: 0; border-radius: 8px; cursor: pointer; }
.login-box button:disabled { opacity: .6; }
.err { margin-top: 10px; font-size: 13px; color: #b3261e; min-height: 1em; }
.foot { margin: 14px 0 0; font-size: 12px; color: #9ca3af; }

/* 위 */
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 12px 20px; background: #0e5c66; color: #fff; }
.brand { font-size: 17px; font-weight: 700; }
.brand span { color: #a7e3e8; margin-left: 4px; }
.who { font-size: 13px; }
.who a { color: #d8f1f3; margin-left: 10px; }
main { max-width: 1200px; margin: 0 auto; padding: 16px 20px 40px; }

/* 조건 */
.bar { background: #fff; border-radius: 10px; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chips button, .seg button { padding: 7px 12px; border: 1px solid #cddcdd; background: #fff; border-radius: 18px; cursor: pointer; color: #374151; }
.chips button.on, .seg button.on { background: #157a85; border-color: #157a85; color: #fff; font-weight: 700; }
.seg { display: inline-flex; gap: 4px; }
.dates input, select { padding: 7px 8px; border: 1px solid #cddcdd; border-radius: 8px; background: #fff; }
.row2 { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
button.ghost { padding: 7px 14px; border: 1px solid #157a85; color: #157a85; background: #fff; border-radius: 8px; cursor: pointer; }
#export { margin-left: auto; }

/* 합계 · 품목 */
.sum { display: flex; gap: 10px; flex-wrap: wrap; margin: 14px 0 10px; }
.card-sum { flex: 1 1 220px; background: #fff; border-radius: 10px; padding: 14px 16px; border-left: 4px solid #157a85; }
.card-sum .lbl { color: #6b7280; font-size: 13px; }
.card-sum .big { font-size: 26px; font-weight: 800; margin-top: 4px; }
.card-sum .big small, .card .big small { font-size: 13px; font-weight: 400; margin-left: 2px; color: #6b7280; }
.card-sum .amt { font-size: 17px; font-weight: 700; color: #0e5c66; margin-top: 2px; }
.card-sum .sub { font-size: 12px; color: #9ca3af; margin-top: 4px; }
.empty { width: 100%; background: #fff; border-radius: 10px; padding: 24px; text-align: center; color: #6b7280; }
.items { margin-bottom: 12px; }
table.mini { background: #fff; border-radius: 10px; border-collapse: collapse; min-width: 320px; overflow: hidden; }
table.mini th, table.mini td { padding: 7px 12px; border-bottom: 1px solid #eef2f3; }
table.mini th { background: #f0f6f7; font-weight: 600; color: #4b5563; text-align: left; }
table.mini th.r { text-align: right; }

/* 목록: PC 표 */
.table-wrap { background: #fff; border-radius: 10px; overflow-x: auto; }
#tbl { width: 100%; border-collapse: collapse; white-space: nowrap; }
#tbl th, #tbl td { padding: 8px 10px; border-bottom: 1px solid #eef2f3; }
#tbl th { position: sticky; top: 0; background: #f0f6f7; color: #4b5563; font-weight: 600; text-align: left; }
#tbl th.r { text-align: right; }
#tbl tbody tr:hover { background: #f7fbfb; }
#tbl:has(tbody:empty) { display: none; }
.cards { display: none; }
.more { text-align: center; margin: 14px 0; }
.note { color: #9ca3af; font-size: 12px; text-align: center; }

/* 휴대폰: 카드 */
@media (max-width: 760px) {
  .top { padding: 10px 16px; }
  main { padding: 12px 16px 32px; }
  .table-wrap { display: none; }
  .cards { display: flex; flex-direction: column; gap: 8px; }
  .card { background: #fff; border-radius: 10px; padding: 10px 12px; }
  .card .c1 { display: flex; gap: 8px; font-size: 13px; color: #4b5563; }
  .card .c1 .muted { margin-left: auto; }
  .card .c2 { display: flex; justify-content: space-between; align-items: baseline; margin: 4px 0 2px; font-size: 15px; }
  .card .big { font-size: 20px; font-weight: 800; }
  .card .c3 { font-size: 12px; color: #6b7280; }
  .card .tag { background: #e5f1f2; color: #0e5c66; padding: 0 6px; border-radius: 4px; }
  .card-sum .big { font-size: 22px; }
  table.mini { width: 100%; min-width: 0; }
  #export { margin-left: 0; }
}

dialog { border: 0; border-radius: 12px; padding: 20px; width: 360px; max-width: calc(100vw - 32px); }
dialog h3 { margin: 0 0 10px; }
dialog label { display: block; font-size: 13px; color: #4b5563; margin-top: 10px; }
dialog input { display: block; width: 100%; margin-top: 4px; padding: 9px 10px; border: 1px solid #cddcdd; border-radius: 8px; }
dialog .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
dialog button[type=submit] { padding: 7px 16px; background: #157a85; color: #fff; border: 0; border-radius: 8px; cursor: pointer; }
#toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: #1f2937; color: #fff; padding: 10px 16px; border-radius: 8px; opacity: 0; pointer-events: none; transition: opacity .2s; }
#toast.show { opacity: 1; }
#toast.bad { background: #b3261e; }
