/* 되풀이해 쓰는 부품 — 카드 · 단추 · 상태 배지 · 알림 · 표 · 입력 · 도움말 · 펼침 메뉴 · 빈 상태. */

/* ---- 카드 -------------------------------------------------------------------------- */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 22px;
}
.page > .card + .card { margin-top: 16px; } /* 격자 안 카드에는 여백을 주지 않는다 */
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.card-head h2, .card-head h3 { font-size: 18px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.card-head .more { display: inline-flex; align-items: center; gap: 4px; font-size: 13.5px; font-weight: 700; text-decoration: none; }
.card.dashed { border-style: dashed; border-width: 1.5px; border-color: #cfd6e4; box-shadow: none; background: rgba(255,255,255,.7); }
.card.flat { box-shadow: none; }
.stack { display: grid; gap: 16px; align-content: start; }
.grid-2 { display: grid; gap: 16px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { display: grid; gap: 16px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 900px) { .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); } }

.tile {
  width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; flex: none;
}
.tile.blue { background: var(--tile-blue); color: var(--blue); }
.tile.green { background: var(--tile-green); color: var(--green); }
.tile.violet { background: var(--tile-violet); color: var(--violet); }
.tile.orange { background: var(--tile-orange); color: var(--orange); }
.tile.gray { background: var(--off-soft); color: var(--off); }

/* ---- 단추 -------------------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 16px; border-radius: 11px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  font-weight: 700; font-size: 14.5px; text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s, transform 0.05s;
}
.btn:hover { border-color: #c9d1e1; background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn.primary {
  background: linear-gradient(180deg, #3b68f3, var(--brand)); border-color: var(--brand); color: #fff;
  box-shadow: 0 8px 18px -10px rgba(47, 94, 240, 0.9);
}
.btn.primary:hover { background: var(--brand-strong); }
.btn.lg { min-height: 50px; padding: 0 22px; font-size: 15.5px; border-radius: 13px; }
.btn.sm { min-height: 36px; padding: 0 12px; font-size: 13.5px; border-radius: 9px; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.danger { color: var(--bad); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; pointer-events: none; }
.btn.is-pending { opacity: 0.75; cursor: progress; }
.btn.is-pending .i { animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.icon-btn {
  display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 8px;
  border: 1px solid transparent; background: transparent; color: var(--muted); cursor: pointer; padding: 0;
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.icon-btn.copied { color: var(--ok); }
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.actions > label { max-width: 100%; } /* 안의 긴 select 가 칸을 밀어내지 않게 */
.actions form { margin: 0; }

/* ---- 상태 배지 ---------------------------------------------------------------------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px;
  font-size: 13px; font-weight: 700; line-height: 1.4; white-space: nowrap;
  background: var(--off-soft); color: var(--off);
}
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }
.badge.plain::before { display: none; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.info { background: var(--brand-soft); color: var(--brand); }
.badge.soon { background: #fff7e8; color: #9a5b00; }
.badge.soon::before { display: none; }

/* ---- 도움말(?) ---------------------------------------------------------------------- */
.hint {
  position: relative; display: inline-grid; place-items: center; width: 22px; height: 22px; padding: 0;
  border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--muted);
  font: 700 12px var(--font); cursor: help; vertical-align: middle;
}
.hint:hover, .hint:focus-visible { color: var(--brand); border-color: var(--brand); }
.hint::after {
  content: attr(data-tip); position: absolute; z-index: 30; left: 50%; bottom: calc(100% + 8px);
  transform: translateX(-50%); width: max-content; max-width: 260px; padding: 8px 10px; border-radius: 9px;
  background: #121a2c; color: #fff; font: 500 12.5px/1.5 var(--font); text-align: left; white-space: normal;
  box-shadow: var(--shadow-lg); opacity: 0; pointer-events: none; transition: opacity 0.12s;
  display: none; /* 숨긴 말풍선이 가로 폭을 차지해 360~412px 홈 카드가 옆으로 넘쳤다(공통 목록 UI V2 시험에서 발견) */
}
.hint:hover::after, .hint:focus-visible::after { display: block; opacity: 1; }

