/* 장례 행사 공유 ERP — 직원용 화면과 고객용 일정표가 함께 쓰는 스타일 */
:root {
  --bg: #f4f5f7;
  --card: #ffffff;
  --ink: #1c2530;
  --sub: #5f6b79;
  --line: #dde2e8;
  --soft: #eef2f6;
  --pri: #2b4a68;
  --pri-ink: #ffffff;
  --pri-soft: #e4ecf4;
  --ok: #23724f;
  --warn: #9a5f0c;
  --bad: #b0372d;
  --bad-soft: #fbe9e7;
  --sans: "Pretendard", "Noto Sans KR", "Malgun Gothic", "Apple SD Gothic Neo", system-ui, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12171d; --card: #1a2129; --ink: #e6eaee; --sub: #9aa6b3; --line: #2b343e; --soft: #212a34;
    --pri: #8db1d6; --pri-ink: #0e1419; --pri-soft: #243242;
    --ok: #5cb88f; --warn: #e0a54c; --bad: #ec7d72; --bad-soft: #3a2220;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 15px/1.55 var(--sans); }
h1, h2, h3 { margin: 0; line-height: 1.3; text-wrap: balance; }
a { color: var(--pri); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--pri); outline-offset: 2px; }
.offscreen { position: fixed; left: -9999px; top: 0; }
.hidden { display: none !important; }
.muted { color: var(--sub); }
.small { font-size: 13px; }
.num { font-variant-numeric: tabular-nums; text-align: right; }
.neg { color: var(--bad); }

/* 버튼·입력 */
.btn { border: 1px solid var(--line); background: var(--card); padding: 8px 14px; border-radius: 6px; min-height: 38px; }
.btn:hover { background: var(--soft); }
.btn.primary { background: var(--pri); border-color: var(--pri); color: var(--pri-ink); font-weight: 600; }
.btn.primary:hover { filter: brightness(1.1); }
.btn.danger { color: var(--bad); border-color: var(--bad); }
.btn.sm { padding: 3px 10px; min-height: 30px; font-size: 13px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
input, select, textarea { width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--card); min-height: 38px; }
textarea { resize: vertical; }
/* 글자 입력칸은 한글 입력 상태로 시작 (지원하는 브라우저에서) */
input:not([type]), input[type=text], input[type=search], textarea { ime-mode: active; }
input[readonly] { background: var(--soft); }

/* 로그인·가입 */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.auth-card { width: 100%; max-width: 400px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 28px 24px; }
.auth-card h1 { font-size: 22px; margin-bottom: 4px; }
.tabs { display: flex; gap: 4px; margin: 18px 0 8px; border-bottom: 1px solid var(--line); }
.tab { border: 0; background: none; padding: 8px 14px; border-bottom: 2px solid transparent; margin-bottom: -1px; color: var(--sub); }
.tab[aria-selected="true"] { color: var(--pri); border-bottom-color: var(--pri); font-weight: 600; }
.stack { display: grid; gap: 12px; margin-top: 12px; }
.fld { display: grid; gap: 4px; min-width: 0; }
.fld > span { font-size: 13px; color: var(--sub); }
.msg { border-radius: 6px; padding: 9px 12px; font-size: 14px; }
.msg.err { background: var(--bad-soft); color: var(--bad); }
.msg.ok { background: var(--pri-soft); color: var(--ink); }

