/* PARU 거래처 행정 웹앱 - 반응형 스타일
   모바일(<=767px): 단계형(한 번에 한 단계) / PC(>=768px): 목록·상태형(전체 표시) */

:root {
  --paru-green: #0b5c3f;
  --paru-green-light: #128a5e;
  --bg: #f4f6f5;
  --panel: #ffffff;
  --line: #d9e0dc;
  --text: #17211c;
  --muted: #5d6b63;
  --danger: #b3261e;
  --warn: #9a6400;
  --radius: 12px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Malgun Gothic", "맑은 고딕", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.55;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--paru-green);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar .brand { font-weight: 700; white-space: nowrap; }
.topbar .spacer { flex: 1; min-width: 0; }
.topbar .who { font-size: 13px; opacity: .9; white-space: nowrap; }
/* 헤더 버튼은 어떤 폭에서도 한 줄을 유지한다(찌그러져 줄바꿈되는 것을 막는다). */
.topbar button { white-space: nowrap; flex: 0 0 auto; }

main { padding: 16px; max-width: 1100px; margin: 0 auto; }

.view[hidden] { display: none; }
.page-title { font-size: 20px; margin: 6px 0 14px; }
.muted { color: var(--muted); font-size: 13px; }
.hint { color: var(--muted); font-size: 12px; margin: 4px 0 0; }
.error { color: var(--danger); min-height: 1.2em; font-size: 13px; }
.note { font-size: 13px; color: var(--warn); white-space: pre-wrap; }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 14px;
}
.panel h2 { font-size: 16px; margin: 0 0 8px; }

button {
  font: inherit;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  padding: 10px 14px;
  cursor: pointer;
  min-height: 44px;
}
button.primary { background: var(--paru-green); border-color: var(--paru-green); color: #fff; font-weight: 600; }
button.primary:disabled { background: #9db3a9; border-color: #9db3a9; cursor: not-allowed; }
button.ghost { background: transparent; border-color: rgba(255,255,255,.4); color: #fff; min-height: 36px; padding: 6px 10px; }

input, select {
  font: inherit;
  width: 100%;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  min-height: 44px;
}
input:read-only, input:disabled { background: #eef1ef; color: var(--muted); }
label { font-size: 13px; font-weight: 600; display: block; margin-bottom: 4px; }

/* 대시보드 카드 (계속 늘릴 수 있는 구조) */
.cards { display: grid; gap: 12px; grid-template-columns: 1fr; }
.task-card {
  text-align: left;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 96px;
}
.task-card .t { font-size: 17px; font-weight: 700; }
.task-card .d { font-size: 13px; color: var(--muted); }
.task-card[disabled] { opacity: .62; }

.badge {
  display: inline-block;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #e3ece7;
  color: var(--paru-green);
  font-weight: 700;
}
.badge.warn { background: #fdf0d5; color: var(--warn); }

.counts { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.counts .chip { background: #eef2f0; border-radius: 999px; padding: 4px 12px; font-size: 13px; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 600; }

.list { list-style: none; margin: 0; padding: 0; }
.list li { padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.list.audit li { font-family: ui-monospace, Consolas, monospace; font-size: 12px; }
.blockers { margin: 0 0 10px 18px; padding: 0; font-size: 13px; color: var(--warn); }

/* 단계 표시 */
.steps { list-style: none; display: flex; gap: 6px; padding: 0; margin: 0 0 10px; overflow-x: auto; }
.step { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); white-space: nowrap; }
.step .dot {
  width: 22px; height: 22px; border-radius: 50%;
  background: #dfe6e2; color: var(--muted);
  display: inline-flex; align-items: center; justify-content: center; font-weight: 700;
}
.step.active .dot, .step.done .dot { background: var(--paru-green); color: #fff; }
.step.active { color: var(--paru-green); font-weight: 700; }
.status-line { font-size: 13px; margin: 0 0 12px; }

.grid { display: grid; gap: 12px; grid-template-columns: 1fr; }
.field.wide { grid-column: 1 / -1; }

.toast {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%);
  background: #17211c; color: #fff; padding: 10px 16px; border-radius: 999px;
  font-size: 13px; z-index: 50; max-width: 90vw;
}
.toast[hidden] { display: none; }

/* ---------- 모바일: 단계형 (한 번에 한 단계만) ---------- */
@media (max-width: 767px) {
  .desktop-only { display: none !important; }
  .step-panel { display: none; }
  .step-panel.current { display: block; }
  .step .step-name { display: none; }
  .step.active .step-name { display: inline; }
}

/* ---------- 좁은 모바일 헤더(<=480px): 줄바꿈 방지 ---------- */
/* 390x844 등 좁은 화면에서 brand/who 까지 넣으면 버튼 텍스트가 2줄로 접힌다.
   이 폭에서는 브랜드·사용자명을 숨기고 이동/로그아웃 버튼만 한 줄로 남긴다.
   화면 제목은 본문의 .page-title 이 이미 보여준다. */
@media (max-width: 480px) {
  .topbar { gap: 8px; padding: 8px 10px; }
  .topbar .brand { display: none; }
  .topbar .who { display: none; }
  .topbar button.ghost { padding: 6px 10px; font-size: 13px; }
}

/* ---------- PC: 목록 · 상태형 (전체를 한 화면에) ---------- */
@media (min-width: 768px) {
  .mobile-only { display: none !important; }
  .cards { grid-template-columns: repeat(2, 1fr); }
  .grid { grid-template-columns: repeat(3, 1fr); }
  .step-panel { display: block; }
  main { padding: 24px; }
}

@media (min-width: 1100px) {
  .cards { grid-template-columns: repeat(4, 1fr); }
}
