/* dysaju v0.3 — Classical 톤 (디자인 캔버스 하이파이 확정안 구현)
   구조: 좌측 레일(오늘/상담/고객/설정) + 상담(요약 열 + 4탭) + 보여주기 모드 */

:root {
  --bg: #f6f5f3;
  --surface: #eae9e9;
  --ink: #201f1d;
  --accent: #b68235;
  --accent-100: #fff3e4;
  --accent-300: #facb8d;
  --accent-600: #a06f24;
  --accent-700: #7d5411;
  --accent-800: #5a3b0a;
  --n200: #eae7e7;
  --n300: #d7d3d3;
  --n600: #7d7979;
  --n700: #605d5d;
  --divider: rgba(32, 31, 29, 0.16);
  --shadow-md: 0 3px 10px rgba(45, 43, 43, 0.16);
  --shadow-lg: 0 12px 32px rgba(45, 43, 43, 0.22);
  --font-head: "Cormorant Garamond", "Noto Serif KR", serif;
  --font-body: "Lora", "Noto Serif KR", serif;
  /* 밀도 (작업 모드 기본값 — 보여주기 모드가 키운다) */
  --t-fs: 14.5px;
  --t-pad-v: 6.5px;
  --g-cell: 42px;
  --g-fs: 15.5px;
}
body.show-mode {
  --t-fs: 18px;
  --t-pad-v: 10px;
  --g-cell: 52px;
  --g-fs: 19px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--font-body); font-size: 15px; line-height: 1.55;
  word-break: keep-all; overflow: hidden;
}
button { font-family: var(--font-body); color: var(--ink); }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
::selection { background: rgba(182, 130, 53, 0.3); }

#app { display: flex; height: 100vh; }
#screen { flex: 1; min-width: 0; display: flex; flex-direction: column; }

/* ---- 레일 ---- */
#rail {
  width: 84px; flex: none; border-right: 1px solid var(--divider);
  display: flex; flex-direction: column; padding-top: 14px; background: var(--bg);
}
#rail .brand {
  text-align: center; font-family: var(--font-head); font-weight: 600;
  font-size: 15px; letter-spacing: 0.06em; color: var(--accent-700);
  padding: 8px 0 18px; border-bottom: 1px solid var(--divider); margin: 0 14px 10px;
}
#rail .rail-item {
  border: 0; background: transparent; border-left: 2px solid transparent;
  cursor: pointer; padding: 15px 0; font-size: 13.5px; letter-spacing: 0.08em;
  color: var(--n700); min-height: 52px;
}
#rail .rail-item:hover { background: rgba(182, 130, 53, 0.08); }
#rail .rail-item.active {
  background: rgba(182, 130, 53, 0.12); color: var(--accent-800);
  border-left-color: var(--accent);
}
#rail .rail-badge {
  display: inline-block; margin-left: 4px; min-width: 17px; padding: 0 4px;
  border: 1px solid var(--accent); border-radius: 9px; font-size: 10.5px;
  color: var(--accent-700); font-variant-numeric: tabular-nums;
}
#rail .rail-backup {
  margin-top: auto; padding: 12px 8px; border-top: 1px solid var(--divider);
  font-size: 10.5px; color: var(--n600); text-align: center; line-height: 1.5;
  background: none; border-left: 0; border-right: 0; border-bottom: 0; cursor: pointer;
}
#rail .rail-backup b { font-weight: 600; color: var(--accent-700); }
#rail .rail-backup.warn b { color: #a33; }
body.show-mode #rail { display: none; }

