/* ===== Reset & Base ===== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --primary: #16a34a;
  --primary-dark: #15803d;
  --primary-light: #dcfce7;
  --ink: #111827;
  --ink-soft: #4b5563;
  --ink-muted: #9ca3af;
  --bg: #ffffff;
  --bg-gray: #f6f8f7;
  --line: #e5e7eb;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(17, 24, 39, 0.08);
  --header-h: 68px;
}

body {
  font-family: "Pretendard", "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; }
a { text-decoration: none; color: inherit; }
ul, li { list-style: none; }
button { font-family: inherit; cursor: pointer; }
input, select { font-family: inherit; }

/* display 를 지정한 요소에도 hidden 속성이 먹도록 */
[hidden] { display: none !important; }

.container {
  width: 100%;
  max-width: 1140px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 11px 20px;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  border: 1px solid transparent;
  transition: all 0.2s ease;
  white-space: nowrap;
}
.btn--primary { background: var(--primary); color: #fff; }
.btn--primary:hover { background: var(--primary-dark); transform: translateY(-1px); }
.btn--ghost { padding: 7px 14px; font-size: 14px; background: #fff; border-color: var(--line); color: var(--ink-soft); }
.btn--ghost:hover { border-color: var(--ink-muted); }
.btn--lg { padding: 15px 28px; font-size: 17px; border-radius: 12px; }
.btn--block { width: 100%; }
.btn--kakao { background: #fee500; color: #191919; }
.btn--kakao:hover { background: #fdd800; transform: translateY(-1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn:disabled:hover { transform: none; }
.kakao-icon { width: 20px; height: 20px; flex-shrink: 0; }

/* ===== Header ===== */
.header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-h);
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 2px 12px rgba(0,0,0,0.04);
  z-index: 100;
}
.header__inner {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.logo { display: flex; align-items: center; gap: 10px; font-size: 20px; font-weight: 800; }
.logo__img { width: 36px; height: 36px; border-radius: 9px; object-fit: cover; }
.logo__text em { font-style: normal; color: var(--primary); }

.header__actions { display: flex; align-items: center; gap: 8px; }
.header__user { display: flex; align-items: center; gap: 14px; }
.header__email {
  font-size: 14px;
  color: var(--ink-soft);
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.header__logout {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 7px 14px; border: 1px solid var(--line); border-radius: 8px;
  background: #fff; font-size: 14px; font-weight: 600; color: var(--ink-muted);
  white-space: nowrap; transition: border-color 0.2s, color 0.2s;
}
.header__logout:hover { border-color: var(--ink-muted); color: var(--ink); }

/* ===== 관리자 탭 (페이지 이동) ===== */
.tabs { display: flex; gap: 8px; margin-top: 20px; border-bottom: 1px solid var(--line); }
.tab {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  padding: 12px 16px; background: none; border: none;
  font-size: 15px; font-weight: 700; color: var(--ink-muted); transition: color 0.2s;
}
.tab:hover { color: var(--ink-soft); }
.tab.is-active { color: var(--primary); }
.tab.is-active::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px;
  height: 2px; background: var(--primary); border-radius: 2px;
}

/* ===== 목록 페이지 공통 ===== */
.page { padding: calc(var(--header-h) + 28px) 0 60px; }
.page__head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; }
.page__title { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; }
.page__count { font-size: 14px; color: var(--ink-soft); white-space: nowrap; }
.page__count strong { font-weight: 800; color: var(--primary); }

.toolbar { display: flex; align-items: center; justify-content: flex-end; gap: 10px; margin: 20px 0 10px; min-height: 34px; }
.toolbar__label { font-size: 14px; color: var(--ink-soft); }
.select {
  padding: 7px 12px; border: 1px solid var(--line); border-radius: 8px;
  background: #fff; font-size: 14px; font-weight: 600; color: var(--ink-soft); cursor: pointer;
}

/* 테이블 */
.tablewrap { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.tablescroll { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; min-width: 860px; }
.table th { padding: 15px 18px; text-align: left; font-size: 13px; font-weight: 700; color: var(--ink-muted); background: #fafbfc; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 16px 18px; font-size: 15px; color: var(--ink); border-bottom: 1px solid #f1f3f5; vertical-align: middle; white-space: nowrap; }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: #fbfdfc; }
.table th.is-num, .table td.is-num { text-align: right; }

.cell-email { font-weight: 600; }
.cell-phone { font-weight: 700; letter-spacing: 0.01em; }
.cell-muted { color: var(--ink-muted); }

.link { color: var(--primary-dark); font-weight: 700; text-decoration: underline; }
.link:hover { color: var(--primary); }

.msg { padding: 48px 20px; text-align: center; color: var(--ink-muted); font-size: 15px; }

.pager { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 24px; }
.pager__info { font-size: 14px; color: var(--ink-soft); min-width: 84px; text-align: center; }
.pager .btn[disabled] { opacity: 0.4; pointer-events: none; }

/* 상태 변경 셀렉트 */
.status-select {
  padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px;
  background: #fff; font-size: 14px; font-weight: 700; color: var(--ink); cursor: pointer;
  transition: border-color 0.2s, opacity 0.2s;
}
.status-select:hover:not(:disabled) { border-color: var(--ink-muted); }
.status-select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }
.status-select:disabled { opacity: 0.6; cursor: not-allowed; }
.status-select.is-saved { border-color: var(--primary); }

/* 전화번호 칩 - 모바일은 전화 걸기, PC 는 복사 */
.phones { display: flex; flex-wrap: wrap; gap: 6px; }
.phone-chip {
  padding: 5px 10px; border: 1px solid var(--line); border-radius: 8px;
  background: #fff; font-size: 14px; font-weight: 700; color: var(--ink);
  letter-spacing: 0.01em; white-space: nowrap;
  transition: border-color 0.2s, background 0.2s, color 0.2s;
}
.phone-chip:hover { border-color: var(--primary); color: var(--primary-dark); }
.phone-chip.is-copied { background: var(--primary); border-color: var(--primary); color: #fff; }

/* URL / 전화번호처럼 긴 값은 줄바꿈을 허용한다. */
.table td.cell-wrap { white-space: normal; word-break: break-all; min-width: 200px; }

/* ===== 로그인 ===== */
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; background: var(--bg-gray); }
.login__box {
  width: 100%; max-width: 400px; padding: 40px 32px; text-align: center;
  background: #fff; border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow);
}
.login__logo { width: 56px; height: 56px; border-radius: 14px; object-fit: cover; }
.login__title { margin-top: 16px; font-size: 22px; font-weight: 800; letter-spacing: -0.02em; }
.login__title em { font-style: normal; color: var(--primary); }
.login__desc { margin: 8px 0 26px; font-size: 14.5px; color: var(--ink-soft); }
.login__msg { margin-top: 16px; font-size: 13.5px; line-height: 1.5; color: #dc2626; }

/* ===== 모바일 ===== */
@media (max-width: 720px) {
  .header .logo__text { display: none; }
  .header__actions { margin-left: auto; }
  .header__user { gap: 8px; }
  .header__email { max-width: 150px; font-size: 13px; }

  .page { padding: calc(var(--header-h) + 18px) 0 48px; }
  .page__head { flex-direction: column; align-items: flex-start; gap: 4px; }
  .page__title { font-size: 20px; }

  .tabs { gap: 0; margin-top: 14px; }
  .tab { flex: 1; padding: 12px 4px; font-size: 14px; }

  .toolbar { margin: 14px 0 10px; min-height: 0; }

  /* 테이블 -> 카드 */
  .tablewrap { background: none; border: none; border-radius: 0; overflow: visible; }
  .tablescroll { overflow: visible; }
  .table { display: block; min-width: 0; }
  .table thead { display: none; }
  .table tbody { display: grid; gap: 10px; }
  .table tbody tr { display: block; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 4px 16px 8px; }
  .table tbody tr:hover { background: #fff; }
  .table td, .table tbody tr:last-child td {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 11px 0; font-size: 14px; text-align: right; white-space: normal;
    border-bottom: 1px solid #f4f5f7;
  }
  .table tbody tr td:last-child { border-bottom: none; }
  .table td::before { content: attr(data-label); flex-shrink: 0; font-size: 13px; font-weight: 600; color: var(--ink-muted); }
  .table td.cell-wrap { min-width: 0; text-align: right; }
  .table td .phones { justify-content: flex-end; }

  .msg { padding: 40px 16px; background: #fff; border: 1px solid var(--line); border-radius: 12px; }
  .pager { gap: 8px; margin-top: 18px; }
}
