:root {
  --bg: #faf6f3;
  --surface: #ffffff;
  --ink: #3a2f2c;
  --muted: #8a7d78;
  --line: #ece2dc;
  --rose: #b0757b;
  --rose-deep: #8f5a60;
  --rose-soft: #f5e8e8;
  --green: #4f7d5e; --green-soft: #e6efe8;
  --amber: #a9772f; --amber-soft: #f6ecd9;
  --blue: #5b7ba0; --blue-soft: #e6edf4;
  --red: #a85a53; --red-soft: #f3e3e0;
  --gray: #8a7d78; --gray-soft: #efe9e5;
  --shadow: 0 1px 3px rgba(90,60,50,.08), 0 6px 18px rgba(90,60,50,.06);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Malgun Gothic', 'Apple SD Gothic Neo', sans-serif;
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
#app { max-width: 540px; margin: 0 auto; min-height: 100vh; }

/* 헤더 */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px;
  background: rgba(250,246,243,.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.topbar .brand { display: flex; align-items: center; gap: 9px; font-weight: 700; letter-spacing: -.2px; }
.topbar .brand img { width: 26px; height: 26px; border-radius: 7px; }
.topbar .who { font-size: 13px; color: var(--muted); }
.linkbtn { background: none; border: none; color: var(--rose-deep); font-size: 13px; font-weight: 600; cursor: pointer; padding: 6px 4px; }

.wrap { padding: 18px; padding-bottom: 48px; }

/* 카드 */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); padding: 18px; margin-bottom: 14px; }
.card h2 { margin: 0 0 12px; font-size: 15px; font-weight: 700; }
.section-title { font-size: 13px; font-weight: 700; color: var(--muted); text-transform: none; margin: 22px 4px 10px; letter-spacing: .2px; }

