/* 공통 스타일. 관리자 화면은 태블릿·PC, 고객 화면은 휴대폰 기준 */
:root {
  --bg: #f6f4f2;
  --card: #ffffff;
  --text: #2b2724;
  --muted: #7a726c;
  --line: #e4ded8;
  --accent: #9b5c6b;
  --accent-dark: #7e4655;
  --error-bg: #fbeaea;
  --error: #a33a3a;
  --info-bg: #eef4ef;
  --info: #2f6b3c;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 -apple-system, "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", sans-serif;
}
a { color: var(--accent); }
h1 { font-size: 1.4rem; margin: 0 0 1rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }

/* 상단 바 */
.topbar {
  display: flex; align-items: center; gap: 1.5rem; flex-wrap: wrap;
  padding: .75rem 1.25rem; background: var(--card); border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; color: var(--text); text-decoration: none; }
.menu { display: flex; gap: 1rem; flex: 1; }
.menu a { text-decoration: none; padding: .25rem 0; }
.who { display: flex; align-items: center; gap: .75rem; color: var(--muted); font-size: .9rem; }
.who form { margin: 0; }

.container { max-width: 1100px; margin: 0 auto; padding: 1.25rem; }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  padding: 1.5rem; margin-bottom: 1rem;
}
.card.narrow { max-width: 420px; margin: 2rem auto; }

