:root {
  --plum: #4b3a6b; --plum-2: #6b4fa0; --plum-soft: #f1ecf8; --ink: #1f2328; --muted: #6b7075; --line: #e3dfe9;
  --bg: #f7f6f9; --card: #fff; --good: #1f8a4c; --warn: #b7791f; --bad: #c0392b; --radius: 10px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", sans-serif; font-size: 15px; line-height: 1.5; }
button, input, select, textarea { font: inherit; }
a { color: var(--plum-2); }
#topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 10px; padding: 10px 14px;
  background: var(--plum); color: #fff; }
#topbar .brand { font-weight: 700; flex: 1; white-space: nowrap; }
#topbar .brand small { font-weight: 400; opacity: .8; margin-left: 4px; }
#branch-select { max-width: 130px; border-radius: 8px; border: 0; padding: 6px 8px; }
.icon-btn { background: transparent; border: 0; color: inherit; font-size: 20px; cursor: pointer; position: relative; padding: 4px 6px; }
#notif-count { position: absolute; top: -2px; right: -4px; background: #e74c3c; color: #fff; border-radius: 10px; font-size: 11px; padding: 0 5px; }
#nav { position: fixed; top: 52px; bottom: 0; left: 0; width: 210px; background: #fff; border-right: 1px solid var(--line);
  overflow-y: auto; padding: 8px 0 40px; z-index: 20; }