/* 잔여 회차 강조 */
.hero { text-align: center; background: linear-gradient(160deg, #fff, #fbeff0); border-color: #f0dcdd; }
.hero .big { font-size: 46px; font-weight: 800; color: var(--rose-deep); line-height: 1.1; letter-spacing: -1px; }
.hero .big small { font-size: 17px; font-weight: 700; color: var(--rose); margin-left: 3px; }
.hero .sub { color: var(--muted); font-size: 13px; margin-top: 2px; }

/* 회차권 pill */
.pkg { display: flex; justify-content: space-between; align-items: center; padding: 11px 0; border-top: 1px solid var(--line); }
.pkg:first-of-type { border-top: none; }
.pkg .t { font-weight: 600; }
.pkg .meta { font-size: 12.5px; color: var(--muted); }
.pkg .cnt { font-weight: 700; color: var(--rose-deep); }
.pkg.done { opacity: .55; }

/* 예약/제안 아이템 */
.appt { border: 1px solid var(--line); border-radius: 14px; padding: 14px; margin-bottom: 12px; background: var(--surface); }
.appt .row { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.appt .when { font-size: 16px; font-weight: 700; letter-spacing: -.2px; }
.appt .name { font-weight: 700; }
.appt .dur, .appt .phone { font-size: 12.5px; color: var(--muted); }
.appt .note { margin-top: 8px; font-size: 13.5px; color: #6a5c57; background: #faf5f2; border-radius: 9px; padding: 8px 10px; }

/* 상태 배지 */
.badge { display: inline-block; font-size: 11.5px; font-weight: 700; padding: 4px 9px; border-radius: 999px; white-space: nowrap; }
.b-amber { background: var(--amber-soft); color: var(--amber); }
.b-blue  { background: var(--blue-soft); color: var(--blue); }
.b-green { background: var(--green-soft); color: var(--green); }
.b-gray  { background: var(--gray-soft); color: var(--gray); }
.b-red   { background: var(--red-soft); color: var(--red); }

/* 타임라인 */
.timeline { margin-top: 10px; border-top: 1px dashed var(--line); padding-top: 10px; }
.tl { display: flex; gap: 8px; font-size: 12.5px; color: var(--muted); padding: 2px 0; }
.tl .dot { flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--rose); margin-top: 6px; }
.tl b { color: var(--ink); font-weight: 600; }

/* 버튼 */
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.btn { flex: 1 1 auto; min-width: 92px; text-align: center; border: none; border-radius: 11px; padding: 11px 12px; font-size: 14px; font-weight: 700; cursor: pointer; font-family: inherit; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--rose); color: #fff; }
.btn-primary:hover { background: var(--rose-deep); }
.btn-ghost { background: #fff; color: var(--rose-deep); border: 1.5px solid #e6cfd0; }
.btn-soft { background: var(--rose-soft); color: var(--rose-deep); }
.btn-danger { background: #fff; color: var(--red); border: 1.5px solid #e6cbc7; }
.btn-block { width: 100%; }
.btn-lg { padding: 14px; font-size: 15px; }
.btn:disabled { opacity: .5; cursor: default; }

/* 폼 */
label.fld { display: block; margin-bottom: 12px; }
label.fld span { display: block; font-size: 12.5px; font-weight: 600; color: var(--muted); margin-bottom: 5px; }
input, select, textarea {
  width: 100%; padding: 12px 13px; border: 1.5px solid var(--line); border-radius: 11px;
  font-size: 15px; font-family: inherit; color: var(--ink); background: #fff;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--rose); }
textarea { resize: vertical; min-height: 60px; }
.two { display: flex; gap: 10px; }
.two > * { flex: 1; }

/* 로그인 */
.login { min-height: 100vh; display: flex; flex-direction: column; justify-content: center; padding: 28px; }
.login .logo { text-align: center; margin-bottom: 22px; }
.login .logo img { width: 66px; height: 66px; border-radius: 18px; box-shadow: var(--shadow); }
.login h1 { text-align: center; font-size: 21px; margin: 14px 0 2px; }
.login .tag { text-align: center; color: var(--muted); font-size: 13px; margin-bottom: 22px; }
.segtabs { display: flex; background: var(--gray-soft); border-radius: 12px; padding: 4px; margin-bottom: 18px; }
.segtabs button { flex: 1; border: none; background: none; padding: 10px; border-radius: 9px; font-weight: 700; color: var(--muted); font-family: inherit; font-size: 14px; cursor: pointer; }
.segtabs button.on { background: #fff; color: var(--rose-deep); box-shadow: var(--shadow); }

/* 칩/필터 */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 10px; }
.chip { flex: none; border: 1.5px solid var(--line); background: #fff; color: var(--muted); border-radius: 999px; padding: 7px 14px; font-size: 13px; font-weight: 600; cursor: pointer; font-family: inherit; }
.chip.on { background: var(--rose); color: #fff; border-color: var(--rose); }
.chip .n { font-weight: 800; }

/* 요약 칩 */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 6px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 13px; padding: 12px 6px; text-align: center; box-shadow: var(--shadow); }
.stat .n { font-size: 22px; font-weight: 800; color: var(--rose-deep); line-height: 1; }
.stat .l { font-size: 11px; color: var(--muted); margin-top: 5px; }
.stat.alert .n { color: var(--amber); }

/* 고객 목록 */
.clist .item { display: flex; justify-content: space-between; align-items: center; padding: 13px 4px; border-top: 1px solid var(--line); cursor: pointer; }
.clist .item:first-child { border-top: none; }
.clist .item .nm { font-weight: 700; }
.clist .item .ph { font-size: 12.5px; color: var(--muted); }
.clist .item .rm { font-weight: 700; color: var(--rose-deep); font-size: 14px; }

/* 하단 탭바 */
.tabbar { position: sticky; bottom: 0; display: flex; background: rgba(255,255,255,.95); backdrop-filter: blur(8px); border-top: 1px solid var(--line); }
.tabbar button { flex: 1; border: none; background: none; padding: 12px 0 14px; font-family: inherit; font-size: 12.5px; font-weight: 700; color: var(--muted); cursor: pointer; }
.tabbar button.on { color: var(--rose-deep); }

/* 모달 */
.modal-bg { position: fixed; inset: 0; background: rgba(50,35,30,.4); display: flex; align-items: flex-end; justify-content: center; z-index: 50; }
.modal { background: var(--surface); width: 100%; max-width: 540px; border-radius: 20px 20px 0 0; padding: 20px 18px calc(20px + env(safe-area-inset-bottom)); max-height: 90vh; overflow-y: auto; }
.modal h3 { margin: 0 0 4px; font-size: 17px; }
.modal .msub { color: var(--muted); font-size: 13px; margin-bottom: 16px; }

.empty { text-align: center; color: var(--muted); padding: 30px 10px; font-size: 14px; }
.toast { position: fixed; left: 50%; bottom: 76px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 11px 18px; border-radius: 999px; font-size: 13.5px; font-weight: 600; z-index: 80; box-shadow: var(--shadow); max-width: 90%; }
.err { color: var(--red); font-size: 13px; margin-top: 8px; min-height: 18px; }
.spin { text-align: center; padding: 50px; color: var(--muted); }
