:root {
  --bg: #F6F5F2;
  --card: #FFFFFF;
  --ink: #1F2A44;
  --ink-2: #4B5563;
  --ink-3: #6B7280;
  --line: #E7E4DD;
  --line-2: #DCD7CD;
  --gold: #8A6A2E;
  --gold-soft: #EDE7DA;
  --gold-bg: #F6F1E7;
  --brown: #7A5418;
  --green: #2E5A3E;
  --green-bg: #E6EEE8;
  --blue: #2B4C80;
  --blue-bg: #E5EBF5;
  --amber-bg: #F5EBDD;
  --red: #B4413A;
  --sat: #2F5FA8;
  --nav-h: 72px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: 'Noto Sans KR', system-ui, -apple-system, sans-serif; }
body { overscroll-behavior-y: none; }
button, input, textarea, select { font-family: inherit; color: inherit; }
button { cursor: pointer; }
input, textarea { font-size: 16px; }
#app { max-width: 520px; margin: 0 auto; min-height: 100vh; position: relative; }

.view { padding: 20px 20px calc(var(--nav-h) + var(--safe-b) + 24px) 20px; display: flex; flex-direction: column; gap: 14px; }
.top { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding-top: 8px; }
.brand { font-size: 12px; letter-spacing: 2px; color: var(--gold); font-weight: 700; }
h1 { margin: 0; font-size: 26px; font-weight: 700; }
h2 { margin: 0; font-size: 17px; font-weight: 700; }
.sub { font-size: 14px; color: var(--ink-2); }
.muted { color: var(--ink-2); font-size: 13px; }
.row { display: flex; align-items: center; gap: 12px; }
.between { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.grow { flex: 1 1 auto; min-width: 0; }
.card { background: var(--card); border-radius: 18px; padding: 14px; }
.stack { display: flex; flex-direction: column; gap: 8px; }
.stack-12 { display: flex; flex-direction: column; gap: 12px; }
.divider { height: 1px; background: #EEEBE5; }
.small { font-size: 12px; }
.bold { font-weight: 700; }

.btn { height: 48px; padding: 0 16px; border: none; border-radius: 14px; background: var(--ink); color: #fff; font-size: 15px; font-weight: 500; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.btn.pill { height: 44px; border-radius: 22px; }
.btn.ghost { background: #fff; color: var(--ink); border: 1px solid #CFCAC0; }
.btn.block { width: 100%; height: 54px; font-size: 16px; font-weight: 700; border-radius: 16px; }
.btn.dashed { background: #FBF7EF; color: var(--brown); border: 1.5px dashed #B8924A; font-weight: 700; }
.btn.danger { background: #fff; color: var(--red); border: 1px solid #E3C4C1; }
.btn.small { height: 36px; border-radius: 18px; font-size: 13px; padding: 0 12px; }
.btn:disabled { opacity: .5; }
.icon-btn { width: 44px; height: 44px; border: none; background: transparent; color: var(--ink); display: inline-flex; align-items: center; justify-content: center; border-radius: 22px; }
.icon-btn.solid { background: var(--ink); color: #fff; }

.avatar { width: 44px; height: 44px; flex: 0 0 44px; border-radius: 22px; background: var(--gold-soft); color: var(--gold); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 16px; }
.avatar.lg { width: 56px; height: 56px; flex-basis: 56px; border-radius: 28px; font-size: 22px; }
.name { font-size: 15px; font-weight: 700; }
.name small { font-weight: 400; font-size: 13px; color: var(--ink-3); }

.badge { font-size: 12px; font-weight: 500; padding: 4px 10px; border-radius: 12px; white-space: nowrap; }
.b-stay { background: var(--green-bg); color: var(--green); }
.b-in { background: var(--blue-bg); color: var(--blue); }
.b-out { background: var(--amber-bg); color: var(--brown); }
.b-done { background: #EEEDEA; color: var(--ink-2); }
.b-first { background: var(--amber-bg); color: var(--brown); }
.b-re { background: var(--blue-bg); color: var(--blue); }
.b-vip { background: #B8924A; color: #fff; font-weight: 700; }

/* 달력 */
.cal { background: #fff; border-radius: 20px; padding: 12px 8px 8px; display: flex; flex-direction: column; gap: 6px; }
.cal-head { display: flex; justify-content: space-between; align-items: center; }
.cal-title { font-size: 17px; font-weight: 700; }
.cal-week, .cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 3px; }
.cal-week span { text-align: center; font-size: 12px; color: var(--ink-3); }
.cal-week span:first-child { color: var(--red); }
.cal-week span:last-child { color: var(--sat); }
.day { height: 58px; border: none; border-radius: 10px; background: transparent; padding: 4px 0; display: flex; flex-direction: column; align-items: center; gap: 1px; overflow: hidden; }
.day.has { background: var(--gold-bg); }
.day.sel { background: var(--ink); }
.day .n { font-size: 14px; color: var(--ink); }
.day.sun .n { color: var(--red); }
.day.sat .n { color: var(--sat); }
.day.today .n { font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
.day .dn { font-size: 11px; font-weight: 500; color: var(--brown); line-height: 1.2; max-width: 100%; padding: 0 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.day .more { font-size: 9px; color: var(--ink-3); line-height: 1.1; }
.day.sel .n, .day.sel .dn { color: #fff; }
.day.sel .more { color: #E8D3A8; }
.day.empty { visibility: hidden; }

.list-item { background: #fff; border-radius: 16px; padding: 12px 14px; display: flex; align-items: center; gap: 12px; border: 1.5px solid transparent; width: 100%; text-align: left; }
.empty-box { background: #fff; border-radius: 16px; padding: 22px; text-align: center; color: var(--ink-2); font-size: 14px; }

/* 홈 */
.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.tile { background: #fff; border-radius: 16px; padding: 14px; display: flex; flex-direction: column; gap: 4px; }
.tile span:first-child { font-size: 12px; color: var(--ink-2); }
.tile b { font-size: 26px; }
.tile.dark { background: var(--ink); }
.tile.dark span:first-child { color: #D6DAE3; }
.tile.dark b { color: #fff; }
.due-box { display: flex; justify-content: space-between; align-items: center; background: var(--bg); border-radius: 12px; padding: 10px 12px; }
.due-box b { color: var(--brown); font-size: 16px; }
.done-note { text-align: center; font-size: 14px; font-weight: 500; color: var(--green); background: var(--green-bg); padding: 12px; border-radius: 12px; }
.two { display: flex; gap: 8px; }
.two > * { flex: 1 1 0; }
.chips-wrap { display: flex; flex-wrap: wrap; gap: 6px; }
.mini-chip { background: #fff; border-radius: 14px; padding: 6px 12px; font-size: 13px; border: none; }

/* 입력 */
.field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--ink-2); }
.field input, .field textarea, .field select { height: 46px; border: 1px solid var(--line-2); border-radius: 12px; padding: 0 12px; background: #fff; color: var(--ink); font-size: 16px; width: 100%; }
.field textarea { height: auto; padding: 10px 12px; line-height: 1.5; resize: none; font-size: 15px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.search { height: 48px; background: #fff; border-radius: 14px; display: flex; align-items: center; gap: 8px; padding: 0 14px; color: var(--ink-3); }
.search input { flex: 1; border: none; outline: none; background: transparent; font-size: 16px; color: var(--ink); min-width: 0; }
.seg { display: grid; gap: 6px; }
.seg button { height: 44px; border-radius: 12px; border: 1.5px solid var(--line-2); background: #fff; color: var(--ink); font-size: 14px; font-weight: 500; padding: 0 4px; }
.seg button.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.seg-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.seg-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.seg-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.seg-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.chips { display: flex; gap: 8px; }
.chips button { height: 36px; padding: 0 14px; border-radius: 18px; border: 1px solid var(--line-2); background: #fff; font-size: 13px; font-weight: 500; }
.chips button.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.money { height: 48px; border: 1px solid var(--line-2); border-radius: 12px; display: flex; align-items: center; gap: 8px; padding: 0 12px; background: #fff; }
.money span:first-child { width: 88px; font-size: 14px; font-weight: 500; }
.stepper { display: flex; align-items: center; gap: 4px; }
.stepper button { width: 44px; height: 44px; border-radius: 12px; border: 1.5px solid var(--line-2); background: #fff; font-size: 20px; font-weight: 500; line-height: 1; }
.stepper button:disabled { opacity: .35; }
.stepper b { min-width: 44px; text-align: center; font-size: 16px; }
.money input { flex: 1; min-width: 0; border: none; outline: none; text-align: right; font-size: 16px; background: transparent; }

/* 고객 상세 */
.facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.fact { background: var(--bg); border-radius: 12px; padding: 10px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.fact span { font-size: 11px; color: var(--ink-2); }
.fact b { font-size: 14px; line-height: 28px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fact input, .fact select { height: 30px; border: 1px solid #B8924A; border-radius: 8px; padding: 0 6px; font-size: 14px; font-weight: 700; background: #fff; width: 100%; }
.memo-view { min-height: 48px; border-radius: 12px; padding: 10px 12px; font-size: 14px; line-height: 1.5; background: var(--bg); white-space: pre-line; }
.stats3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-top: 1px solid #EEEBE5; padding-top: 12px; text-align: center; }
.stats3 div { display: flex; flex-direction: column; gap: 2px; }
.stats3 span { font-size: 11px; color: var(--ink-2); }
.stats3 b { font-size: 15px; }
.hist { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; padding: 9px 0; border-bottom: 1px solid #F1EEE8; }

/* 결제 */
.line { display: flex; justify-content: space-between; font-size: 14px; color: var(--ink-2); }
.line.total { color: var(--ink); }
.line.total b { font-weight: 700; }
.line.deposit { color: var(--green); align-items: center; }
.due-big { display: flex; justify-content: space-between; align-items: baseline; background: var(--bg); border-radius: 12px; padding: 12px; }
.due-big b { font-size: 24px; color: var(--brown); }

/* 매출 */
.seg-bg { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; background: #E9E6DF; border-radius: 14px; padding: 4px; }
.seg-bg button { height: 38px; border: none; border-radius: 10px; background: transparent; color: var(--ink-2); font-size: 14px; font-weight: 500; }
.seg-bg button.on { background: #fff; color: var(--ink); }
.hero { background: var(--ink); border-radius: 20px; padding: 18px; display: flex; flex-direction: column; gap: 4px; }
.hero span { font-size: 13px; color: #D6DAE3; }
.hero b { font-size: 30px; color: #fff; }
.hero em { font-style: normal; font-size: 13px; color: #E8D3A8; }
.bars { height: 130px; display: flex; align-items: flex-end; gap: 10px; }
.bar-col { flex: 1 1 0; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 6px; height: 130px; min-width: 0; }
.bar-col span { font-size: 10px; color: var(--ink-2); white-space: nowrap; }
.bar { width: 100%; max-width: 34px; border-radius: 8px 8px 4px 4px; background: #CFC6B4; min-height: 2px; }
.bar.cur { background: var(--ink); }
.split { display: flex; height: 14px; border-radius: 7px; overflow: hidden; gap: 2px; background: #EEEBE5; }
.dot { width: 8px; height: 8px; border-radius: 4px; display: inline-block; }

/* 하단 메뉴 */
.nav { position: fixed; left: 0; right: 0; bottom: 0; background: #fff; border-top: 1px solid var(--line); display: flex; justify-content: center; padding-bottom: var(--safe-b); z-index: 20; }
.nav-in { width: 100%; max-width: 520px; display: flex; justify-content: space-around; height: var(--nav-h); align-items: center; }
.nav button { width: 66px; height: 56px; border: none; background: transparent; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--ink-3); font-size: 11px; }
.nav button.on { color: var(--ink); font-weight: 700; }

/* 아래에서 올라오는 창 */
.sheet-bg { position: fixed; inset: 0; background: rgba(15, 23, 42, .45); z-index: 40; display: flex; align-items: flex-end; justify-content: center; }
.sheet-bg.anim { animation: fade .15s ease; }
.sheet-bg.anim .sheet { animation: up .2s ease; }
.sheet { width: 100%; max-width: 520px; max-height: 92vh; overflow-y: auto; background: #fff; border-radius: 24px 24px 0 0; padding: 10px 20px calc(24px + var(--safe-b)); display: flex; flex-direction: column; gap: 14px; }
.grab { width: 40px; height: 5px; border-radius: 3px; background: var(--line-2); align-self: center; }
.sheet-head { display: flex; align-items: center; gap: 4px; }
.sheet-head h2 { flex: 1; font-size: 19px; }
@keyframes up { from { transform: translateY(40px); opacity: .6; } to { transform: none; opacity: 1; } }
@keyframes slide-next { from { transform: translateX(36px); opacity: .4; } to { transform: none; opacity: 1; } }
@keyframes slide-prev { from { transform: translateX(-36px); opacity: .4; } to { transform: none; opacity: 1; } }
.view.slide-next { animation: slide-next .18s ease-out; }
.view.slide-prev { animation: slide-prev .18s ease-out; }
body { overflow-x: hidden; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--nav-h) + var(--safe-b) + 14px); background: var(--green); color: #fff; border-radius: 14px; padding: 13px 18px; font-size: 14px; font-weight: 500; z-index: 60; max-width: calc(100% - 40px); text-align: center; box-shadow: 0 6px 20px rgba(0,0,0,.15); }
.toast.err { background: var(--red); }
.demo-pill { align-self: flex-start; font-size: 12px; background: var(--amber-bg); color: var(--brown); border-radius: 12px; padding: 5px 10px; border: none; }

/* 로그인 */
.login { min-height: 100vh; display: flex; flex-direction: column; justify-content: center; padding: 32px 24px; gap: 16px; max-width: 420px; margin: 0 auto; }
.login .logo { font-size: 13px; letter-spacing: 3px; color: var(--gold); font-weight: 700; }
.login h1 { font-size: 32px; }
.err-text { color: var(--red); font-size: 14px; }
.loading { min-height: 100vh; display: flex; align-items: center; justify-content: center; color: var(--ink-2); }

/* ---------- 폰·PC 공통 배치 ---------- */
.cols { display: flex; flex-direction: column; gap: 14px; }
.col { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.sales-grid { display: grid; gap: 14px; }
.dn-list { display: none; }
.nav-logo { display: none; }
.list-item.picked { border-color: var(--ink); }
.pick-hint { padding: 48px 24px; }
/* 폰: 목록과 상세 중 하나만 */
@media (max-width: 1023px) {
  .v-split.has-sel .col-list { display: none; }
  .v-split:not(.has-sel) .col-detail { display: none; }
}

/* ---------- PC (넓은 화면) ---------- */
@media (min-width: 1024px) {
  :root { --side: 104px; }
  #app { max-width: none; }
  .only-m { display: none; }

  .nav { top: 0; bottom: 0; left: 0; right: auto; width: var(--side); border-top: none; border-right: 1px solid var(--line); padding: 20px 0; align-items: flex-start; }
  .nav-in { flex-direction: column; justify-content: flex-start; height: auto; gap: 6px; width: var(--side); align-items: center; }
  .nav-logo { display: flex; width: 48px; height: 48px; border-radius: 14px; background: var(--ink); color: #F6F1E7; font-family: Georgia, serif; font-weight: 700; font-size: 24px; align-items: center; justify-content: center; margin-bottom: 18px; box-shadow: inset 0 0 0 2px #B8924A55; }
  .nav button { width: 84px; height: 70px; border-radius: 16px; font-size: 12px; gap: 5px; }
  .nav button:hover { background: #F6F5F2; }
  .nav button.on { background: var(--bg); }

  .view { margin-left: var(--side); padding: 32px 40px 48px; max-width: 1440px; gap: 20px; }
  h1 { font-size: 30px; }
  .cols { display: grid; gap: 24px; align-items: start; }
  .c-21 { grid-template-columns: minmax(0, 1.7fr) minmax(340px, 1fr); }
  .c-12 { grid-template-columns: minmax(340px, 1fr) minmax(0, 1.5fr); }
  .c-111 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .side-sticky { position: sticky; top: 24px; max-height: calc(100vh - 48px); overflow-y: auto; padding-bottom: 8px; }
  .sales-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; align-items: start; }

  .tiles { gap: 16px; }
  .tile { padding: 20px; }
  .tile b { font-size: 34px; }

  /* 큰 달력: 하루에 최대 3마리 이름 */
  .cal { padding: 18px 16px 14px; gap: 10px; }
  .cal-title { font-size: 20px; }
  .cal-week span { font-size: 13px; }
  .cal-grid { gap: 6px; }
  .day { height: 108px; align-items: stretch; padding: 8px; gap: 4px; border-radius: 12px; }
  .day:hover { outline: 1.5px solid var(--line-2); }
  .day .n { text-align: left; font-size: 14px; }
  .day .dn, .day .more { display: none; }
  .day .dn-list { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
  .dn-list span { font-size: 12px; font-weight: 500; color: var(--brown); background: #fff; border-radius: 6px; padding: 2px 6px; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .dn-list em { font-style: normal; font-size: 11px; color: var(--ink-2); text-align: left; padding-left: 2px; }
  .day.sel .dn-list span { background: rgba(255, 255, 255, .16); color: #fff; }
  .day.sel .dn-list em { color: #E8D3A8; }

  .list-item:hover { border-color: var(--line-2); }
  .list-item.picked:hover { border-color: var(--ink); }
  .bars { height: 180px; }
  .bar-col { height: 180px; }

  /* 창은 화면 가운데에 */
  .sheet-bg { align-items: center; }
  .sheet { border-radius: 24px; max-width: 580px; max-height: 88vh; padding: 20px 28px 28px; }
  .grab { display: none; }
  .toast { bottom: 32px; left: calc(50% + var(--side) / 2); }
  .login { max-width: 420px; }
}