/* 폼 */
label { display: block; margin-bottom: 1rem; font-weight: 600; font-size: .95rem; }
input, select, textarea {
  display: block; width: 100%; margin-top: .35rem; padding: .65rem .75rem;
  font: inherit; border: 1px solid var(--line); border-radius: 8px; background: #fff;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); border-color: transparent; }

button { font: inherit; cursor: pointer; }
button.primary {
  width: 100%; padding: .75rem; border: 0; border-radius: 8px;
  background: var(--accent); color: #fff; font-weight: 600;
}
button.primary:hover { background: var(--accent-dark); }
button.link { border: 0; background: none; padding: 0; color: var(--accent); text-decoration: underline; }

.row-between { display: flex; justify-content: space-between; align-items: center; margin-top: 1rem; }
.row-between form { margin: 0; }

/* 알림 메시지 */
.flash { padding: .75rem 1rem; border-radius: 8px; margin-bottom: 1rem; }
.flash-error { background: var(--error-bg); color: var(--error); }
.flash-info { background: var(--info-bg); color: var(--info); }

h2 { font-size: 1.1rem; margin: 1.25rem 0 .75rem; }
h2:first-child { margin-top: 0; }
.card.medium { max-width: 720px; }
.row-between.head { margin: 0 0 .5rem; }
.row-between.head h1 { margin: 0; }
.warn { color: var(--error); }

/* 버튼 모양 링크·보조 버튼 */
a.button, button.secondary {
  display: inline-block; padding: .55rem 1rem; border-radius: 8px; font-weight: 600;
  text-decoration: none; white-space: nowrap;
}
a.button { background: var(--accent); color: #fff; }
a.button.secondary { background: #fff; color: var(--accent); border: 1px solid var(--accent); }
button.secondary { background: #fff; color: var(--accent); border: 1px solid var(--accent); }
button.primary.auto { width: auto; padding: .65rem 2rem; }

/* 폼 배치 */
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }
form.inline { display: flex; gap: .5rem; align-items: center; }
form.inline input { margin: 0; flex: 1; }
form.inline select { width: auto; margin: 0; flex: none; }
label.check { display: flex; align-items: center; gap: .5rem; font-weight: 400; }
label.check input { width: auto; margin: 0; }
.checks { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 1rem; }
small { display: block; font-weight: 400; margin-top: .25rem; }

/* 비밀번호 보기/가리기 (static/password-toggle.js 가 input[type=password]에 자동 적용) */
.pw-wrap { position: relative; display: block; margin-top: .35rem; }
.pw-wrap input { margin-top: 0; padding-right: 2.75rem; }
.pw-toggle {
  position: absolute; top: 0; right: 0; bottom: 0; width: 2.75rem;
  display: flex; align-items: center; justify-content: center;
  border: 0; background: none; color: var(--muted); padding: 0; border-radius: 0 8px 8px 0;
}
.pw-toggle:hover, .pw-toggle[aria-pressed="true"] { color: var(--accent); }
.pw-toggle:focus-visible { outline: 2px solid var(--accent); }
form.inline .pw-wrap { flex: 1; margin: 0; }

/* 목록 표 */
.table-wrap { overflow-x: auto; }
table.list { width: 100%; border-collapse: collapse; }
table.list th, table.list td { padding: .6rem .5rem; border-bottom: 1px solid var(--line); text-align: left; }
table.list th { color: var(--muted); font-weight: 600; font-size: .9rem; }
table.list .num { text-align: right; }
table.list tr.off td { color: var(--muted); }

/* 고객 화면 (휴대폰 기준) */
body.customer { min-height: 100vh; display: flex; flex-direction: column; }
.c-head {
  padding: .9rem 1rem; text-align: center; font-weight: 700;
  background: var(--card); border-bottom: 1px solid var(--line);
}
.c-main { flex: 1; width: 100%; max-width: 480px; margin: 0 auto; padding: 1rem; }
.c-main .card { padding: 1.25rem; }
.c-main button.primary { padding: .9rem; font-size: 1.05rem; }
button[disabled] { opacity: .5; cursor: not-allowed; }
.c-foot { text-align: center; padding: 1.5rem 1rem 2rem; font-size: .8rem; }
.c-foot a, .c-foot button.link { color: var(--muted); }
.c-tabs { display: flex; gap: .5rem; margin-bottom: 1rem; }
.c-tabs a {
  flex: 1; text-align: center; padding: .6rem; border-radius: 8px; text-decoration: none;
  border: 1px solid var(--line); background: var(--card); color: inherit;
}
.c-tabs a.on { border-color: var(--accent); color: var(--accent); font-weight: 700; }
.c-resend { display: flex; justify-content: space-between; align-items: center; margin-top: 1rem; }

/* 고객 화면(A03~A05) */
.pager { display: flex; gap: 1rem; justify-content: center; }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; }
/* A05 동의 기록: 광고성 수신 상태 글자와 작은 철회·다시 동의 버튼을 한 줄 가운데 맞춤 */
.consent-status { align-items: center; gap: .75rem; margin: .25rem 0 .5rem; }
.consent-status form { margin: 0; }
.consent-status a.button, .consent-status button { padding: .3rem .8rem; font-size: .9rem; line-height: 1.4; }
.balance { font-size: 1.25rem; }
.memo { white-space: pre-wrap; }
dialog.dup {
  width: min(28rem, calc(100vw - 2rem)); padding: 1.5rem;
  border: 1px solid var(--line); border-radius: 10px;
}
dialog.dup h2 { margin-top: 0; }
.dup-actions { display: grid; gap: .5rem; margin-top: 1.25rem; }
.dup-actions .button, .dup-actions button {
  width: 100%; padding: .7rem 1rem; text-align: center; white-space: normal;
}
dialog.dup::backdrop { background: rgba(0, 0, 0, .4); }

@media (max-width: 600px) {
  .grid2, .checks { grid-template-columns: 1fr; }
  .topbar { gap: .75rem; }
  .container { padding: 1rem; }
  .card.narrow { margin: 1rem auto; }
}

/* ---- A06~A08 충전·시술·취소 ---- */
fieldset.plain { border: 0; padding: 0; margin: 0 0 1rem; }
fieldset.plain legend { font-weight: 600; font-size: .95rem; margin-bottom: .35rem; }
label.check.inline-check { display: inline-flex; margin: 0 1.25rem .5rem 0; }
table.list.confirm { margin-bottom: 1rem; }
table.list.confirm th { width: 9rem; }
table.list .big { font-size: 1.1rem; }
/* C04 임시 링크 조회 (휴대폰 기준) */
.c-balance { font-size: 1.1rem; margin: .25rem 0 1rem; }
.c-balance b { font-size: 1.6rem; display: block; }
.c-facts { display: grid; grid-template-columns: auto 1fr; gap: .4rem 1rem; margin: 0; }
.c-facts dd { margin: 0; text-align: right; }
.c-history { list-style: none; padding: 0; margin: 0; }
.c-history li { padding: .7rem 0; border-bottom: 1px solid var(--line); }
.c-history .row-between { margin-top: 0; }
.c-history li.off { color: var(--muted); text-decoration: line-through; }
.right { text-align: right; }

/* 대시보드·통계 */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: .75rem; margin: .75rem 0; }
.kpi { border: 1px solid var(--line); border-radius: 8px; padding: .75rem 1rem; }
.kpi .label { color: var(--muted); font-size: .85rem; }
.kpi .value { font-size: 1.35rem; font-weight: 700; margin-top: .15rem; }
.kpi .sub { color: var(--muted); font-size: .8rem; margin-top: .15rem; }
.kpi.liability { border-width: 2px; }
.stats-head { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: center; }
.csv-links { display: flex; flex-wrap: wrap; gap: .4rem .8rem; font-size: .85rem; margin: .25rem 0 .75rem; }
.check-ok { color: #1a7f37; font-weight: 600; }
.check-bad { color: #b42318; font-weight: 600; }