#nav .grp { font-size: 12px; color: var(--muted); padding: 12px 16px 4px; font-weight: 600; }
#nav a { display: block; padding: 8px 16px; color: var(--ink); text-decoration: none; border-left: 3px solid transparent; }
#nav a.on { background: var(--plum-soft); border-left-color: var(--plum); font-weight: 600; }
#nav .me { padding: 12px 16px; font-size: 13px; color: var(--muted); border-top: 1px solid var(--line); margin-top: 10px; }
main#view { padding: 18px 20px 60px; margin-left: 210px; max-width: 1280px; }
body.anon main#view { margin-left: 0; }
@media (max-width: 900px) {
  #nav { transform: translateX(-100%); transition: transform .2s; width: 240px; box-shadow: 2px 0 12px rgba(0,0,0,.1); }
  #nav.open { transform: none; }
  main#view { margin-left: 0; padding: 14px 12px 60px; }
}
@media (min-width: 901px) { #menu-btn { display: none; } }
h1 { font-size: 22px; margin: 4px 0 14px; }
h2 { font-size: 17px; margin: 22px 0 10px; }
h3 { font-size: 15px; margin: 14px 0 6px; }
.sub { color: var(--muted); font-size: 13px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-bottom: 14px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row > .grow { flex: 1; }
.grid { display: grid; gap: 12px; }
.grid.c2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid.c4 { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.tile { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.tile .v { font-size: 24px; font-weight: 700; }
.tile .l { font-size: 12px; color: var(--muted); }
.tile.alert { border-color: #f0b6ae; background: #fff6f5; }
.tile .t { font-size: 12px; }
.good { color: var(--good); } .warn { color: var(--warn); } .bad { color: var(--bad); }
.btn { display: inline-block; border: 1px solid var(--line); background: #fff; color: var(--ink); padding: 7px 12px; border-radius: 8px; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { border-color: var(--plum-2); }
.btn.primary { background: var(--plum); border-color: var(--plum); color: #fff; }
.btn.danger { color: var(--bad); border-color: #f0c2bc; }
.btn.sm { padding: 3px 8px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: default; }
input[type=text], input[type=tel], input[type=password], input[type=number], input[type=date], input[type=datetime-local], input[type=month], input[type=search], input[type=time], input[type=url], select, textarea {
  border: 1px solid var(--line); border-radius: 8px; padding: 7px 9px; background: #fff; max-width: 100%; }
textarea { width: 100%; min-height: 80px; }
label.f { display: block; margin-bottom: 10px; }
label.f > span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 3px; }
label.f input:not([type=checkbox]), label.f select, label.f textarea { width: 100%; }
.check { display: inline-flex; gap: 6px; align-items: center; margin-right: 12px; }
/* 설정 → 기준값 입력폼 */
.grid.c3 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.srow { display: grid; grid-template-columns: minmax(0, 1fr) 90px 34px; gap: 8px; align-items: center; margin-bottom: 6px; }
.srow.ev { grid-template-columns: minmax(0, 1fr) 80px 64px 34px; }
.srow input { width: 100%; }
.srow.head { font-size: 12px; color: var(--muted); margin-bottom: 2px; }
.pl-in { width: 100%; min-width: 80px; }
.set-foot { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 8px; }
.set-foot .sub.bad { color: var(--bad); }
.tw { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.t { border-collapse: collapse; width: 100%; background: #fff; font-size: 14px; }
table.t th { background: var(--plum-soft); text-align: left; padding: 7px 8px; font-weight: 600; white-space: nowrap; }
table.t td { padding: 7px 8px; border-top: 1px solid var(--line); vertical-align: top; }
table.t tr.click { cursor: pointer; } table.t tr.click:hover td { background: #faf8fd; }
.chip { display: inline-block; font-size: 12px; padding: 1px 8px; border-radius: 10px; background: #eee; white-space: nowrap; }
.chip.lead { background: #e8f0fe; color: #1a56db; } .chip.contacted { background: #eef2f7; }
.chip.booked { background: #fff4e0; color: #9a5b00; } .chip.noshow { background: #fde8e8; color: var(--bad); }
.chip.hold { background: #fff0f6; color: #a61e4d; } .chip.paid { background: #e6f6ec; color: var(--good); }
.chip.refunded, .chip.lost { background: #eee; color: #666; }
.chip.ad { background: #fff4e0; color: #9a5b00; }
.list .item { display: flex; gap: 10px; align-items: center; padding: 9px 0; border-top: 1px solid var(--line); }
.list .item:first-child { border-top: 0; }
.list .item .main { flex: 1; min-width: 0; }
.list .item .m { font-size: 13px; color: var(--muted); }
.empty { color: var(--muted); padding: 14px 0; text-align: center; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 10px 0 14px; overflow-x: auto; }
.tabs button { background: none; border: 0; padding: 8px 12px; cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs button.on { border-bottom-color: var(--plum); font-weight: 600; }
.modal-bg { position: fixed; inset: 0; background: rgba(20,15,30,.45); display: flex; align-items: flex-start; justify-content: center; z-index: 50; padding: 40px 12px; overflow-y: auto; }
.modal { background: #fff; border-radius: 12px; width: 100%; max-width: 560px; padding: 18px; }
.modal h2 { margin-top: 0; }
.modal .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
#toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: #222; color: #fff; padding: 9px 16px; border-radius: 8px; opacity: 0; transition: opacity .2s; pointer-events: none; z-index: 60; max-width: 90vw; }
#toast.show { opacity: .95; }
.login { max-width: 360px; margin: 80px auto; }
.login h1 { text-align: center; color: var(--plum); }
.md h1 { font-size: 20px; } .md h2 { font-size: 17px; } .md table { border-collapse: collapse; } .md td, .md th { border: 1px solid var(--line); padding: 5px 8px; }
.md blockquote { border-left: 3px solid var(--plum-2); margin: 8px 0; padding: 4px 12px; color: var(--muted); background: var(--plum-soft); }
.timer { font-size: 44px; font-weight: 700; font-variant-numeric: tabular-nums; text-align: center; }
.steps .s { padding: 8px 10px; border-radius: 8px; margin-bottom: 4px; background: #f6f5f8; display: flex; justify-content: space-between; }
.steps .s.on { background: var(--plum); color: #fff; } .steps .s.done { color: var(--muted); text-decoration: line-through; }
.cal { display: grid; gap: 0; border: 1px solid var(--line); background: #fff; font-size: 13px; }
.cal .h { background: var(--plum-soft); font-weight: 600; padding: 6px; text-align: center; position: sticky; top: 0; }
.cal .tm { color: var(--muted); padding: 4px 6px; border-top: 1px solid var(--line); text-align: right; }
.cal .slot { border-top: 1px solid var(--line); border-left: 1px solid var(--line); min-height: 34px; padding: 2px; cursor: pointer; }
.cal .slot:hover { background: #faf8fd; }
.cal .bk { background: var(--plum-soft); border-left: 3px solid var(--plum); border-radius: 4px; padding: 2px 4px; margin-bottom: 2px; cursor: pointer; }
.cal .bk.trial { border-left-color: #d97706; background: #fff7ea; } .cal .bk.noshow { opacity: .5; text-decoration: line-through; } .cal .bk.done { opacity: .6; }
.photos { display: flex; gap: 8px; flex-wrap: wrap; }
.photos figure { margin: 0; width: 120px; } .photos img { width: 120px; height: 120px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }
.photos figcaption { font-size: 12px; color: var(--muted); }
pre.report { white-space: pre-wrap; background: #f6f5f8; padding: 10px; border-radius: 8px; font-family: inherit; }
.bar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.muted { color: var(--muted); }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.pill { display: inline-block; background: var(--plum-soft); color: var(--plum); border-radius: 10px; padding: 0 8px; font-size: 12px; }
@media print { #topbar, #nav, .no-print { display: none !important; } main#view { margin: 0; } }

/* v1.1 프랜차이즈 */
.badge { display: inline-block; min-width: 18px; padding: 0 6px; border-radius: 9px; background: var(--bad); color: #fff; font-size: 11px; line-height: 18px; text-align: center; }
.alert { display: inline-block; font-size: 12px; padding: 1px 8px; margin: 2px 4px 2px 0; border-radius: 10px; background: #fff4e0; color: #9a5b00; }
.alert.bad { background: #fde8e8; color: var(--bad); }
.chip.draft { background: #eee; color: #555; } .chip.issued { background: #e8f0fe; color: #1a56db; } .chip.confirmed { background: #e6f6ec; color: var(--good); }
.chip.disputed { background: #fde8e8; color: var(--bad); } .chip.st-paid { background: #d8f0e0; color: var(--good); }
.chip.requested { background: #fff4e0; color: #9a5b00; } .chip.approved, .chip.shipped { background: #e8f0fe; color: #1a56db; } .chip.delivered { background: #e6f6ec; color: var(--good); }
.chip.rejected, .chip.cancelled { background: #eee; color: #666; }
.notice { border-left: 4px solid var(--brand, #4b3a6b); }
tr.me td { background: #f6f2fb; }

/* 태블릿·휴대폰 (좁은 화면 또는 터치 기기) */
.cal .tm { position: sticky; left: 0; z-index: 1; background: #fff; }            /* 예약 캘린더 가로 스크롤 시 시간 열 고정 */
.cal > .h:first-child { left: 0; z-index: 2; }
#nav-dim { display: none; }
@media (max-width: 900px), (pointer: coarse) {
  input[type=text], input[type=tel], input[type=password], input[type=number], input[type=date], input[type=datetime-local],
  input[type=month], input[type=search], input[type=time], input[type=url], select, textarea { font-size: 16px; } /* iOS 입력 시 화면 확대 방지 */
  .btn { min-height: 40px; }
  .btn.sm { min-height: 34px; padding: 6px 10px; }
  input[type=checkbox], input[type=radio] { width: 20px; height: 20px; flex: none; }
  .check { min-height: 36px; }
  .list .item a, .t td a { display: inline-block; padding: 6px 0; }                /* 목록 안 링크 누르는 영역 */
  #nav a { padding: 11px 16px; }
  .tabs button { padding: 10px 14px; }
  .tw { scrollbar-width: thin; }
}
@media (max-width: 900px) {
  #nav-dim { position: fixed; inset: 52px 0 0 0; background: rgba(20,15,30,.35); z-index: 19; }
  #nav.open ~ #nav-dim { display: block; }
  .modal-bg { padding: 16px 8px; }
  .modal { padding: 14px; }
  .modal .actions { position: sticky; bottom: -14px; background: #fff; padding: 10px 0 4px; }
}
@media print { .tw { overflow: visible; } .modal .actions { position: static; } }
