:root {
  --navy: #0c1f33;
  --navy-2: #16324f;
  --brand: #1c4e8a;
  --brand-2: #163f70;
  --brand-grad: linear-gradient(180deg, #235a9c, #1a4880);
  --brand-soft: #eaf0f7;
  --bg: #f4f5f7;
  --card: #ffffff;
  --ink: #18222e;
  --ink-2: #475462;
  --muted: #8b95a2;
  --line: #edeff3;
  --line-2: #dfe3e9;
  --ok: #1a8f56;
  --ok-soft: #eaf5ef;
  --warn: #b87a26;
  --danger: #c9483f;
  --gold-bg: #182536;
  --gold-fg: #e3c489;
  --r-sm: 10px; --r: 14px; --r-lg: 18px;
  --sh-1: 0 1px 2px rgba(16,30,54,.05);
  --sh-2: 0 2px 10px rgba(16,30,54,.05), 0 1px 2px rgba(16,30,54,.04);
  --sh-3: 0 10px 34px rgba(16,30,54,.10);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: "Pretendard Variable", "Pretendard", -apple-system, BlinkMacSystemFont, "Segoe UI", "Malgun Gothic", system-ui, sans-serif;
  background: var(--bg); color: var(--ink); font-size: 15px; line-height: 1.5;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  letter-spacing: -0.01em;
}
.hidden { display: none !important; }
.muted { color: var(--muted); }
.err { color: var(--danger); font-size: 13px; min-height: 16px; margin: 4px 0 0; }
button { font: inherit; border: none; cursor: pointer; background: none; color: inherit; }
button:active { transform: translateY(.5px); }
input, textarea {
  font: inherit; width: 100%; padding: 12px 13px; border: 1px solid var(--line-2);
  border-radius: var(--r-sm); background: #fff; color: var(--ink); outline: none; transition: border-color .12s, box-shadow .12s;
}
input::placeholder, textarea::placeholder { color: #aab2bd; }
input:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
svg { display: block; }
.tnum { font-variant-numeric: tabular-nums; }

/* ===== 상단바 ===== */
.appbar {
  display: flex; align-items: center; gap: 12px; height: 60px; padding: 0 22px;
  background: rgba(255,255,255,.85); backdrop-filter: saturate(1.4) blur(8px);
  border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 30;
}
.brand { display: flex; align-items: center; gap: 9px; font-weight: 800; color: var(--navy); font-size: 16px; letter-spacing: -.3px; cursor: pointer; }
.brand .gem { width: 22px; height: 22px; }
.brand .sep { width: 1px; height: 16px; background: var(--line-2); margin: 0 3px; }
.brand .sub { font-weight: 700; color: var(--muted); font-size: 12px; letter-spacing: .14em; }
.appbar .spacer { flex: 1; }
.appbar .staff { display: flex; align-items: center; gap: 8px; color: var(--ink-2); font-size: 14px; font-weight: 600; }
.appbar .staff .av { width: 28px; height: 28px; border-radius: 50%; background: var(--brand-soft); display: grid; place-items: center; color: var(--brand); }
.linkbtn { font-size: 13px; color: var(--muted); font-weight: 600; padding: 8px; border-radius: 8px; }
.linkbtn:hover { color: var(--ink); background: var(--bg); }

/* ===== 로그인 ===== */
.login-screen { min-height: 100dvh; display: grid; place-items: center; padding: 24px; background:
  radial-gradient(1200px 500px at 50% -10%, #eaf1fc, transparent), var(--bg); }
.login-box { width: 100%; max-width: 330px; text-align: center; }
.login-box .gem { width: 44px; height: 44px; margin: 0 auto 16px; }
.login-box h1 { font-size: 20px; margin: 0; color: var(--navy); font-weight: 800; }
.login-box p { margin: 6px 0 20px; color: var(--muted); }
.login-box input { text-align: center; letter-spacing: 8px; font-size: 20px; padding: 14px; }
.login-box button { width: 100%; margin-top: 12px; background: var(--brand-grad); color: #fff; padding: 13px; border-radius: var(--r-sm); font-weight: 700; font-size: 15px; box-shadow: var(--sh-2); }
.login-box button:hover { filter: brightness(1.08); }

/* ===== 랜딩: 구매액 순 고객 ===== */
.landing { max-width: 760px; margin: 0 auto; padding: 28px 20px 60px; }
.landing-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 4px; }
.landing-head h1 { font-size: 22px; font-weight: 800; color: var(--navy); margin: 0; }
.landing-head .cnt { color: var(--muted); font-size: 14px; font-weight: 600; }
.landing-sub { color: var(--muted); font-size: 13.5px; margin: 0 0 18px; }
.landing-tools { display: flex; gap: 10px; margin-bottom: 18px; }
.landing-tools .search-box { flex: 1; }
.btn-primary { background: var(--brand-grad); color: #fff; font-weight: 700; padding: 0 18px; border-radius: var(--r-sm); white-space: nowrap; box-shadow: var(--sh-2); }
.btn-primary:hover { filter: brightness(1.08); }

.rank-list { display: flex; flex-direction: column; gap: 10px; }
.rank-row {
  display: flex; align-items: center; gap: 14px; background: var(--card);
  border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px;
  box-shadow: var(--sh-1); cursor: pointer; transition: box-shadow .14s, transform .14s, border-color .14s;
}
.rank-row:hover { box-shadow: var(--sh-3); transform: translateY(-1px); border-color: var(--line-2); }
.rank-no { width: 26px; text-align: center; font-weight: 800; font-size: 16px; color: var(--muted); flex: none; }
.rank-row:nth-child(1) .rank-no { color: #c79a2e; }
.rank-row:nth-child(2) .rank-no { color: #8a97a6; }
.rank-row:nth-child(3) .rank-no { color: #b07a4e; }
.r-av { width: 46px; height: 46px; border-radius: 50%; flex: none; display: grid; place-items: center; font-weight: 800; font-size: 17px; color: #fff; }
.r-main { flex: 1; min-width: 0; }
.r-name { display: flex; align-items: center; gap: 7px; font-weight: 700; font-size: 16px; }
.r-sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.r-amt { text-align: right; flex: none; }
.r-amt b { font-size: 17px; color: var(--navy); font-weight: 800; }
.r-amt span { display: block; font-size: 11px; color: var(--muted); margin-top: 1px; }

.tier { font-size: 11px; font-weight: 800; padding: 2px 8px; border-radius: 999px; letter-spacing: .03em; line-height: 1.5; }
.tier.vip { background: var(--gold-bg); color: var(--gold-fg); }
.tier.reg { background: var(--brand-soft); color: var(--brand); }

/* ===== 워크스페이스 3분할 ===== */
.workspace { display: grid; grid-template-columns: 312px minmax(0,1fr) 360px; gap: 18px; max-width: 1320px; margin: 0 auto; padding: 18px 20px 60px; align-items: start; }
.pane { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--sh-2); overflow: hidden; }
.pane-head { padding: 18px 20px 0; font-size: 12px; font-weight: 800; color: var(--muted); letter-spacing: .08em; text-transform: uppercase; }
.pane-body { padding: 18px 20px; }
.crumb { max-width: 1320px; margin: 0 auto; padding: 16px 20px 0; }
.crumb button { font-size: 13.5px; color: var(--brand); font-weight: 700; display: inline-flex; align-items: center; gap: 5px; }

/* ----- 고객 프로필 (왼쪽) ----- */
.profile { padding: 22px 20px 20px; text-align: center; }
.profile .av { width: 72px; height: 72px; border-radius: 50%; margin: 0 auto 14px; display: grid; place-items: center; color: #fff; font-size: 26px; font-weight: 800; box-shadow: var(--sh-2); }
.profile .name-row { display: flex; align-items: center; justify-content: center; gap: 8px; }
.profile h2 { margin: 0; font-size: 20px; font-weight: 800; }
.profile .phone { color: var(--ink-2); margin-top: 5px; font-size: 14px; }
.quick { display: flex; gap: 8px; margin: 18px 0 16px; }
.quick button { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 4px; border: 1px solid var(--line-2); border-radius: 12px; color: var(--ink-2); font-size: 12px; font-weight: 600; transition: all .12s; }
.quick button:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); }
.quick svg { width: 19px; height: 19px; }
.cust-stats { display: flex; border: 1px solid var(--line-2); border-radius: 14px; overflow: hidden; }
.cust-stats > div { flex: 1; text-align: center; padding: 14px 6px; }
.cust-stats > div + div { border-left: 1px solid var(--line-2); }
.cust-stats b { display: block; font-size: 20px; color: var(--navy); font-weight: 800; }
.cust-stats span { font-size: 11px; color: var(--muted); font-weight: 600; }

/* ----- 구매 사이즈 집계 ----- */
.size-sum { margin: 18px 20px 0; }
.ss-title { font-size: 12px; font-weight: 800; color: var(--muted); letter-spacing: .08em; text-transform: uppercase; margin-bottom: 9px; }
.ss-chips { display: flex; flex-wrap: wrap; gap: 7px; }
.ss-chip { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 800; color: var(--ink); background: #fff; border: 1px solid var(--line-2); border-radius: 10px; padding: 7px 11px; }
.ss-chip b { font-size: 12px; font-weight: 700; color: var(--muted); }
.ss-chip.top { background: var(--navy); border-color: var(--navy); color: #fff; }
.ss-chip.top b { color: #b9c6d6; }
.ss-empty { font-size: 13px; color: var(--muted); }

/* ----- 메모 (노트 형식) ----- */
.notes { }
.notes-head { display: flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 800; color: var(--muted); letter-spacing: .08em; text-transform: uppercase; margin-bottom: 10px; }
.notes-head svg { width: 15px; height: 15px; color: var(--brand); }
.note-add { margin-bottom: 12px; }
.note-add textarea { min-height: 56px; resize: vertical; line-height: 1.55; font-size: 14px; background: #fffdf6; border-color: #ece7d6; }
.note-add textarea:focus { background: #fff; }
.note-add-btn { width: 100%; margin-top: 8px; padding: 10px; border-radius: 10px; background: var(--brand-soft); color: var(--brand); font-weight: 800; font-size: 13.5px; }
.note-add-btn:hover { background: #dfe9f8; }
.note-list { display: flex; flex-direction: column; gap: 10px; }
.note-card { background: #fffdf5; border: 1px solid #efe9d8; border-left: 3px solid #d8b85a; border-radius: 10px; padding: 11px 13px; box-shadow: var(--sh-1); }
.note-card .nc-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 5px; }
.note-card .nc-date { font-size: 11.5px; font-weight: 700; color: #a08a4e; font-variant-numeric: tabular-nums; }
.note-card .nc-del { font-size: 11.5px; color: var(--muted); font-weight: 600; }
.note-card .nc-del:hover { color: var(--danger); }
.note-card .nc-body { font-size: 14.5px; line-height: 1.6; color: var(--ink); white-space: pre-wrap; word-break: break-word; }
.note-empty { font-size: 13px; color: var(--muted); padding: 6px 2px; }

/* ----- 메모 섹션 (직관적 분리) ----- */
.memo-sec { margin: 18px 20px 0; border-top: 1px solid var(--line); padding-top: 18px; }
.memo-block { background: #fafbfc; border: 1px solid var(--line); border-radius: 14px; padding: 14px; margin-bottom: 12px; }
.memo-block.pref { background: var(--brand-soft); border-color: #dbe7fb; }
.memo-block .mb-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.memo-block .mb-title { display: flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 800; color: var(--ink); }
.memo-block .mb-title svg { width: 15px; height: 15px; color: var(--brand); }
.memo-block .mb-edit { font-size: 12px; color: var(--brand); font-weight: 700; }
.memo-block .mb-text { font-size: 13.5px; color: var(--ink-2); white-space: pre-wrap; }
.memo-block .mb-empty { font-size: 13px; color: var(--muted); }
/* 상담/피팅 타임라인 */
.note-time { display: flex; flex-direction: column; gap: 10px; }
.note-item { display: flex; gap: 11px; }
.note-item .nbadge { flex: none; font-size: 11px; font-weight: 800; padding: 3px 8px; border-radius: 999px; height: fit-content; }
.nbadge.t관심 { background: #eaf4ff; color: #1f6fd1; }
.nbadge.t피팅 { background: #fff2e0; color: #c77b1a; }
.nbadge.t추천 { background: #eef7ee; color: #2f9b53; }
.nbadge.t구매 { background: #eef0f3; color: #55606e; }
.nbadge.t기타 { background: #eef0f3; color: #55606e; }
.note-item .ntext { font-size: 13px; color: var(--ink-2); }
.note-item .nmeta { font-size: 11.5px; color: var(--muted); margin-top: 2px; }

/* ----- 중앙: 검색/이력 ----- */
.search-wrap { padding: 16px 20px 0; }
.search-box { position: relative; }
.search-box > svg { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--muted); }
.search-box input { padding-left: 40px; height: 46px; border-radius: 12px; }
.seg { display: flex; gap: 4px; margin: 14px 20px 0; background: var(--bg); padding: 4px; border-radius: 11px; }
.seg button { flex: 1; padding: 9px; border-radius: 8px; font-size: 13.5px; font-weight: 700; color: var(--muted); }
.seg button.on { background: #fff; color: var(--navy); box-shadow: var(--sh-1); }
.result-count { padding: 14px 20px 2px; font-size: 12.5px; color: var(--muted); font-weight: 600; }

/* ----- 구매이력 아코디언 (날짜별) ----- */
.acc { padding: 10px 16px 18px; display: flex; flex-direction: column; gap: 10px; }
.acc-item { border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: #fff; box-shadow: var(--sh-1); }
.acc-head { width: 100%; display: flex; align-items: center; justify-content: space-between; padding: 15px 16px; cursor: pointer; }
.acc-head:hover { background: #fafbfc; }
.acc-date { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; }
.ad-day { font-weight: 800; font-size: 15px; color: var(--navy); }
.ad-sub { font-size: 12px; color: var(--muted); font-weight: 600; }
.acc-right { display: flex; align-items: center; gap: 12px; }
.acc-sum { font-weight: 800; font-size: 15px; color: var(--navy); }
.acc-chev { width: 18px; height: 18px; color: var(--muted); transition: transform .18s ease; }
.acc-item.open .acc-chev { transform: rotate(180deg); }
.acc-body { display: none; flex-direction: column; padding: 0 16px 6px; border-top: 1px solid var(--line); }
.acc-item.open .acc-body { display: flex; }
.acc-body .pcard { border: none; box-shadow: none; border-radius: 0; padding: 12px 0; border-bottom: 1px solid var(--line); }
.acc-body .pcard:last-child { border-bottom: none; }
.acc-body .pcard:hover { box-shadow: none; }
.plist { padding: 8px 16px 18px; display: flex; flex-direction: column; gap: 9px; }
.pcard { display: flex; align-items: center; gap: 15px; padding: 13px; border: 1px solid var(--line); border-radius: 14px; cursor: pointer; transition: all .13s; background: #fff; }
.pcard:hover { border-color: var(--line-2); box-shadow: var(--sh-2); }
.pcard.sel { background: var(--ok-soft); border-color: var(--ok); }
.thumb { width: 68px; height: 68px; flex: none; border-radius: 12px; background: #eef1f5 center/cover no-repeat; display: grid; place-items: center; color: var(--muted); font-size: 10px; position: relative; overflow: hidden; }
.thumb .check { position: absolute; left: -8px; top: -8px; width: 24px; height: 24px; border-radius: 50%; background: var(--ok); color: #fff; display: none; place-items: center; font-size: 13px; }
.pcard.sel .thumb .check { display: grid; }
.pinfo { flex: 1; min-width: 0; }
.pname { font-weight: 700; font-size: 15.5px; }
.pcode { font-size: 13px; color: var(--muted); margin-top: 2px; }
.prow { display: flex; align-items: center; gap: 6px; margin-top: 5px; flex-wrap: wrap; }
.pcolor { font-size: 12.5px; color: var(--ink-2); }
.size-badge { font-size: 11px; font-weight: 800; color: var(--navy); background: #eef1f5; border-radius: 7px; padding: 2px 8px; letter-spacing: .02em; }
.chip-type { font-size: 11px; font-weight: 800; padding: 2px 8px; border-radius: 999px; }
.pright { text-align: right; flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.pprice { font-weight: 800; font-size: 15px; color: var(--navy); }
.pprice.zero { color: var(--muted); font-weight: 600; font-size: 13px; }
.del { font-size: 12px; color: var(--danger); font-weight: 600; }
.chev { color: #cdd5de; font-size: 20px; }

/* ----- 오른쪽: 추가 ----- */
.sel-empty { padding: 48px 20px; text-align: center; color: var(--muted); }
.sel-empty svg { width: 42px; height: 42px; margin: 0 auto 12px; color: #d3dae2; }
.sel-product { display: flex; align-items: center; gap: 13px; padding: 13px; border: 1px solid var(--line-2); border-radius: 14px; background: #fafbfc; }
.sel-product .thumb { width: 60px; height: 60px; }
.sel-product .pname { font-weight: 700; }
.field-label { font-size: 12.5px; font-weight: 800; color: var(--ink-2); margin: 20px 0 9px; letter-spacing: .01em; }
.field-label .opt { font-weight: 500; color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { padding: 10px 16px; border: 1px solid var(--line-2); border-radius: 11px; font-size: 14px; font-weight: 700; color: var(--ink-2); background: #fff; transition: all .1s; }
.chip:hover { border-color: var(--brand); }
.chip.on { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: var(--sh-2); }
.chip.size.on { background: var(--navy); border-color: var(--navy); }
.price-edit input { font-size: 18px; font-weight: 800; color: var(--navy); padding: 13px; }
.memo-area { position: relative; }
.memo-area textarea { min-height: 96px; resize: vertical; line-height: 1.55; }
.memo-area .count { position: absolute; right: 12px; bottom: 10px; font-size: 11.5px; color: var(--muted); }
.save-btn { width: 100%; margin-top: 20px; background: var(--brand-grad); color: #fff; padding: 15px; border-radius: 13px; font-weight: 800; font-size: 15px; display: flex; align-items: center; justify-content: center; gap: 8px; box-shadow: var(--sh-2); transition: filter .12s; }
.save-btn:hover { filter: brightness(1.08); }
.save-btn svg { width: 18px; height: 18px; }

.center-empty { padding: 64px 24px; text-align: center; color: var(--muted); }
.center-empty svg { width: 46px; height: 46px; margin: 0 auto 14px; color: #d3dae2; }

/* ===== 모달 ===== */
.modal { position: fixed; inset: 0; background: rgba(10,20,35,.5); display: grid; place-items: center; z-index: 60; padding: 16px; backdrop-filter: blur(2px); }
.modal-box { background: #fff; width: 100%; max-width: 410px; border-radius: 18px; padding: 24px; display: flex; flex-direction: column; gap: 13px; box-shadow: var(--sh-3); }
.modal-box h3 { margin: 0 0 2px; color: var(--navy); font-size: 18px; font-weight: 800; }
.modal-box label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 700; color: var(--ink-2); }
.modal-actions { display: flex; gap: 10px; margin-top: 8px; }
.modal-actions button { flex: 1; padding: 13px; border-radius: 11px; font-weight: 800; }
.modal-actions .ghost { background: var(--bg); color: var(--ink-2); }
.modal-actions .primary { background: var(--brand); color: #fff; }

/* ===== 반응형 ===== */
@media (max-width: 1120px) {
  .workspace { grid-template-columns: 280px minmax(0,1fr); }
  .pane-action { grid-column: 1 / -1; }
}
@media (max-width: 760px) {
  .workspace { grid-template-columns: 1fr; padding: 12px; gap: 14px; }
  .appbar { padding: 0 14px; height: 56px; }
  .brand .sub { display: none; }
  .landing { padding: 18px 14px 50px; }
}
