/* 네이첸 출고현황 — simple is best */
:root {
  --bg: #f3f4f6; --card: #ffffff; --text: #111827; --muted: #6b7280; --line: #e5e7eb;
  --primary: #1f2937; --accent: #2563eb;
  --pending: #9ca3af; --done: #16a34a; --done-bg: #ecfdf5; --issue: #dc2626; --issue-bg: #fef2f2;
  --radius: 10px; --tabbar-h: 60px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", "Malgun Gothic", "Apple SD Gothic Neo", Roboto, sans-serif; font-size: 16px; line-height: 1.45; }
button { font: inherit; cursor: pointer; }
input, select, textarea { font: inherit; }
.hidden { display: none !important; }
h1 { font-size: 22px; margin: 4px 0 16px; }
h2 { font-size: 17px; margin: 0 0 10px; }
.hint { color: var(--muted); font-size: 14px; margin: 0 0 10px; }
.msg { min-height: 1.4em; font-size: 14px; color: var(--issue); margin: 8px 0 0; }
.msg.ok { color: var(--done); }

/* 버튼 */
.btn { border: 1px solid var(--line); background: #fff; color: var(--text); border-radius: var(--radius); padding: 10px 16px; min-height: 44px; }
.btn.primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn.big { width: 100%; font-size: 17px; min-height: 52px; font-weight: 600; }
.btn.small { min-height: 36px; padding: 6px 12px; font-size: 14px; }
.btn.done { background: var(--done); color: #fff; border-color: var(--done); }
.btn.issue { background: #fff; color: var(--issue); border-color: var(--issue); }
.btn.danger { background: var(--issue); color: #fff; border-color: var(--issue); }
.btn:disabled { opacity: .5; cursor: default; }
.iconbtn { border: none; background: transparent; font-size: 22px; min-width: 44px; min-height: 44px; color: inherit; border-radius: var(--radius); }
.iconbtn:hover { background: rgba(0,0,0,.06); }

/* 로그인 */
.screen { min-height: 100vh; }
#view-login { display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-box { background: var(--card); border-radius: 16px; padding: 28px 24px; width: 100%; max-width: 380px; box-shadow: 0 10px 30px rgba(0,0,0,.08); }
.brand { font-weight: 800; letter-spacing: .2em; color: var(--muted); font-size: 13px; }
.login-box label, .form-grid label { display: block; font-size: 14px; color: var(--muted); margin-bottom: 12px; }
.login-box input, .form-grid input, .form-grid select, .dateinput, .modal-box input, .modal-box select, .modal-box textarea {
  display: block; width: 100%; margin-top: 4px; padding: 11px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; color: var(--text); font-size: 16px; }

/* 상단바 */
.topbar { position: sticky; top: 0; z-index: 20; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: space-between; padding: 0 8px 0 16px; height: 52px; }
.topbar-title { font-weight: 700; font-size: 17px; }
.topbar-right { display: flex; align-items: center; gap: 4px; }
.who { font-size: 14px; opacity: .9; }
.issue-banner { background: var(--issue); color: #fff; padding: 10px 16px; font-size: 15px; font-weight: 600; cursor: pointer; }
.issue-banner small { display: block; font-weight: 400; opacity: .95; }

main { padding: 12px 12px calc(var(--tabbar-h) + 20px); max-width: 1200px; margin: 0 auto; }
.card { background: var(--card); border-radius: var(--radius); padding: 16px; margin-bottom: 12px; border: 1px solid var(--line); }
.row { display: flex; gap: 10px; align-items: center; margin: 8px 0; }
.row.wrap { flex-wrap: wrap; }
.inline { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; }
.yearinput { width: 90px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; }

/* 날짜 스트립 */
.daystrip { display: flex; gap: 6px; overflow-x: auto; padding: 2px 0 8px; scrollbar-width: none; }
.daystrip::-webkit-scrollbar { display: none; }
.daystrip button { flex: 0 0 auto; min-width: 64px; min-height: 60px; border: 1px solid var(--line); background: #fff; border-radius: var(--radius); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 4px 6px; }
.daystrip button .d { font-weight: 700; font-size: 16px; }
.daystrip button .w { font-size: 12px; color: var(--muted); }
.daystrip button .c { font-size: 11px; color: var(--muted); }
.daystrip button.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.daystrip button.active .w, .daystrip button.active .c { color: #fff; opacity: .85; }
.daystrip button.sun .w { color: var(--issue); }
.day-head { display: flex; align-items: center; gap: 10px; margin: 4px 0 10px; }
.day-head .dateinput { width: auto; margin: 0; padding: 8px 10px; }
.summary { color: var(--muted); font-size: 14px; }

/* 일정 카드 */
.job-list { display: flex; flex-direction: column; gap: 10px; }
.job { background: var(--card); border: 1px solid var(--line); border-left: 6px solid var(--pending); border-radius: var(--radius); padding: 12px 14px; }
.job.done { border-left-color: var(--done); background: var(--done-bg); }
.job.issue { border-left-color: var(--issue); background: var(--issue-bg); }
.job-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; cursor: pointer; }
.job-site { font-weight: 700; font-size: 16px; }
.tag { font-size: 12px; padding: 2px 8px; border-radius: 999px; background: #e5e7eb; color: #374151; }
.tag.공동구매 { background: #dbeafe; color: #1e40af; }
.tag.시판 { background: #fee2e2; color: #991b1b; }
.tag.건설 { background: #fef3c7; color: #92400e; }
.tag.as, .tag.AS { background: #ede9fe; color: #5b21b6; }
.job-team { margin-left: auto; font-size: 13px; color: var(--muted); }
.job-addr { margin-top: 4px; font-size: 15px; cursor: pointer; }
.job-content { margin-top: 2px; font-size: 15px; color: #374151; cursor: pointer; }
.job-status { margin-top: 8px; font-size: 13px; }
.job-status.done { color: var(--done); font-weight: 600; }
.job-status.issue { color: var(--issue); font-weight: 600; }
.job-actions { display: flex; gap: 8px; margin-top: 10px; }
.job-actions .btn { flex: 1; min-height: 48px; font-weight: 600; }
.empty { color: var(--muted); text-align: center; padding: 30px 0; }

/* 캘린더 */
.cal-wrap { display: grid; grid-template-columns: 1fr; gap: 12px; }
.cal-panel, .cal-side { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
.cal-nav { display: flex; align-items: center; gap: 4px; margin-bottom: 8px; }
.cal-title { font-weight: 700; font-size: 17px; flex: 1; text-align: center; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.cal-grid .wd { text-align: center; font-size: 12px; color: var(--muted); padding: 4px 0; }
.cal-grid .wd:first-child { color: var(--issue); }
.cal-cell { min-height: 64px; border: 1px solid var(--line); border-radius: 8px; padding: 4px; cursor: pointer; background: #fff; display: flex; flex-direction: column; }
.cal-cell.other { opacity: .35; }
.cal-cell.today { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.cal-cell.selected { background: #eef2ff; }
.cal-cell .n { font-size: 13px; font-weight: 600; }
.cal-cell.sun .n { color: var(--issue); }
.cal-cell .cnt { margin-top: auto; display: flex; gap: 3px; flex-wrap: wrap; font-size: 11px; }
.cnt b { padding: 0 5px; border-radius: 999px; color: #fff; font-weight: 600; }
.cnt b.pending { background: var(--pending); }
.cnt b.done { background: var(--done); }
.cnt b.issue { background: var(--issue); }
.legend { display: flex; gap: 14px; margin-top: 8px; font-size: 12px; color: var(--muted); }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 4px; }
.dot.pending { background: var(--pending); } .dot.done { background: var(--done); } .dot.issue { background: var(--issue); }
@media (min-width: 900px) {
  .cal-wrap { grid-template-columns: 1.1fr 1fr; align-items: start; }
  .cal-cell { min-height: 80px; }
}

/* 업로드 */
.mapping { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin: 10px 0; }
.mapping label { font-size: 12px; color: var(--muted); }
.mapping select { display: block; width: 100%; margin-top: 2px; padding: 6px; border: 1px solid var(--line); border-radius: 8px; }
.table-scroll { overflow-x: auto; max-height: 360px; overflow-y: auto; border: 1px solid var(--line); border-radius: 8px; margin: 8px 0; }
#preview-table { border-collapse: collapse; font-size: 13px; width: 100%; }
#preview-table th, #preview-table td { border-bottom: 1px solid var(--line); padding: 5px 8px; white-space: nowrap; text-align: left; }
#preview-table th { background: #f9fafb; position: sticky; top: 0; }
#preview-table tr.bad td { background: #fff7ed; color: #9a3412; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.span2 { grid-column: span 2; }

/* 알림 */
.alert-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.alert-item { display: flex; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; font-size: 14px; }
.alert-item .t { color: var(--muted); font-size: 12px; white-space: nowrap; }
.alert-item.issue { border-color: var(--issue); background: var(--issue-bg); }
.alert-item.done { border-color: #bbf7d0; background: var(--done-bg); }
.alert-item.reschedule { border-color: #fde68a; background: #fffbeb; }
.help { padding-left: 18px; font-size: 14px; color: #374151; }
.help li { margin-bottom: 6px; }

/* 하단 탭바 */
.tabbar { position: fixed; bottom: 0; left: 0; right: 0; height: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); background: #fff; border-top: 1px solid var(--line); display: flex; z-index: 30; }
.tabbar button { flex: 1; border: none; background: none; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 12px; color: var(--muted); position: relative; }
.tabbar button .ic { font-size: 20px; }
.tabbar button.active { color: var(--primary); font-weight: 700; }
.badge { position: absolute; top: 6px; right: calc(50% - 24px); background: var(--issue); color: #fff; font-size: 11px; min-width: 18px; height: 18px; border-radius: 999px; display: flex; align-items: center; justify-content: center; padding: 0 5px; }

/* 모달 */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.modal-box { background: #fff; width: 100%; max-width: 640px; max-height: 92vh; overflow-y: auto; border-radius: 16px 16px 0 0; padding: 14px 16px 24px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.modal-box label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.modal-box textarea { min-height: 70px; resize: vertical; }
.modal-box .actions { display: flex; gap: 8px; margin: 10px 0; flex-wrap: wrap; }
.modal-box .actions .btn { flex: 1; min-width: 120px; }
.log-row { font-size: 13px; padding: 6px 0; border-top: 1px solid var(--line); }
.log-row .t { color: var(--muted); }
@media (min-width: 700px) { .modal { align-items: center; } .modal-box { border-radius: 16px; } }

.toast { position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + 16px); transform: translateX(-50%); background: #111827; color: #fff; padding: 10px 16px; border-radius: 999px; font-size: 14px; z-index: 60; box-shadow: 0 6px 20px rgba(0,0,0,.25); max-width: 90vw; }
.toast.issue { background: var(--issue); }

/* 데스크톱: 탭바를 상단 아래 가로 메뉴처럼 */
@media (min-width: 900px) {
  .tabbar { position: fixed; top: 52px; bottom: auto; height: 48px; padding-bottom: 0; border-top: none; border-bottom: 1px solid var(--line); justify-content: center; gap: 8px; }
  .topbar { margin-bottom: 48px; }
  .tabbar button { flex: 0 0 auto; flex-direction: row; gap: 6px; padding: 0 18px; font-size: 14px; }
  .tabbar button .ic { font-size: 16px; }
  .badge { position: static; margin-left: 4px; }
  main { padding-bottom: 40px; }
  .toast { bottom: 24px; }
}