/* ---- 공용 ---- */
.serif-head { font-family: var(--font-head); font-weight: 600; }
.muted { color: var(--n600); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 0 18px; cursor: pointer; font-size: 14px;
  background: transparent; border: 1px solid var(--divider); border-radius: 4px;
}
.btn:hover { background: rgba(32, 31, 29, 0.06); }
.btn-accent { border-color: var(--accent); color: var(--accent-700); }
.btn-accent:hover { background: rgba(182, 130, 53, 0.12); }
.btn-ghost { border-color: transparent; color: var(--accent-700); }
.btn-ghost:hover { background: rgba(182, 130, 53, 0.1); }
.btn-danger { border-color: #b04a3a; color: #b04a3a; }
.btn-danger:hover { background: rgba(176, 74, 58, 0.1); }
.btn-sm { min-height: 38px; padding: 0 12px; font-size: 13px; }
.tag {
  display: inline-flex; align-items: center; font-size: 11px; padding: 3px 10px;
  border-radius: 3px; background: var(--n200); color: var(--ink);
}

.num-mark { color: var(--accent-700); border-bottom: 1px dotted var(--accent); }

/* ---- 상담: 헤더 ---- */
.consult-head {
  flex: none; min-height: 64px; display: flex; align-items: center; gap: 12px;
  padding: 8px 22px; border-bottom: 1px solid var(--divider); position: relative;
  flex-wrap: wrap;
}
body.show-mode .consult-head { min-height: 76px; padding: 8px 30px; gap: 18px; }
.cust-pick {
  display: inline-flex; align-items: center; gap: 10px; min-height: 44px;
  padding: 6px 18px; border: 1px solid var(--divider); border-radius: 4px;
  background: transparent; cursor: pointer;
  font-family: var(--font-head); font-weight: 600; font-size: 18px;
}
.cust-pick:hover { border-color: var(--accent); }
.cust-pick .meta { font-family: var(--font-body); font-size: 12.5px; font-weight: 400; color: var(--n600); }
body.show-mode .cust-pick { font-size: 24px; border-color: transparent; }
.pick-menu {
  position: absolute; left: 22px; top: 62px; z-index: 40; width: 340px;
  max-height: 60vh; overflow-y: auto;
  background: var(--bg); border: 1px solid var(--divider); border-radius: 4px;
  box-shadow: var(--shadow-md); padding: 6px;
}
.pick-menu button {
  display: flex; justify-content: space-between; align-items: baseline; gap: 10px;
  width: 100%; min-height: 44px; padding: 8px 12px; border: 0;
  background: transparent; cursor: pointer; font-size: 14.5px; text-align: left;
}
.pick-menu button:hover { background: rgba(182, 130, 53, 0.1); }
.pick-menu .sub { font-size: 12px; color: var(--n600); font-variant-numeric: tabular-nums; }
.pick-menu .new-entry { color: var(--accent-700); font-weight: 600; border-bottom: 1px solid var(--divider); }
.year-step { display: inline-flex; align-items: center; border: 1px solid var(--divider); border-radius: 4px; }
.year-step button {
  min-width: 44px; min-height: 42px; border: 0; background: transparent;
  cursor: pointer; font-size: 15px; color: var(--accent-700);
}
.year-step button:hover { background: rgba(182, 130, 53, 0.1); }
.year-step .yr { padding: 0 14px; font-size: 16px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.year-step .yr .age { font-size: 12.5px; color: var(--n600); }
body.show-mode .year-step .yr { font-size: 18px; }

/* ---- 상담: 본문 ---- */
.consult-body { flex: 1; min-height: 0; display: flex; }
.summary-col {
  width: 300px; flex: none; border-right: 1px solid var(--divider);
  overflow-y: auto; padding: 20px 22px;
}
body.show-mode .summary-col { display: none; }
.summary-col .grid9, .grid9 {
  display: grid; grid-template-columns: repeat(9, 1fr); gap: 1px;
  background: var(--divider); border: 1px solid var(--divider);
}
.summary-col .grid9 div {
  background: var(--bg); text-align: center; padding: 6px 0;
  font-size: 13px; font-variant-numeric: tabular-nums;
}
.summary-col .grid8 {
  display: grid; grid-template-columns: repeat(8, 1fr); gap: 1px;
  background: var(--divider); border: 1px solid var(--divider);
}
.summary-col .grid8 div {
  background: var(--bg); text-align: center; padding: 7px 0;
  font-size: 13.5px; font-variant-numeric: tabular-nums;
}
.sec-label { margin: 16px 0 8px; font-size: 11px; letter-spacing: 0.1em; color: var(--accent-700); }
.legend { margin-top: 22px; padding-top: 14px; border-top: 1px solid var(--divider); font-size: 11.5px; color: var(--n700); line-height: 2.1; }
.legend .sw { display: inline-block; width: 22px; height: 12px; vertical-align: -1px; border: 1px solid var(--n300); }

.tab-strip { flex: none; display: flex; gap: 4px; padding: 0 24px; border-bottom: 1px solid var(--divider); }
.tab-strip button {
  min-height: 52px; padding: 0 22px; border: 0; border-bottom: 2px solid transparent;
  background: transparent; cursor: pointer;
  font-family: var(--font-head); font-weight: 600; font-size: 15.5px; color: var(--n700);
}
body.show-mode .tab-strip button { font-size: 18px; min-height: 56px; }
.tab-strip button:hover { background: rgba(182, 130, 53, 0.07); }
.tab-strip button.active { border-bottom-color: var(--accent); color: var(--accent-800); }
.tab-pane { flex: 1; min-height: 0; display: flex; }

/* ---- 표 ---- */
.dtable { border-collapse: collapse; font-variant-numeric: tabular-nums; }
.dtable th {
  padding: 8px 14px; border-bottom: 1px solid var(--divider);
  font-size: 11px; letter-spacing: 0.08em; color: var(--n600); font-weight: 400;
  text-align: center; white-space: nowrap; font-family: var(--font-body);
}
.dtable td {
  padding: var(--t-pad-v) 14px; border-bottom: 1px solid var(--divider);
  font-size: var(--t-fs); text-align: center; white-space: nowrap;
}
.dtable td.dim { color: var(--n600); }
.dtable td.strong { font-weight: 600; }
.dtable td.group-l { border-left: 1px solid var(--divider); }
.dtable tr.now td { background: var(--accent-100); }
.dtable tr.leap td { background: var(--n200); }
.scroll-y { overflow-y: auto; }
.sticky-head th { position: sticky; top: 0; background: var(--bg); z-index: 2; }

.big-grid {
  display: grid; grid-template-columns: repeat(9, var(--g-cell)); gap: 1px;
  background: var(--divider); border: 1px solid var(--divider);
}
.big-grid div {
  background: var(--bg); display: flex; align-items: center; justify-content: center;
  height: var(--g-cell); font-size: var(--g-fs); font-variant-numeric: tabular-nums;
}

/* 오버뷰 나이 점프 레일 */
.age-rail {
  flex: none; width: 64px; border-left: 1px solid var(--divider);
  display: flex; flex-direction: column; padding: 8px 6px; gap: 2px; overflow-y: auto;
}
.age-rail button {
  min-height: 44px; border: 0; border-left: 2px solid transparent;
  background: transparent; cursor: pointer; font-size: 12.5px; color: var(--n700);
  font-variant-numeric: tabular-nums;
}
.age-rail button:hover { background: rgba(182, 130, 53, 0.1); }
.age-rail button.now { color: var(--accent-700); border-left-color: var(--accent); }

/* 월 칩 */
.month-chips { flex: none; display: flex; gap: 6px; flex-wrap: wrap; padding: 14px 30px; border-bottom: 1px solid var(--divider); }
.month-chips button {
  min-height: 44px; min-width: 56px; padding: 0 12px; border: 1px solid var(--divider);
  border-radius: 4px; background: transparent; cursor: pointer; font-size: 14px;
}
.month-chips button:hover { border-color: var(--accent); }
.month-chips button.sel { border-color: var(--accent); background: rgba(182, 130, 53, 0.12); color: var(--accent-800); }
.month-chips button.nowm { color: var(--accent-700); }

/* 커플 */
.couple-wrap { display: flex; gap: 44px; flex-wrap: wrap; align-items: flex-start; }
.grid3 {
  display: grid; grid-template-columns: repeat(3, 64px); gap: 1px;
  background: var(--accent-300); border: 1.5px solid var(--accent);
}
.grid3 div {
  background: var(--accent-100); display: flex; align-items: center; justify-content: center;
  height: 64px; font-size: 22px; font-variant-numeric: tabular-nums; color: var(--accent-800);
}

/* ---- 목록 화면 (오늘/고객) ---- */
.page-pad { flex: 1; min-height: 0; overflow-y: auto; padding: 34px 40px; }
.page-title { font-family: var(--font-head); font-weight: 600; font-size: 26px; }
.page-head { display: flex; align-items: baseline; gap: 16px; border-bottom: 1px solid var(--divider); padding-bottom: 14px; flex-wrap: wrap; }
.rowlist { display: flex; flex-direction: column; max-width: 820px; }
.rowlist .row { display: flex; align-items: center; gap: 16px; padding: 13px 4px; border-bottom: 1px solid var(--divider); flex-wrap: wrap; }
.rowlist .row.today-row { background: var(--accent-100); }
.rowlist .t-time { font-family: var(--font-head); font-weight: 600; font-size: 20px; font-variant-numeric: tabular-nums; min-width: 70px; }
.rowlist .t-name { font-size: 16px; font-weight: 600; }
.rowlist .t-sub { font-size: 13px; color: var(--n600); font-variant-numeric: tabular-nums; }
.rowlist .spacer { margin-left: auto; }
.row-detail { padding: 8px 4px 16px; border-bottom: 1px solid var(--divider); display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.search-input {
  width: 260px; min-height: 44px; padding: 6px 14px; font-family: var(--font-body);
  font-size: 14px; color: var(--ink); background: transparent;
  border: 1px solid var(--divider); border-radius: 4px;
}
.search-input:focus-visible { border-color: var(--accent); outline-offset: 0; }

/* ---- 설정 ---- */
.card {
  border: 1px solid var(--divider); border-radius: 4px; padding: 20px; width: 420px; max-width: 100%;
}
.card .kicker { font-size: 11px; letter-spacing: 0.1em; color: var(--accent-700); margin-bottom: 8px; }

/* ---- 다이얼로그 ---- */
.dlg-backdrop {
  position: fixed; inset: 0; z-index: 100; display: grid; place-items: center;
  padding: 18px; background: rgba(45, 43, 43, 0.5);
}
.dlg {
  width: min(460px, 100%); display: flex; flex-direction: column; gap: 14px;
  padding: 22px; border-radius: 7px; background: var(--bg);
  box-shadow: var(--shadow-lg); border: 1px solid var(--divider);
}
.dlg h3 { font-family: var(--font-head); font-weight: 600; font-size: 20px; margin: 0; }
.dlg .field label { display: block; font-size: 12px; margin-bottom: 5px; color: var(--n700); }
.dlg input[type=text], .dlg input[type=date], .dlg input[type=time], .dlg input[type=search], .dlg select {
  width: 100%; min-height: 44px; padding: 6px 12px; font-family: var(--font-body);
  font-size: 16px; color: var(--ink); background: transparent;
  border: 1px solid var(--divider); border-radius: 4px;
}
.dlg input:focus-visible, .dlg select:focus-visible { border-color: var(--accent); outline-offset: 0; }
.dlg .birth-input { font-size: 20px; letter-spacing: 0.12em; font-variant-numeric: tabular-nums; }
.dlg .hint { font-size: 12px; color: var(--n600); margin-top: 4px; }
.dlg .err { font-size: 13px; color: #b04a3a; }
.dlg .preview { font-size: 13.5px; color: var(--accent-700); min-height: 1.4em; }
.dlg .actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 4px; }
.seg { display: inline-flex; overflow: hidden; border: 1px solid var(--divider); border-radius: 4px; }
.seg label { display: inline-flex; align-items: center; padding: 10px 16px; font-size: 14px; cursor: pointer; min-height: 44px; }
.seg label + label { border-left: 1px solid var(--divider); }
.seg input { position: absolute; opacity: 0; width: 0; height: 0; }
.seg label:has(input:checked) { color: var(--accent-700); box-shadow: inset 0 0 0 1.5px var(--accent); }
.seg label:not(:has(input:checked)):hover { background: rgba(32, 31, 29, 0.06); }

.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%); z-index: 200;
  background: var(--ink); color: var(--bg); padding: 10px 22px; border-radius: 6px;
  font-size: 14px; box-shadow: var(--shadow-md);
}

.print-menu {
  position: absolute; right: 22px; top: 62px; z-index: 40; width: 200px;
  background: var(--bg); border: 1px solid var(--divider); border-radius: 4px;
  box-shadow: var(--shadow-md); padding: 6px;
}
.print-menu button {
  display: block; width: 100%; min-height: 44px; border: 0; background: transparent;
  cursor: pointer; font-size: 14px; text-align: left; padding: 0 12px;
}
.print-menu button:hover { background: rgba(182, 130, 53, 0.1); }

/* ---- 인쇄 ---- */
#print-root { display: none; }
@media print {
  body { overflow: visible; background: #fff; }
  #app, .toast, .dlg-backdrop { display: none !important; }
  #print-root { display: block; font-size: 10pt; }
  #print-root h2 { font-family: var(--font-head); font-size: 16pt; margin: 0 0 4pt; }
  #print-root .sub { font-size: 9pt; color: #555; margin-bottom: 10pt; }
  #print-root section { page-break-inside: avoid; margin-bottom: 14pt; }
  #print-root section.page-break { page-break-before: always; }
  #print-root .dtable td, #print-root .dtable th { padding: 2pt 6pt; font-size: 8.5pt; }
  #print-root .big-grid { grid-template-columns: repeat(9, 26pt); }
  #print-root .big-grid div { height: 22pt; font-size: 10pt; background: #fff; }
  #print-root .grid3 div { height: 30pt; font-size: 12pt; }
  #print-root .dtable tr.now td { background: #f4e9d8 !important; -webkit-print-color-adjust: exact; }
}

/* =========================================================
   v0.4 예약 시스템 — 예약 시트 / 일정(하루·주·월) / 폰 매장 관리
   ========================================================= */

/* ---- 예약 시트 ---- */
.dlg.dlg-wide { width: min(620px, 100%); max-height: calc(100vh - 36px); overflow-y: auto; }
.dlg .field { display: block; }

.combo-list { margin-top: 8px; max-height: 232px; overflow-y: auto; border: 1px solid var(--divider); border-radius: 4px; }
.combo-row {
  display: flex; align-items: baseline; gap: 10px; width: 100%; min-height: 46px;
  padding: 10px 12px; border: 0; border-bottom: 1px solid var(--divider);
  background: transparent; cursor: pointer; text-align: left;
}
.combo-row:last-child { border-bottom: 0; }
.combo-row:hover { background: rgba(182, 130, 53, 0.1); }
.combo-row b { font-weight: 600; font-size: 15px; }
.combo-row .sub { font-size: 12.5px; color: var(--n600); }
.combo-new b { color: var(--accent-700); }
.combo-empty { padding: 12px; font-size: 12.5px; color: var(--n600); }

.pick-chip {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 12px;
  border: 1px solid var(--accent-300); border-radius: 4px; background: var(--accent-100);
}
.pick-chip b { font-weight: 600; font-size: 16px; }
.pick-chip .sub { font-size: 12.5px; color: var(--n700); }
.pick-chip .btn { margin-left: auto; }

.seg-btn {
  border: 0; background: transparent; padding: 10px 15px; font-size: 14px;
  min-height: 44px; cursor: pointer; color: var(--n700);
}
.seg-btn + .seg-btn { border-left: 1px solid var(--divider); }
.seg-btn:hover { background: rgba(32, 31, 29, 0.06); }
.seg-btn.on { color: var(--accent-700); box-shadow: inset 0 0 0 1.5px var(--accent); }

.slot-grid { display: flex; flex-wrap: wrap; gap: 6px; }
.slot {
  min-height: 44px; min-width: 76px; padding: 4px 10px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 1px; font-size: 14px;
  font-variant-numeric: tabular-nums; background: transparent;
  border: 1px solid var(--divider); border-radius: 4px; cursor: pointer;
}
.slot:hover:not(:disabled) { background: rgba(182, 130, 53, 0.12); border-color: var(--accent-300); }
.slot.on { border-color: var(--accent); box-shadow: inset 0 0 0 1.5px var(--accent); color: var(--accent-800); background: var(--accent-100); }
.slot.busy { opacity: 0.55; cursor: not-allowed; background: var(--n200); }
.slot.past { opacity: 0.42; }
.slot .who { font-size: 10px; color: var(--n600); max-width: 72px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.warn-box {
  padding: 10px 12px; border-radius: 4px; font-size: 13px;
  background: var(--accent-100); border: 1px solid var(--accent-300); color: var(--accent-800);
}
.warn-box + .warn-box { margin-top: 8px; }
.warn-box.danger { background: #f7ecea; border-color: #e0bdb6; color: #8f3a2d; }
.warn-box b { font-weight: 600; }

/* ---- 일정: 머리 ---- */
.date-nav { display: inline-flex; align-items: center; gap: 4px; }
.date-nav button {
  min-height: 38px; min-width: 34px; border: 1px solid var(--divider);
  border-radius: 4px; background: transparent; cursor: pointer;
}
.date-nav button:hover { background: rgba(32, 31, 29, 0.06); }
.date-nav .range { font-size: 14px; padding: 0 10px; min-width: 158px; text-align: center; font-variant-numeric: tabular-nums; }
.sec-label.is-today { color: var(--accent-800); font-weight: 600; }

/* ---- 다음 손님 ---- */
.next-card {
  margin-top: 18px; padding: 16px 18px; max-width: 980px; border-radius: 6px;
  border: 1px solid var(--accent-300); border-left: 4px solid var(--accent); background: var(--accent-100);
}
.next-card.is-done { border-color: var(--divider); border-left-color: var(--n600); background: var(--n200); }
.next-card .kicker { font-size: 11px; letter-spacing: 0.1em; color: var(--accent-700); margin-bottom: 8px; }
.next-main { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.next-main .spacer { margin-left: auto; }
.next-time { font-family: var(--font-head); font-weight: 600; font-size: 26px; font-variant-numeric: tabular-nums; }
.next-name { font-size: 20px; font-weight: 600; }

/* ---- 예약 한 줄 ---- */
.rowlist { max-width: 980px; }
.appt-row {
  display: flex; align-items: center; gap: 14px; padding: 13px 6px; flex-wrap: wrap;
  border-bottom: 1px solid var(--divider); cursor: pointer;
}
.appt-row:hover { background: rgba(182, 130, 53, 0.06); }
.appt-row.is-open { background: var(--accent-100); border-bottom-color: transparent; }
.appt-row.is-past { opacity: 0.5; }
.appt-row.is-canceled { opacity: 0.45; }
.appt-row.is-canceled .t-name { text-decoration: line-through; }
.appt-row .t-time { font-family: var(--font-head); font-weight: 600; font-size: 19px; min-width: 118px; font-variant-numeric: tabular-nums; }
.appt-row .t-name { font-size: 16px; font-weight: 600; }
.appt-row .t-sub { font-size: 13px; color: var(--n600); font-variant-numeric: tabular-nums; }
.appt-row .t-memo { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.appt-row .spacer { margin-left: auto; }
.appt-row .row-caret { font-size: 11px; color: var(--accent-700); }
.appt-actions {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 2px 6px 14px; border-bottom: 1px solid var(--divider); background: var(--accent-100);
}
.appt-actions .spacer { margin-left: auto; }
.appt-actions.cust-detail { background: transparent; }
.cust-hist { padding: 0 6px 12px; border-bottom: 1px solid var(--divider); }
.row-add {
  width: 100%; text-align: left; padding: 12px 6px; border: 0; border-bottom: 1px dashed var(--divider);
  background: transparent; color: var(--accent-700); font-size: 13.5px; cursor: pointer;
}
.row-add:hover { background: rgba(182, 130, 53, 0.08); }

.tag.st-done { background: #e4eadf; color: #3f5a34; }
.tag.st-noshow { background: #f7ecea; color: #8f3a2d; }
.tag.st-canceled { background: var(--n200); color: var(--n600); }

/* ---- 주간 격자 ---- */
.week-wrap {
  margin-top: 14px; max-width: 100%; overflow: auto; max-height: calc(100vh - 210px);
  border: 1px solid var(--divider); border-radius: 6px; background: var(--bg);
}
.week-head { display: flex; position: sticky; top: 0; z-index: 3; background: var(--bg); border-bottom: 1px solid var(--divider); }
.week-gutter { width: 52px; flex: none; position: relative; }
.week-head .week-gutter { height: 42px; }
.week-dayhead {
  flex: 1; min-width: 88px; border: 0; border-left: 1px solid var(--divider); padding: 5px 4px;
  background: transparent; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 1px;
}
.week-dayhead:hover { background: rgba(182, 130, 53, 0.08); }
.week-dayhead b { font-weight: 600; font-size: 12.5px; }
.week-dayhead span { font-size: 11.5px; color: var(--n600); font-variant-numeric: tabular-nums; }
.week-dayhead.is-today { background: var(--accent-100); color: var(--accent-800); }
.week-body { display: flex; }
.week-tick { position: absolute; right: 6px; font-size: 10.5px; color: var(--n600); transform: translateY(-6px); font-variant-numeric: tabular-nums; }
.week-col { flex: 1; min-width: 88px; position: relative; border-left: 1px solid var(--divider); }
.week-col.is-today { background: rgba(182, 130, 53, 0.05); }
.week-slot { position: absolute; left: 0; right: 0; padding: 0; border: 0; border-top: 1px solid var(--n200); background: transparent; cursor: pointer; }
.week-slot:hover { background: rgba(182, 130, 53, 0.16); }
.week-appt {
  position: absolute; left: 2px; right: 2px; z-index: 1; display: flex; flex-direction: column;
  align-items: flex-start; gap: 1px; overflow: hidden; padding: 2px 5px; cursor: pointer; text-align: left;
  border: 1px solid var(--accent-300); border-left: 3px solid var(--accent); border-radius: 3px; background: var(--accent-100);
}
.week-appt:hover { box-shadow: var(--shadow-md); }
.week-appt b { font-size: 12px; font-weight: 600; }
.week-appt span { font-size: 10.5px; color: var(--n600); font-variant-numeric: tabular-nums; }
.week-appt.st-done { background: var(--n200); border-color: var(--n300); border-left-color: var(--n600); }
.week-appt.st-noshow { background: #f7ecea; border-color: #e0bdb6; border-left-color: #b04a3a; }
.week-now { position: absolute; left: 0; right: 0; height: 0; border-top: 2px solid #b04a3a; z-index: 2; pointer-events: none; }

/* ---- 월간 ---- */
.month-grid {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; margin-top: 14px;
  background: var(--divider); border: 1px solid var(--divider); border-radius: 6px; overflow: hidden;
}
.month-dow { background: var(--bg); text-align: center; font-size: 11.5px; padding: 7px 0; color: var(--n600); }
.month-cell {
  position: relative; background: var(--bg); border: 0; min-height: 94px; padding: 6px;
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px; cursor: pointer; text-align: left;
}
.month-cell:hover { background: rgba(182, 130, 53, 0.08); }
.month-cell.out { opacity: 0.38; }
.month-cell.is-today { box-shadow: inset 0 0 0 2px var(--accent); }
.month-cell .d { font-size: 12.5px; font-weight: 600; font-variant-numeric: tabular-nums; }
.month-cell .cnt {
  position: absolute; top: 5px; right: 6px; font-size: 10.5px; color: var(--accent-700);
  border: 1px solid var(--accent-300); border-radius: 8px; padding: 0 5px; font-variant-numeric: tabular-nums;
}
.month-cell .mini { font-size: 10.5px; color: var(--n700); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- 고객 예약 이력 ---- */
.hist { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.hist .kicker { font-size: 10.5px; letter-spacing: 0.1em; color: var(--accent-700); margin-right: 2px; }
.hist-item {
  font-size: 11.5px; padding: 4px 8px; border-radius: 3px; border: 0;
  background: var(--n200); color: var(--n700); font-variant-numeric: tabular-nums;
}
.hist-item.next { background: var(--accent-100); color: var(--accent-800); border: 1px solid var(--accent-300); cursor: pointer; }
.hist-item.noshow { background: #f7ecea; color: #8f3a2d; }

/* ---- 설정 카드 안의 입력 ---- */
.card .field { margin-bottom: 10px; }
.card .field label { display: block; font-size: 12px; margin-bottom: 5px; color: var(--n700); }
.card .field input, .card .field select {
  min-height: 40px; padding: 5px 10px; font-family: var(--font-body); font-size: 15px;
  color: var(--ink); background: transparent; border: 1px solid var(--divider); border-radius: 4px;
}

/* =========================================================
   폰 — 매장 관리 (일정 · 예약 · 고객). 상담 전체 기능은 데스크톱.
   ========================================================= */
@supports (height: 100dvh) { #app { height: 100dvh; } }

@media (max-width: 760px) {
  #app { flex-direction: column; }
  #screen { order: 1; min-height: 0; }
  #rail {
    order: 2; width: auto; flex: none; flex-direction: row; padding: 0;
    border-right: 0; border-top: 1px solid var(--divider);
  }
  #rail .brand, #rail .rail-backup { display: none; }
  #rail .rail-item {
    flex: 1; min-height: 56px; padding: 12px 0; border-left: 0; border-top: 2px solid transparent;
  }
  #rail .rail-item.active { border-left-color: transparent; border-top-color: var(--accent); }

  .page-pad { padding: 18px 14px 24px; }
  .page-head { gap: 10px; padding-bottom: 12px; }
  .page-title { font-size: 21px; }
  .search-input { width: 100%; }

  .rowlist, .next-card { max-width: 100%; }
  .next-card { padding: 14px; }
  .next-time { font-size: 22px; }
  .next-name { font-size: 18px; }

  .appt-row { gap: 8px 10px; padding: 12px 2px; }
  .appt-row .t-time { min-width: 100px; font-size: 17px; }
  .appt-row .t-memo { max-width: 100%; }
  .appt-actions { padding: 2px 2px 14px; }

  .dlg-backdrop { padding: 0; place-items: end stretch; }
  .dlg, .dlg.dlg-wide { width: 100%; max-height: 92vh; overflow-y: auto; border-radius: 12px 12px 0 0; }
  .slot { min-width: 70px; }

  .date-nav .range { min-width: 122px; font-size: 13px; }
  .month-cell { min-height: 62px; padding: 4px; }
  .month-cell .mini { display: none; }
}

/* 링크로 만든 버튼(전화 걸기)도 버튼처럼 보이게 */
a.btn { text-decoration: none; color: var(--ink); }
a.btn.btn-accent { color: var(--accent-700); }
/* 첫 시각 눈금은 위로 밀지 않는다 (격자 위쪽에서 잘렸다) */
.week-tick:first-child { transform: none; }
