:root{
  --bg:#f4f7f6;
  --card:#fff;
  --line:#e5e7eb;
  --text:#111827;
  --muted:#6b7280;
  --primary:#2c3e50;
  --chip:#f3f4f6;
  --radius:14px;

  /* 폼 라벨(th) 폭 */
  --thw:180px;
}

*{ box-sizing:border-box; }

body{
  margin:0;
  background:var(--bg);
  font-family:Pretendard, system-ui, -apple-system, Segoe UI, Roboto, Arial;
  color:var(--text);
}

/* ===== 공통 페이지 래퍼 ===== */
.page{
  max-width:1400px;
  margin:0 auto;
  padding:20px;
}

.header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  margin-bottom:14px;
}

.header h2{
  margin:0;
  font-size:20px;
  font-weight:800;
}

.header h2 a{
  color:var(--text);
  text-decoration:none;
}

.header h2 a:hover{ text-decoration:underline; }

.header-actions{
  display:flex;
  gap:10px;
  align-items:center;
  flex-wrap:wrap;
}

/* ===== 카드 ===== */
.card{
  background:var(--card);
  border:1px solid var(--line);
  border-radius:var(--radius);
  padding:16px;
  box-shadow:0 1px 8px rgba(0,0,0,.04);
}

.card h3{
  margin:0 0 10px;
  font-size:14px;
}

.note{
  font-size:12px;
  color:var(--muted);
  line-height:1.4;
}

.summary{
  font-size:12px;
  color:var(--muted);
  line-height:1.4;
}

label{
  display:block;
  font-size:12px;
  color:var(--muted);
  margin-bottom:6px;
}

input,
select,
textarea{
  width:100%;
  padding:10px 12px;
  border:1px solid var(--line);
  border-radius:10px;
  background:#fff;
  outline:none;
  font-size:14px;
}

textarea{ resize:vertical; }

.row{
  display:flex;
  gap:10px;
  align-items:center;
  flex-wrap:wrap;
}

.hr{
  height:1px;
  background:var(--line);
  border:0;
  margin:14px 0;
}

.mono{
  font-family:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono";
}

/* ===== 테이블(리스트/폼 공용) ===== */
.tbl{
  width:100%;
  border-collapse:separate;
  border-spacing:0;
  font-size:13px;
  table-layout:fixed; /* 컬럼 폭 흔들림 방지 */
}

/* 기본 셀 */
.tbl th,
.tbl td{
  border-bottom:1px solid var(--line);
  padding:12px 14px;
  vertical-align:middle;
}

/* 폼용 th 스타일 */
.tbl th{
  width:var(--thw);
  background:#1118270d;
  text-align:left;
  font-weight:800;
  white-space:nowrap;         /* 라벨 줄바꿈 방지 */
  overflow:hidden;
  text-overflow:ellipsis;
}

/* td 안의 컨텐츠가 잘 줄어들도록 */
.tbl td{ min-width:0; }
.tbl td > *{ min-width:0; }

/* 첫 행 위 라인 */
.tbl tbody tr:first-child th,
.tbl tbody tr:first-child td{
  border-top:1px solid var(--line);
}

/* hover는 리스트에서만 유용한데 폼에서 거슬리면 약하게 */
.tbl tr:hover td{
  background:#f9fafb;
}

/* th/td 비워두는 칸(메모 줄 오른쪽 빈칸 등) */
.th-muted{
  background:#1118270d;
}
.td-muted{
  background:#fff;
}

/* select 옆 summary는 줄바꿈 가능 */
.tbl td .summary{
  display:inline-block;
  margin-left:10px;
  white-space:normal;
}

/* ===== 버튼 ===== */
.btn{
  background:var(--primary);
  color:#fff;
  border:0;
  padding:10px 14px;
  border-radius:10px;
  cursor:pointer;
  font-weight:700;
  text-decoration:none;
  display:inline-flex;
  align-items:center;
  gap:6px;
}

.btn.primary{ background:#2563eb; }
.btn.primary:hover{ background:#1e40af; }

.btn.secondary{
  background:#1118270d;
  color:var(--text);
  border:1px solid var(--line);
}

.btn.ghost{
  background:transparent;
  color:var(--text);
  border:1px solid var(--line);
}

.btn.danger{ background:#ef4444; }

.btn.sm{
  padding:8px 10px;
  border-radius:10px;
  font-size:12px;
  font-weight:700;
}

/* ===== 하단 액션 ===== */
.form-actions{
  display:flex;
  justify-content:space-between;
  align-items:center;
  margin-top:24px;
  padding-top:16px;
  border-top:1px solid #e5e7eb;
}

.bottom-actions{
  display:flex;
  justify-content:flex-end;
  margin-top:16px;
}

/* ===== 알림/에러 ===== */
.toast{
  padding:10px 12px;
  border-radius:12px;
  border:1px solid #bbf7d0;
  background:#ecfdf5;
  color:#065f46;
  font-size:13px;
}

.alert{
  padding:10px 12px;
  border-radius:12px;
  border:1px solid #fecaca;
  background:#fff1f2;
  color:#991b1b;
  font-size:13px;
}

/* ===== 페이지네이션 (리스트) ===== */
.pagination{
  display:flex;
  gap:8px;
  justify-content:center;
  margin-top:16px;
  flex-wrap:wrap;
}

.page-btn{
  padding:8px 12px;
  border:1px solid var(--line);
  border-radius:10px;
  background:#fff;
  font-size:13px;
  color:var(--text);
  text-decoration:none;
  font-weight:700;
}

.page-btn:hover{ background:#f9fafb; }

.page-btn.active{
  background:var(--primary);
  color:#fff;
  border-color:var(--primary);
}

.page-btn.disabled{
  opacity:.5;
  pointer-events:none;
}

.pageinfo{
  font-size:13px;
  color:var(--muted);
  align-self:center;
  margin-left:8px;
}

/* ===== 반응형: 모바일에서는 1열(라벨 위, 입력 아래) ===== */
@media (max-width:1100px){
  .tbl, .tbl tbody, .tbl tr{ display:block; }
  .tbl tr{
    border:1px solid var(--line);
    border-radius:12px;
    overflow:hidden;
    margin-bottom:12px;
    background:#fff;
  }

  .tbl th, .tbl td{
    display:block;
    width:100%;
    border:0;
  }

  .tbl th{
    background:#1118270d;
    border-bottom:1px solid var(--line);
  }

  .tbl td{
    border-bottom:1px solid var(--line);
  }
  .tbl tr > td:last-child{ border-bottom:0; }
}

/* 헤더/본문 정렬 통일 */
.tbl th,
.tbl td{
  padding: 12px 14px;
  text-align: center;
  vertical-align: middle;
}

/* 텍스트 컬럼은 왼쪽 정렬이 더 자연스러우면(업체명/이메일 등) */
.tbl td.col-left,
.tbl th.col-left{
  text-align: left;
}

/* 헤더 링크 스타일 */
.th-link{
  color: inherit;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.th-link:hover{ text-decoration: underline; }

.sort-icon{
  font-size: 11px;
  opacity: .85;
}