/* 틀 */
.topbar { position: sticky; top: 0; z-index: 20; background: var(--card); border-bottom: 1px solid var(--line); }
.topbar-in { max-width: 1120px; margin: 0 auto; padding: 8px 16px; display: flex; align-items: center; gap: 8px 16px; flex-wrap: wrap; }
.brand { font-weight: 700; font-size: 16px; margin-right: 8px; }
.nav { display: flex; gap: 2px; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: thin; flex: 1; min-width: 0; }
.nav a { text-decoration: none; color: var(--ink); padding: 6px 12px; border-radius: 6px; white-space: nowrap; }
a.btn { text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }
a.btn.primary { color: var(--pri-ink); }
.who a { color: var(--ink); text-decoration: none; white-space: nowrap; }
.who a:hover { text-decoration: underline; }
.who a[aria-current="page"] { font-weight: 600; }
.fld input, .fld select, .fld textarea { min-width: 0; }
.linkrow input { min-width: 0; }
.linkrow .btn, .actions .btn { white-space: nowrap; flex: none; }
.nav a:hover { background: var(--soft); }
.nav a[aria-current="page"] { background: var(--pri-soft); color: var(--pri); font-weight: 600; }
.badge { display: inline-block; min-width: 20px; padding: 0 6px; margin-left: 4px; border-radius: 99px; background: var(--bad); color: #fff; font-size: 12px; text-align: center; }
.who { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.page { max-width: 1120px; margin: 0 auto; padding: 16px 16px 64px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.page-head h1 { font-size: 20px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 16px; margin-bottom: 14px; }
.card > h2 { font-size: 16px; margin-bottom: 12px; }
.card > h2 .hint { font-weight: 400; font-size: 13px; color: var(--sub); margin-left: 8px; }

/* 목록 */
.toolbar { display: grid; grid-template-columns: minmax(160px, 3fr) minmax(120px, 1fr); gap: 8px; align-items: end; }
.summary { display: flex; gap: 8px 24px; flex-wrap: wrap; padding: 10px 2px 2px; font-size: 14px; }
.summary b { font-variant-numeric: tabular-nums; }
.tablewrap { overflow-x: auto; margin-top: 8px; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 9px 10px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
th { font-size: 12px; color: var(--sub); font-weight: 500; }
th.num, td.num { text-align: right; }
tbody tr[data-href] { cursor: pointer; }
tbody tr[data-href]:hover { background: var(--soft); }
td a { font-weight: 600; }
.tag { display: inline-block; padding: 1px 9px; border-radius: 99px; font-size: 12px; background: var(--soft); color: var(--sub); }
.tag.go { background: var(--pri-soft); color: var(--pri); }
.tag.done { color: var(--warn); }
.tag.paid { color: var(--ok); }
.pager { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 12px; }
.empty { text-align: center; padding: 36px 8px; color: var(--sub); }

/* 게시물 폼 */
.totalbar { position: sticky; top: 52px; z-index: 15; background: var(--pri); color: var(--pri-ink); border-radius: 8px; padding: 10px 16px; margin-bottom: 14px; display: flex; gap: 8px 28px; flex-wrap: wrap; align-items: baseline; }
.totalbar .t { font-size: 13px; opacity: .85; }
.totalbar b { font-size: 18px; font-variant-numeric: tabular-nums; margin-left: 6px; }
.totalbar .net b { font-size: 22px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.grid .wide { grid-column: 1 / -1; }
.money-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px 20px; }
.mrow { display: grid; grid-template-columns: minmax(70px, 110px) 1fr; align-items: center; gap: 8px; }
.mrow > span { font-size: 14px; }
.mrow input.money { text-align: right; font-variant-numeric: tabular-nums; }
.mrow.extra { grid-template-columns: 1fr 1fr; }
.xinc-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px 20px; }
.xinc { display: grid; grid-template-columns: 1fr 1fr 74px; gap: 6px 8px; align-items: center; }
.xinc .pct { display: flex; align-items: center; gap: 4px; }
.xinc .pct input { text-align: right; min-width: 0; }
.xinc .money { text-align: right; font-variant-numeric: tabular-nums; }
.xinc.item { grid-template-columns: minmax(60px, 90px) 1fr 74px; }
.xinc .xl { font-size: 14px; }
.hlist { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px 20px; }
.hrow { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 8px; align-items: center; border: 1px solid var(--line); border-radius: 8px; padding: 8px; }
.hrow .money { text-align: right; font-variant-numeric: tabular-nums; }
.hrow .hpay { grid-column: 1 / -1; font-size: 13px; color: var(--sub); text-align: right; }
.hrow .hpay b { color: var(--ink); font-variant-numeric: tabular-nums; }
.hrow .rrn-row { grid-column: 1 / -1; }
.mrow input[readonly] { background: var(--soft); text-align: right; }
.dhint { display: block; min-height: 1.2em; margin-top: 2px; font-size: 13px; color: var(--pri); font-weight: 600; }
.tl-tools { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; margin-top: 8px; }
.xinc .xs { grid-column: 1 / -1; font-size: 13px; color: var(--sub); text-align: right; }
.xinc .xs b { color: var(--ink); font-variant-numeric: tabular-nums; }
.sub-block { border-top: 1px dashed var(--line); margin-top: 14px; padding-top: 12px; }
.sub-block h3 { font-size: 14px; margin-bottom: 8px; }
.calc { font-size: 13px; color: var(--sub); padding: 2px 0; }
.calc b { color: var(--ink); font-variant-numeric: tabular-nums; }
.note { font-size: 13px; color: var(--sub); margin: 0 0 10px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; margin-top: 8px; }
.savebar { position: sticky; bottom: 0; background: var(--bg); padding: 10px 0; display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; border-top: 1px solid var(--line); }
.rrn-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.rrn-val { font-variant-numeric: tabular-nums; letter-spacing: .03em; }
.sharebox { background: var(--soft); border-radius: 8px; padding: 12px; margin-top: 12px; display: grid; gap: 8px; }
.sharebox input { background: var(--card); }
.linkrow { display: flex; gap: 8px; }

/* 대화상자·알림 */
dialog { border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: var(--ink); padding: 20px; width: min(420px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(8, 12, 16, .55); }
.dlg h3 { font-size: 17px; margin-bottom: 8px; }
.dlg-body { display: grid; gap: 10px; margin-bottom: 14px; }
.dlg-actions { display: flex; flex-direction: row-reverse; gap: 8px; justify-content: flex-start; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 10px 18px; border-radius: 8px; z-index: 100; max-width: calc(100vw - 32px); }

/* 고객용 일정표 */
.sch-wrap { max-width: 520px; margin: 0 auto; padding: 24px 16px 56px; }
.sch-card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 24px 20px; }
.sch-eyebrow { font-size: 13px; color: var(--sub); letter-spacing: .08em; }
.sch-name { font-size: 26px; margin: 6px 0 4px; }
.sch-sub { color: var(--sub); margin: 0 0 20px; }
.sch-sec { border-top: 1px solid var(--line); padding: 16px 0 4px; }
.sch-sec h2 { font-size: 14px; color: var(--sub); font-weight: 600; margin-bottom: 10px; }
.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.timeline li { display: grid; grid-template-columns: 78px 1fr; gap: 10px; align-items: baseline; }
.timeline .k { color: var(--sub); font-size: 14px; }
.timeline .v { font-size: 17px; font-weight: 600; font-variant-numeric: tabular-nums; }
.timeline li.key .v { color: var(--pri); }
.agent { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; background: var(--pri-soft); border-radius: 10px; padding: 12px 14px; }
.agent-name { font-size: 18px; font-weight: 700; }
.agent-call { display: inline-flex; flex-direction: column; align-items: flex-end; font-size: 18px; font-weight: 700; color: var(--pri); text-decoration: none; font-variant-numeric: tabular-nums; }
.agent-call span { font-size: 12px; font-weight: 400; color: var(--sub); }
.timeline .dn { color: var(--pri); margin-right: 4px; }
.timeline small { display: block; font-size: 13px; font-weight: 400; color: var(--sub); }
.timeline small.tn { color: var(--warn); }
.place { margin-bottom: 12px; }
.place .n { font-size: 17px; font-weight: 600; }
.place .l { font-size: 13px; color: var(--sub); }
.place .a { font-size: 15px; }
.place a { font-size: 14px; }
.contact { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 6px 0; }
.sch-notice { white-space: pre-wrap; font-size: 15px; line-height: 1.7; }
.sch-notice.tl { font-size: 17px; font-weight: 600; line-height: 1.9; font-variant-numeric: tabular-nums; }
.sch-foot { margin-top: 18px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 13px; color: var(--sub); }

/* 고객용 일정표 (새 디자인) — 밝은 색 고정 */
body:has(.sx) { background: #e9edf1; }
.sx-wrap-fix { display: none; }
.sx { --sx-navy: #1f3347; --sx-navy2: #2d4a66; --sx-gold: #b08d57; --sx-ivory: #faf8f4; --sx-ink: #25303b; --sx-sub: #6a7480; --sx-line: #e6e1d8;
  max-width: 520px; margin: 0 auto; background: var(--sx-ivory); color: var(--sx-ink); color-scheme: light; min-height: 100vh; box-shadow: 0 0 40px rgba(20, 35, 50, .12); }
.sx-hero { position: relative; text-align: center; padding: 36px 20px 44px; color: #fff; background: linear-gradient(180deg, var(--sx-navy) 0%, var(--sx-navy2) 100%); }
.sx-hero::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 22px; background: var(--sx-ivory); border-radius: 22px 22px 0 0; }
.sx-hero.small { padding: 40px 20px 52px; }
.sx-brand { font-size: 26px; font-weight: 700; letter-spacing: .1em; line-height: 1.3; color: #e3cf9f; margin-bottom: 16px; overflow-wrap: anywhere; }
.sx-flower { display: block; margin: 0 auto 10px; }
.sx-flower .p1 { fill: #ffffff; fill-opacity: .55; stroke: #fff; stroke-opacity: .25; stroke-width: .5; }
.sx-flower .p2 { fill: #ffffff; fill-opacity: .8; stroke: #d9c9a8; stroke-opacity: .5; stroke-width: .4; }
.sx-flower .p3 { fill: #fffdf6; stroke: #d9c9a8; stroke-opacity: .6; stroke-width: .4; }
.sx-flower .pc { fill: var(--sx-gold); }
.sx-pre { font-size: 14px; color: #d3dce6; margin-top: 4px; }
.sx-title { font-size: 30px; font-weight: 700; margin: 8px 0 2px; letter-spacing: .02em; font-family: "Noto Serif KR", "Nanum Myeongjo", "Batang", serif; }
.sx-han { font-weight: 400; color: #e3cf9f; margin-right: 2px; }
.sx-sub { font-size: 15px; color: #d9c9a8; letter-spacing: .3em; margin-top: 4px; }
.sx-body { padding: 4px 20px 40px; }
.sx-sec { padding: 14px 0 6px; }
.sx-h { font-size: 15px; font-weight: 700; color: var(--sx-navy); margin: 0 0 12px; display: flex; align-items: center; gap: 8px; }
.sx-h::before { content: ""; width: 4px; height: 16px; border-radius: 2px; background: var(--sx-gold); }
.sx-agent { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; background: #fff; border: 1px solid var(--sx-line); border-radius: 14px; padding: 14px 16px; box-shadow: 0 2px 8px rgba(31, 51, 71, .06); }
.sx-agent-role { font-size: 12px; color: var(--sx-sub); }
.sx-agent-name { font-size: 20px; font-weight: 700; margin-top: 2px; }
.sx-call { display: flex; flex-direction: column; align-items: center; gap: 2px; background: var(--sx-navy); color: #fff; text-decoration: none; padding: 10px 18px; border-radius: 12px; }
.sx-call-n { font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; }
.sx-call-t { font-size: 12px; color: #d9c9a8; }
.sx-steps { list-style: none; margin: 0; padding: 0 0 0 4px; position: relative; }
.sx-steps::before { content: ""; position: absolute; left: 10px; top: 14px; bottom: 14px; width: 2px; background: var(--sx-line); }
.sx-step { position: relative; display: flex; gap: 14px; padding: 8px 0; }
.sx-dot { position: relative; z-index: 1; flex: none; width: 14px; height: 14px; margin-top: 5px; border-radius: 50%; background: #fff; border: 3px solid var(--sx-gold); }
.sx-step-in { flex: 1; background: #fff; border: 1px solid var(--sx-line); border-radius: 12px; padding: 10px 14px; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.sx-step-l { font-size: 15px; line-height: 1.5; }
.sx-step-t { font-size: 18px; font-weight: 700; color: var(--sx-navy); white-space: nowrap; font-variant-numeric: tabular-nums; }
.sx-place { display: flex; align-items: center; gap: 12px; background: #fff; border: 1px solid var(--sx-line); border-radius: 12px; padding: 12px 14px; margin-bottom: 8px; }
.sx-place-l { font-size: 12px; color: #fff; background: var(--sx-navy2); border-radius: 20px; padding: 3px 10px; white-space: nowrap; }
.sx-place-n { font-size: 16px; font-weight: 600; }
.sx-text { white-space: pre-wrap; font-size: 15px; line-height: 1.75; background: #fff; border: 1px solid var(--sx-line); border-radius: 12px; padding: 14px 16px; }
.sx-foot { margin-top: 22px; text-align: center; font-size: 12.5px; line-height: 1.7; color: var(--sx-sub); }

@media (max-width: 860px) {
  .topbar { position: static; }
  .toolbar { grid-template-columns: 1fr 1fr; }
  .toolbar .q { grid-column: 1 / -1; }
  .totalbar { top: 0; }
}
@media (max-width: 700px) {
  .brand { flex: 1; }
  .nav { order: 3; flex: 1 1 100%; }
}
@media (max-width: 560px) {
  .page { padding-left: 12px; padding-right: 12px; }
  .card { padding: 14px 12px; }
  .mrow { grid-template-columns: 90px 1fr; }
  .totalbar b { font-size: 16px; }
  .totalbar .net b { font-size: 19px; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }

.cred { background: var(--soft); border: 1px solid var(--line); border-radius: 6px; padding: 10px; user-select: all; white-space: pre-wrap; word-break: break-all; }
.warn-t { color: #ffb4a8; }

/* 고객용 일정표 — 모바일 최적화 */
.sx { overflow-x: hidden; }
.sx * { min-width: 0; }
.sx-agent { flex-direction: column; align-items: stretch; gap: 12px; }
.sx-call { flex-direction: row; justify-content: center; align-items: center; gap: 10px; padding: 14px 16px; border-radius: 14px; min-height: 56px; }
.sx-call-i { flex: none; color: #e3cf9f; }
.sx-call-n { font-size: 20px; letter-spacing: .02em; }
.sx-call-t { font-size: 13px; padding-left: 10px; border-left: 1px solid rgba(255,255,255,.3); }
.sx-step-in { flex-wrap: wrap; row-gap: 2px; }
.sx-step-l { overflow-wrap: anywhere; }
.sx-place { flex-wrap: wrap; }
.sx-text { overflow-wrap: anywhere; }
@media (max-width: 400px) {
  .sx-hero { padding: 28px 16px 40px; }
  .sx-title { font-size: 27px; }
  .sx-body { padding: 4px 14px 32px; }
  .sx-step-in { padding: 10px 12px; }
  .sx-step-t { font-size: 17px; }
  .sx-call-t { display: none; }
}
@media (min-width: 560px) {
  .sx { margin-top: 24px; margin-bottom: 24px; border-radius: 20px; overflow: hidden; min-height: 0; }
}

/* 수입·지출: 접고 펼치기, 줄 추가 */
.fold > summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: -4px 0 0; }
.fold > summary::-webkit-details-marker { display: none; }
.fold > summary h2 { font-size: 16px; margin: 0; }
.fold > summary h2 .hint { font-weight: 400; font-size: 13px; color: var(--sub); margin-left: 8px; }
.fold[open] > summary { margin-bottom: 12px; }
.fold-t { flex: none; width: 30px; height: 30px; border: 1px solid var(--line); border-radius: 50%; position: relative; background: var(--soft); }
.fold-t::before { content: ""; position: absolute; left: 10px; top: 10px; width: 7px; height: 7px; border-right: 2px solid var(--sub); border-bottom: 2px solid var(--sub); transform: rotate(-135deg); top: 12px; }
.fold:not([open]) .fold-t::before { transform: rotate(45deg); top: 8px; }
.fold > summary:focus-visible { outline: 2px solid var(--pri); outline-offset: 4px; border-radius: 6px; }
.xinc-list.lines { grid-template-columns: 1fr; gap: 10px; }
.xinc.line { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) 74px 34px; }
.xinc.line.ex { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) 34px; }
.iconbtn { width: 34px; height: 34px; border: 1px solid var(--line); background: var(--card); color: var(--sub); border-radius: 8px; font-size: 18px; line-height: 1; cursor: pointer; }
.iconbtn:hover { color: var(--bad); border-color: var(--bad); }
.addbtn { margin-top: 10px; display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px 8px 8px; border: 1px dashed var(--pri); background: var(--pri-soft); color: var(--pri); border-radius: 22px; font-size: 14px; font-weight: 600; cursor: pointer; }
.addbtn .plus { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--pri); color: var(--pri-ink); font-size: 20px; line-height: 1; }
.sub-block.first { border-top: 0; margin-top: 0; padding-top: 0; }
.money-grid.dh { margin-top: 14px; }
@media (max-width: 560px) {
  .xinc.line { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 34px; }
  .xinc.line .pct { grid-column: 1 / 3; justify-content: flex-start; }
  .xinc.line .pct input { width: 72px; }
  .xinc.line.ex { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 34px; }
}
@media (max-width: 560px) { .xinc.line .del { grid-column: 3; grid-row: 1; } }

/* 장례일정표: 날짜별 묶음 */
.sx-day { margin-bottom: 18px; background: #fff; border: 1px solid var(--sx-line); border-radius: 16px; overflow: hidden; box-shadow: 0 2px 8px rgba(31, 51, 71, .06); }
.sx-dayhead { display: flex; align-items: baseline; gap: 10px; padding: 12px 18px; background: linear-gradient(90deg, var(--sx-navy) 0%, var(--sx-navy2) 100%); color: #fff; }
.sx-date { font-size: 21px; font-weight: 700; letter-spacing: .01em; }
.sx-wd { font-size: 13px; font-weight: 600; color: var(--sx-navy); background: #e3cf9f; border-radius: 20px; padding: 2px 10px; }
.sx-rows { list-style: none; margin: 0; padding: 6px 0; }
.sx-row { display: grid; grid-template-columns: 64px 1fr; gap: 12px; align-items: baseline; padding: 11px 18px; position: relative; }
.sx-row + .sx-row { border-top: 1px dashed var(--sx-line); }
.sx-time { font-size: 19px; font-weight: 800; color: var(--sx-navy); font-variant-numeric: tabular-nums; letter-spacing: .01em; }
.sx-what { font-size: 16px; line-height: 1.55; overflow-wrap: anywhere; }
.sx-row.note .sx-what { grid-column: 1 / -1; color: var(--sx-sub); font-size: 14px; }
@media (max-width: 400px) {
  .sx-row { grid-template-columns: 56px 1fr; gap: 10px; padding: 11px 14px; }
  .sx-time { font-size: 18px; }
  .sx-dayhead { padding: 11px 14px; }
}

[hidden] { display: none !important; }

/* 목록 검색: 검색칸 하나 */
.toolbar { grid-template-columns: minmax(160px, 4fr) minmax(90px, 1fr); }

/* 정산내역서 — 종이처럼 항상 밝게 */
.q-ctl .mrow { max-width: 260px; }
.quote { --q-navy: #1f3347; --q-gold: #b08d57; --q-line: #e3e6ea; --q-sub: #66717d; color-scheme: light;
  max-width: 760px; margin: 0 auto 24px; background: #fff; color: #1c2530; border: 1px solid var(--q-line); border-radius: 14px; padding: 36px 40px 28px; box-shadow: 0 6px 24px rgba(20, 35, 50, .08); }
.q-head { display: flex; justify-content: space-between; align-items: flex-end; border-bottom: 3px solid var(--q-navy); padding-bottom: 14px; }
.q-kicker { font-size: 11px; letter-spacing: .3em; color: var(--q-gold); font-weight: 700; }
.q-head h1 { font-size: 30px; margin: 2px 0 0; color: var(--q-navy); letter-spacing: .12em; }
.q-date { font-size: 13px; color: var(--q-sub); }
.q-to { margin: 20px 0 14px; font-size: 17px; }
.q-to b { font-size: 22px; border-bottom: 2px solid var(--q-gold); padding-bottom: 2px; margin-right: 6px; }
.q-info { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0; margin: 0 0 22px; border: 1px solid var(--q-line); border-radius: 10px; overflow: hidden; }
.q-info > div { display: grid; grid-template-columns: 84px 1fr; border-bottom: 1px solid var(--q-line); }
.q-info dt { background: #f4f6f8; color: var(--q-sub); font-size: 13px; padding: 9px 12px; }
.q-info dd { margin: 0; padding: 9px 12px; font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }
.q-sec { margin-bottom: 20px; }
.q-sec h2 { display: flex; justify-content: space-between; align-items: baseline; font-size: 15px; margin: 0 0 8px; padding-left: 10px; border-left: 4px solid var(--q-navy); }
.q-sec.exp h2 { border-left-color: #a5553f; }
.q-sec h2 b { font-size: 16px; font-variant-numeric: tabular-nums; }
.quote table { width: 100%; border-collapse: collapse; font-size: 14px; }
.quote th { background: var(--q-navy); color: #fff; font-weight: 600; text-align: left; padding: 8px 12px; font-size: 13px; }
.q-sec.exp th { background: #6d4a40; }
.quote td { padding: 9px 12px; border-bottom: 1px solid var(--q-line); color: #1c2530; }
.quote tbody tr:nth-child(even) td { background: #fafbfc; }
.quote .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.quote td.b { font-weight: 700; }
.quote td small { color: var(--q-sub); font-size: 12px; margin-left: 4px; }
.quote td.none { text-align: center; color: var(--q-sub); }
.quote tfoot td { background: #f4f6f8; font-weight: 700; border-bottom: 0; border-top: 2px solid var(--q-navy); }
.q-total { background: var(--q-navy); color: #fff; border-radius: 12px; padding: 16px 20px; margin: 24px 0 20px; display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.q-eq { font-size: 13px; color: #c9d4df; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-variant-numeric: tabular-nums; }
.q-eq i { font-style: normal; color: #e3cf9f; }
.q-net { display: flex; align-items: baseline; gap: 12px; }
.q-net span { font-size: 14px; color: #e3cf9f; letter-spacing: .2em; }
.q-net b { font-size: 28px; font-variant-numeric: tabular-nums; }
.q-net b.neg { color: #ffb4a8; }
.q-split h2 { font-size: 15px; margin: 0 0 10px; padding-left: 10px; border-left: 4px solid var(--q-gold); }
.q-bar { display: block; width: 100%; height: 12px; border-radius: 6px; overflow: hidden; }
.q-bar .client { fill: var(--q-gold); }
.q-bar .mine { fill: var(--q-navy); }
.q-shares { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }
.q-share { border: 1px solid var(--q-line); border-radius: 12px; padding: 14px 16px; border-top: 4px solid var(--q-navy); }
.q-share.client { border-top-color: var(--q-gold); }
.q-share .who { font-size: 14px; color: var(--q-sub); font-weight: 600; overflow-wrap: anywhere; }
.q-share .pct { font-size: 14px; font-weight: 700; color: var(--q-navy); margin-top: 2px; }
.q-share.client .pct { color: #8a6a36; }
.q-share .amt { font-size: 24px; font-weight: 800; margin-top: 4px; font-variant-numeric: tabular-nums; }
.q-foot { margin-top: 18px; font-size: 12px; color: var(--q-sub); text-align: center; }
@media (max-width: 560px) {
  .quote { padding: 22px 16px 18px; border-radius: 10px; }
  .q-head h1 { font-size: 24px; }
  .q-info { grid-template-columns: 1fr; }
  .quote td, .quote th { padding: 8px 8px; }
  .q-net b { font-size: 24px; }
  .q-share .amt { font-size: 20px; }
}
.q-h2 { font-size: 15px; margin: 0 0 8px; padding-left: 10px; border-left: 4px solid var(--q-gold); }
.q-info > div { grid-template-columns: 112px 1fr; }
.q-head h1 { letter-spacing: .3em; }

/* 정산내역서: 고인 정보 한 줄 */
.q-person { display: grid; grid-template-columns: 1.6fr repeat(4, minmax(0, 1fr)); margin: 0 0 8px; border: 1px solid var(--q-line); border-radius: 10px; overflow: hidden; }
.q-person > div { border-right: 1px solid var(--q-line); min-width: 0; }
.q-person > div:last-child { border-right: 0; }
.q-person dt { background: #f4f6f8; color: var(--q-sub); font-size: 12px; text-align: center; padding: 6px 4px; }
.q-person dd { margin: 0; padding: 9px 6px; text-align: center; font-size: 15px; font-weight: 700; overflow-wrap: anywhere; }
@media (max-width: 560px) { .q-person dd { font-size: 13px; padding: 8px 2px; } .q-person dt { font-size: 11px; } }
.q-person { grid-template-columns: 1.5fr repeat(5, minmax(0, 1fr)); }
.q-person.q-money { grid-template-columns: repeat(5, minmax(0, 1fr)); margin-bottom: 10px; }
.q-person.q-money dd { text-align: right; padding-right: 10px; font-variant-numeric: tabular-nums; }
@media (max-width: 560px) { .q-person.q-money dd { padding-right: 6px; font-size: 12px; } .q-person dd { font-size: 12px; } }

/* 수입: 정산내역서 표시 체크박스 */
.showchk { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--sub); cursor: pointer; }
.showchk input { width: 16px; height: 16px; accent-color: var(--pri); }
.showchk.top { margin-top: 10px; }
.xinc .xs { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.q-person.q-money { grid-template-columns: repeat(4, minmax(0, 1fr)); }

/* ===== 정산내역서 A4 한 장 (화면·인쇄·이미지 공통) ===== */
@page { size: A4 portrait; margin: 0; }
#quoteBox { overflow: hidden; }
.q-scale { width: 793px; transform-origin: top left; margin: 0 auto; }
.quote { width: 793px; height: 1122px; max-width: none; margin: 0; padding: 36px 40px; border-radius: 0; box-sizing: border-box; overflow: hidden; position: relative; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.quote * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.q-fit { transform-origin: top left; }
.quote .q-head { padding-bottom: 10px; }
.quote .q-head h1 { font-size: 26px; }
.quote .q-to { margin: 12px 0 10px; font-size: 15px; }
.quote .q-to b { font-size: 19px; }
.quote .q-h2, .quote .q-sec h2, .quote .q-split h2 { font-size: 14px; }
.quote .q-info { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-bottom: 14px; }
.quote .q-info > div { grid-template-columns: 104px 1fr; }
.quote .q-info dt { font-size: 12px; padding: 6px 10px; }
.quote .q-info dd { font-size: 13px; padding: 6px 10px; }
.quote .q-person { grid-template-columns: 1.5fr repeat(5, minmax(0, 1fr)); margin-bottom: 6px; }
.quote .q-person dt { font-size: 11px; padding: 4px; }
.quote .q-person dd { font-size: 13px; padding: 6px 4px; }
.quote .q-person.q-money { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 8px; }
.quote .q-person.q-money dd { padding-right: 10px; }
.quote .q-sec { margin-bottom: 12px; }
.quote table { font-size: 13px; }
.quote th { padding: 6px 10px; font-size: 12px; }
.quote td { padding: 6px 10px; }
.quote .q-total { margin: 14px 0 12px; padding: 12px 18px; }
.quote .q-net b { font-size: 24px; }
.quote .q-shares { margin-top: 8px; gap: 10px; }
.quote .q-share { padding: 10px 14px; }
.quote .q-share .amt { font-size: 20px; margin-top: 2px; }
.quote .q-foot { margin-top: 10px; }
.quote .q-bar { height: 10px; }
@media print {
  .topbar, .noprint, .toast { display: none !important; }
  html, body { background: #fff !important; margin: 0 !important; }
  .page { max-width: none !important; padding: 0 !important; margin: 0 !important; }
  #quoteBox { overflow: visible; }
  .q-scale { transform: none !important; height: auto !important; margin: 0 !important; }
  .quote { border: 0; box-shadow: none; margin: 0; break-inside: avoid; page-break-after: avoid; }
}

/* 수입(좌) · 지출(우) 나란히 */
.quote .q-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.quote .q-cols .q-sec { margin-bottom: 0; }
.quote .q-cols .q-sec h2 { margin-bottom: 8px; }
.quote .q-cols .q-person.q-money { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.quote .q-cols .q-person.q-money > div { border-bottom: 1px solid var(--q-line); }
.quote .q-cols .q-person.q-money > div:nth-last-child(-n+2) { border-bottom: 0; }
.quote .q-cols .q-person.q-money > div:nth-child(2n) { border-right: 0; }
.quote .q-cols td, .quote .q-cols th { padding: 5px 8px; }
.quote .q-cols table { font-size: 12.5px; }
.quote .q-cols .q-person.q-money dd { padding-right: 8px; }

/* ===== 사이드바 레이아웃 (직책별 메뉴) ===== */
.shell { display: grid; grid-template-columns: 224px minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--card); border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 14px 10px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.side-logo { font-weight: 800; font-size: 18px; color: var(--pri); padding: 6px 10px 12px; text-decoration: none; border-bottom: 1px solid var(--line); }
.side-me { display: flex; flex-direction: column; padding: 10px 12px; margin: 10px 0 8px; border-radius: 10px; text-decoration: none; color: var(--ink); background: var(--soft); }
.side-me span { font-size: 12px; color: var(--sub); }
.side-me[aria-current="page"] { outline: 2px solid var(--pri); }
.side-nav a { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; border-radius: 8px; color: var(--ink); text-decoration: none; margin-bottom: 2px; }
.side-nav a:hover { background: var(--soft); }
.side-nav a[aria-current="page"] { background: var(--pri); color: var(--pri-ink); font-weight: 700; }
.side-nav hr { border: 0; border-top: 1px dashed var(--line); margin: 8px 4px; }
.side-foot { margin-top: auto; padding: 10px 4px 0; }
.side-main { min-width: 0; }
.mbar, .side-dim { display: none; }
@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; left: 0; top: 0; bottom: 0; width: 244px; z-index: 60; transform: translateX(-102%); transition: transform .2s; }
  body.side-open .side { transform: none; box-shadow: 4px 0 24px rgba(0, 0, 0, .3); }
  .mbar { display: flex; align-items: center; gap: 10px; padding: 8px 12px; background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 40; }
  body.side-open .side-dim { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, .45); z-index: 55; }
}

/* ===== 회원 · 정산 · 리그 공통 ===== */
.tag.mem { background: #e0f2f1; color: #0d6b64; }
.tag.won { background: #f1e9ff; color: #5b3aa0; }
.tag.pre { background: var(--soft); color: var(--sub); }
.tag.warn { background: #fdecea; color: var(--bad); }
.ok-note { background: var(--pri-soft); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; color: var(--ink); font-size: 14px; }
.ok-t { color: var(--ok); }
.btn.big { padding: 10px 20px; font-size: 16px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.fld.grow { flex: 1; min-width: 240px; }
.pv { margin: 8px 0; }
.pv .fld div { padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--soft); min-height: 38px; }
.mtool { grid-template-columns: minmax(160px, 4fr) minmax(110px, 1fr) minmax(90px, 1fr) !important; }
.cards3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; margin: 8px 0 14px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.stat small { color: var(--sub); }
.stat b { display: block; font-size: 21px; margin-top: 2px; font-variant-numeric: tabular-nums; }
.paytabs { margin-top: 4px; }
.paytabs .tab.on { color: var(--pri); border-bottom-color: var(--pri); font-weight: 700; }
.pay { border: 1px solid var(--line); border-radius: 12px; margin-bottom: 14px; overflow: hidden; background: var(--card); }
.pay-h { background: #1f3347; color: #fff; padding: 12px 16px; display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.pay-h .acct { font-size: 13px; color: #d9c9a8; margin-top: 2px; }
.pay-h .acct .btn { margin-left: 6px; }
.pay-h .total { font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; }
.pay-h .total small { font-size: 12px; font-weight: 400; color: #c9d4df; margin-right: 8px; }
.pay .warn-t { color: #ffb4a8; }
.pay .tablewrap { padding: 0 6px 6px; }
.cinput { width: 110px; text-align: right; }
.league { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; }
.league tr.rank1 td:first-child { font-weight: 800; color: #b08d57; }
.league tr.me td { background: #fff8e6; font-weight: 700; color: #3b2f12; }
.league tr.gap td { text-align: center; color: var(--sub); }
.pre { white-space: pre-wrap; }
dialog.noticedlg { border: 0; border-radius: 16px; padding: 0; max-width: 420px; width: calc(100% - 32px); overflow: hidden; background: var(--card); color: var(--ink); }
dialog.noticedlg::backdrop { background: rgba(8, 12, 16, .55); }
.np-h { background: linear-gradient(90deg, #1f3347, #2d4a66); color: #fff; padding: 14px 18px; font-weight: 700; }
.np-b { padding: 18px; line-height: 1.7; }
.np-f { display: flex; gap: 8px; padding: 0 18px 18px; flex-wrap: wrap; }
.np-f .btn { flex: 1; min-width: 110px; }

/* ===== 직급·영입·회원 상세 입력 ===== */
.req { color: var(--bad); }
.subh { font-size: 14px; margin: 16px 0 8px; padding-top: 12px; border-top: 1px dashed var(--line); color: var(--sub); }
.rates { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px 14px; }
.pctbox { display: flex; align-items: center; gap: 4px; }
.pctbox input { width: 80px; text-align: right; }
.pctbox i { font-style: normal; color: var(--sub); }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.rankcards .stat b { font-size: 19px; font-weight: 600; }
.rankcards .stat b b { font-size: 26px; color: var(--pri); }
#salesSignup { margin-top: 2px; }

/* ===== 상담 기록 · 연락 알림 ===== */
.remind { border-left: 4px solid var(--warn); }
.remlist { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 6px; }
.remlist li { padding: 6px 0; border-bottom: 1px dashed var(--line); }
.remind details { margin-top: 8px; }
.notes { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 10px; }
.notes li { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: var(--soft); }
.notes .nh { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 4px; }
.notes .nh .btn { margin-left: auto; }
.duechk { align-self: end; padding-bottom: 8px; }
.mtool { grid-template-columns: minmax(160px, 4fr) minmax(110px, 1fr) minmax(90px, 1fr) auto !important; }

/* ===== 수수료 지급명세서 ===== */
.quote .q-person.five { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.quote.stmt .q-person.five dd { font-size: 13px; }
.q-chip { display: inline-block; font-size: 11px; padding: 0 7px; border-radius: 99px; background: #e4ecf4; color: #1f3347; font-weight: 700; }
.muted-s { color: var(--q-sub); font-size: 11px; }
.quote.stmt .q-total { margin: 16px 0 12px; }
.q-scale + .q-scale { margin-top: 16px; }
.tips { margin: 0; padding-left: 18px; display: grid; gap: 6px; line-height: 1.6; }
@media print { .q-scale + .q-scale { margin-top: 0; break-before: page; page-break-before: always; } }

/* 정산내역서: 상품(한 줄) — 수입·지출 위에 따로 */
.quote .q-sec.prod { margin-bottom: 10px; }
.quote .q-sec.prod h2 b { font-size: 13px; font-weight: 600; color: var(--q-sub); }
.quote .q-sec.prod .q-person.q-money { grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 0; }
.quote .q-sec.prod .q-person.q-money dd { text-align: right; padding-right: 12px; font-size: 14px; }

/* 지출 품목: 자동으로 생기는 줄(도우미·원청 정산금) */
.autolines { display: grid; gap: 10px; margin-top: 10px; }
.autolines:empty { display: none; }
.xinc.line.ex.auto input { background: var(--soft); }
.autotag { display: inline-grid; place-items: center; height: 34px; padding: 0 8px; border-radius: 8px; background: var(--pri-soft); color: var(--pri); font-size: 12px; font-weight: 700; }

/* 사전상담 */
.consults li.is-done { background: var(--paper, #fff); }
.consults .cdone { margin-top: 8px; padding: 8px 10px; border-left: 3px solid var(--ok); background: #fff; border-radius: 6px; }
.consults .cact { margin-top: 8px; }
.consults .cact form { margin-top: 8px; }
.consults .nh { margin-bottom: 2px; }
.tabs { display: flex; gap: 6px; margin-bottom: 8px; }

/* 장례 상품 · 영업사원 검색 */
.tsearch { max-width: 360px; margin-bottom: 10px; }
.pcard__head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px; margin-bottom: 8px; }
.pcard__head h2 { margin: 0; }
.pcard__price b { font-size: 24px; }
.pgroups { margin: 0; }
.pgroups > div { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 8px; padding: 8px 0; border-top: 1px solid var(--line, #e5e7eb); }
.pgroups dt { font-weight: 600; }
.pgroups dd { margin: 0; }
.pgroups ul { margin: 0; padding: 0; list-style: none; }
.pgroups li { display: flex; gap: 12px; padding: 2px 0; }
.pgroups .k { flex: 0 0 150px; color: var(--sub, #6b7280); }
.plist { margin: 4px 0 12px; padding-left: 20px; }
.plist li { margin-bottom: 4px; line-height: 1.6; }
.pcmp { overflow-x: auto; }
.pcmp .pt { min-width: 860px; width: 100%; border-collapse: collapse; font-size: 14px; }
.pcmp .pt th, .pcmp .pt td { padding: 8px 10px; text-align: center; vertical-align: top; border-bottom: 1px solid var(--line, #e5e7eb); border-left: 1px solid var(--line, #e5e7eb); }
.pcmp .pt thead th { border-bottom: 2px solid #1f2937; vertical-align: bottom; }
.pcmp .pt .pt__g, .pcmp .pt .pt__i { text-align: left; border-left: 0; font-weight: 600; width: 14%; }
.pcmp .pt .pt__i { font-weight: 400; color: var(--sub, #6b7280); }
.pcmp .pt .pt__name { display: block; }
.pcmp .pt .pt__price { display: block; font-size: 18px; font-weight: 600; }
.pcmp .pt .pt__basis { display: block; font-size: 12px; color: var(--sub, #6b7280); font-weight: 400; }
.pcmp .pt tr.is-same td { color: var(--sub, #6b7280); }
.pcmp .pt tr.is-diff td { font-weight: 600; }
@media (max-width: 700px) { .pgroups > div { grid-template-columns: 1fr; } .pgroups .k { flex-basis: 110px; } }

.rphotos { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.rphotos img { width: 96px; height: 96px; object-fit: cover; border-radius: 4px; border: 1px solid var(--line, #e5e7eb); }