/* ---- 알림(flash) ------------------------------------------------------------------- */
.flash {
  display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; margin: 0 0 16px;
  border-radius: 14px; border: 1px solid; background: var(--surface); box-shadow: var(--shadow);
}
.flash.ok { border-color: #bfe5cf; } .flash.ok > .i { color: var(--ok); }
.flash.bad { border-color: #f1c4bd; } .flash.bad > .i { color: var(--bad); }
.flash > div { min-width: 0; flex: 1; }
.flash pre {
  white-space: pre-wrap; font-size: 12.5px; max-height: 16rem; overflow: auto;
  background: var(--surface-2); padding: 10px; border-radius: 10px; margin: 8px 0 0;
}
.token {
  display: block; margin-top: 8px; padding: 10px 12px; border-radius: 10px;
  font-family: var(--mono); font-size: 13px; background: var(--warn-soft); word-break: break-all;
}
details.tech { margin-top: 10px; font-size: 13.5px; color: var(--muted); }
details.tech summary { cursor: pointer; min-height: 32px; display: flex; align-items: center; }

/* ---- 안내 띠 ------------------------------------------------------------------------ */
.notice {
  display: flex; gap: 14px; align-items: flex-start; padding: 16px 18px; border-radius: 14px;
  background: var(--brand-soft); border: 1px solid #d6e1ff; color: var(--ink-2); margin-bottom: 20px;
}
.notice > .i { color: var(--brand); margin-top: 2px; }
.notice.soon { background: #fffaf0; border-color: #f3dfb5; }
.notice.soon > .i { color: #b7791f; }
.notice strong { color: var(--ink); }

/* ---- 표 · 정보 목록 ----------------------------------------------------------------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line-2); font-size: 14px; vertical-align: middle; }
th { background: var(--surface-2); color: var(--muted); font-weight: 700; font-size: 13px; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
dl.kv { display: grid; grid-template-columns: 9rem minmax(0, 1fr); gap: 10px 16px; margin: 0; font-size: 14px; }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; }
@media (max-width: 640px) { dl.kv { grid-template-columns: minmax(0, 1fr); gap: 2px; } dl.kv dd { margin-bottom: 10px; } }

/* ---- 입력 -------------------------------------------------------------------------- */
.field { display: grid; gap: 6px; font-weight: 700; font-size: 13.5px; color: var(--ink-2); }
.field input, .field select, input.input {
  min-height: 44px; padding: 0 12px; border: 1px solid #cdd4e1; border-radius: 10px; background: var(--surface);
  font-weight: 500; font-size: 14.5px; width: 100%;
}
.field input:focus, .field select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-ring); }
.form-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.form-row .field { flex: 1 1 200px; }
.form-row .field.wide { flex: 3 1 360px; }

/* ---- 펼침 메뉴(…) ------------------------------------------------------------------- */
details.menu { position: relative; }
details.menu > summary { list-style: none; }
details.menu > summary::-webkit-details-marker { display: none; }
details.menu .menu-list {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 25; min-width: 220px; padding: 6px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg);
}
details.menu .menu-list a {
  display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 0 10px; border-radius: 8px;
  color: var(--ink); text-decoration: none; font-size: 14px; font-weight: 600;
}
details.menu .menu-list a:hover { background: var(--surface-2); }

/* ---- 빈 상태 ------------------------------------------------------------------------ */
.empty { display: grid; place-items: center; text-align: center; gap: 10px; padding: 36px 20px; color: var(--muted); }
.empty .tile { width: 60px; height: 60px; }
.empty h3 { color: var(--ink); font-size: 17px; }
.empty p { max-width: 420px; font-size: 14px; }

/* ---- 진행 단계 ---------------------------------------------------------------------- */
ol.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; counter-reset: step; }
ol.steps li { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 12px; align-items: start; counter-increment: step; }
ol.steps li::before {
  content: counter(step); width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  background: var(--brand-soft); color: var(--brand); font-weight: 800;
}
ol.steps b { display: block; margin-bottom: 2px; }
ol.steps p { color: var(--muted); font-size: 14px; }

/* V5 고객 첨부 사진 */
.review-att { display: flex; align-items: center; gap: 8px; margin: 4px 0; }
.review-att img { width: 96px; height: 72px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); }

/* V5 고객 홈페이지 운영 상태 */
.ops-row { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 2px 10px; margin: 6px 0 10px; }
.ops-row dt { color: var(--muted); }
.ops-row dd { margin: 0; }

.handover h2 { margin: 18px 0 8px; font-size: 17px; }
.handover h2:first-child { margin-top: 0; }
.handover ol { display: grid; gap: 6px; padding-left: 20px; }
@media print {
  .side, .topbar, .no-print, .scrim, .flash { display: none !important; }
  .main, .content, body { margin: 0 !important; padding: 0 !important; background: #fff !important; }
  .card { box-shadow: none !important; border: 0 !important; }
}

/* 켜고 끄는 설정 칸의 저장 상태 */
.save-state { color: var(--muted); }
.save-state.ok { color: var(--ok); font-weight: 700; }
.save-state.bad { color: var(--bad); font-weight: 700; }
form[aria-busy="true"] label { opacity: .7; }

/* 공통 목록 UI V2 — 검색 · 필터 · 표시 개수(website_builder/paging.py) */
.list-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 16px; }
.list-tools input, .list-tools select {
  min-height: 36px; padding: 0 10px; border: 1px solid var(--line); border-radius: 9px;
  background: var(--surface); color: var(--ink); font: inherit; font-size: 14px;
}
.list-tools .list-q { flex: 1 1 220px; max-width: 360px; }
.list-tools .list-q input { width: 100%; }
.list-tools input:focus, .list-tools select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-ring); }
.list-tools .list-actions { display: inline-flex; gap: 6px; }
.list-total { margin: -6px 0 12px; font-weight: 700; font-size: 14.5px; color: var(--ink); }
@media (max-width: 640px) {
  .list-tools .list-q { flex-basis: 100%; max-width: none; }
  .list-tools .list-filter { flex: 1 1 140px; } .list-tools .list-filter select { width: 100%; }
  .list-tools .list-actions { flex: 1 1 100%; } .list-tools .list-actions .btn { flex: 1 1 0; }
}
/* 번호 버튼 — 테두리 · 간격 있는 버튼, 현재 쪽 강조, [‹] 이전 묶음 · [더보기 ›] 다음 묶음 */
.pager { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 6px; margin: 22px 0 6px; padding: 0; }
.pager-btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 40px; min-height: 40px; padding: 0 12px; border-radius: 9px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-2);
  font-weight: 700; font-size: 14px; text-decoration: none;
}
.pager-btn:hover { border-color: var(--brand); color: var(--brand); }
.pager-btn[aria-current="page"] { background: var(--brand); border-color: var(--brand); color: #fff; }
.pager-btn:focus-visible { outline: 3px solid var(--brand-ring); outline-offset: 2px; }
.pager-more { padding: 0 14px; }
.pager-prev { font-size: 18px; padding: 0 13px; }
