:root {
  --bg: #f4f6f9;
  --card: #ffffff;
  --text: #1c2430;
  --muted: #6b7684;
  --line: #e3e7ee;
  --primary: #3b6fd6;
  --primary-dark: #2f5bb5;
  --danger: #d64545;
  --warn: #c98a12;
  --ok: #2f9e6b;
  --radius: 10px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Malgun Gothic", "맑은 고딕", "Noto Sans KR", "Noto Sans CJK KR", "NanumGothic", "Apple SD Gothic Neo", system-ui, sans-serif;
  background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.5;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 0; }
h2 { font-size: 16px; margin: 0 0 12px; }
h3 { font-size: 14px; margin: 18px 0 8px; }
code { background: #eef1f6; padding: 1px 5px; border-radius: 4px; font-size: 12px; }
.pre { background: #eef1f6; padding: 10px; border-radius: 6px; white-space: pre-wrap; word-break: break-all; }

/* ---------- 상단 메뉴 ---------- */
.topbar { background: #1c2430; color: #fff; position: sticky; top: 0; z-index: 50; box-shadow: 0 1px 0 rgba(255,255,255,.06); }
.topbar-inner { max-width: 1280px; margin: 0 auto; display: flex; align-items: center; gap: 16px; padding: 0 20px; height: 54px; }
.brand { color: #fff; font-weight: 700; font-size: 16px; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.nav { display: flex; align-items: center; gap: 2px; }
.nav > a, .nav > details > summary { color: #c9d1dd; padding: 7px 12px; border-radius: 7px; white-space: nowrap; font-size: 14px; line-height: 1.3; }
.nav > a:hover, .nav > details > summary:hover { background: rgba(255,255,255,.08); text-decoration: none; color: #fff; }
.nav > a.active, .nav > details.active > summary { background: var(--primary); color: #fff; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.nav-toggle { display: none; background: transparent; border: 1px solid rgba(255,255,255,.25); color: #fff; border-radius: 6px; width: 36px; height: 34px; font-size: 16px; cursor: pointer; }

/* 드롭다운 (details 기반) */
details.dd { position: relative; }
details.dd > summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; user-select: none; }
details.dd > summary::-webkit-details-marker { display: none; }
details.dd .caret { font-size: 10px; opacity: .7; }
details.dd[open] > summary .caret { transform: rotate(180deg); }
.dd-menu { position: absolute; top: calc(100% + 6px); left: 0; min-width: 240px; background: #fff; color: var(--text); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.18); padding: 6px; z-index: 60; }
details.dd-right .dd-menu { left: auto; right: 0; }
.dd-menu a, .dd-menu .dd-btn { display: block; width: 100%; text-align: left; padding: 8px 10px; border-radius: 7px; color: var(--text); text-decoration: none; background: none; border: none; font: inherit; cursor: pointer; }
.dd-menu a:hover, .dd-menu .dd-btn:hover { background: #f1f4f8; text-decoration: none; }
.dd-menu a.active { background: #eef3fd; }
.dd-menu a b { display: block; font-weight: 600; font-size: 13px; }
.dd-menu a small, .dd-head small { display: block; color: var(--muted); font-size: 11px; margin-top: 1px; }
.dd-head { padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.dd-divider { height: 1px; background: var(--line); margin: 4px 6px; }
/* 메뉴 안의 처리 버튼(폼): 링크 항목과 같은 모양 */
.dd-menu .dd-act { display: block; width: 100%; text-align: left; padding: 8px 10px; border-radius: 7px; color: var(--text); background: none; border: none; font: inherit; cursor: pointer; }
.dd-menu .dd-act:hover { background: #f1f4f8; }
.dd-menu .dd-act b { display: block; font-weight: 600; font-size: 13px; }
.dd-menu .dd-act small { display: block; color: var(--muted); font-size: 11px; margin-top: 1px; }
.dd-menu form { margin: 0; }
.dd-group { padding: 8px 10px 2px; font-size: 11px; font-weight: 700; color: var(--muted); letter-spacing: .02em; }
/* 목록: 상태 탭 / 한 줄 필터 */
.status-tabs { display: flex; gap: 4px; flex-wrap: wrap; margin: 0 0 10px; border-bottom: 1px solid var(--line); }
.status-tabs a { padding: 8px 14px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; font-size: 14px; }
.status-tabs a:hover { color: var(--text); text-decoration: none; }
.status-tabs a.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
.status-tabs .cnt { display: inline-block; min-width: 20px; padding: 0 6px; margin-left: 4px; border-radius: 999px; background: #eef1f6; font-size: 11px; text-align: center; color: #4a5568; }
.status-tabs a.active .cnt { background: #e3ecfb; color: var(--primary); }
.filter-bar { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; padding: 12px 16px; }
.fb-field { display: flex; flex-direction: column; gap: 4px; }
.fb-field.fb-grow { flex: 1 1 220px; }
.fb-label { font-size: 12px; color: #4a5568; font-weight: 600; }
.fb-field input, .fb-field select { width: auto; margin: 0; }
.fb-field.fb-grow input { width: 100%; }
.fb-range { display: flex; align-items: center; gap: 6px; }
.fb-range span { color: var(--muted); }
.fb-actions { display: flex; gap: 6px; }
.empty { text-align: center; padding: 30px 10px; color: var(--muted); }
.empty .btn { margin-top: 8px; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: #f7f9fc; }
td.nowrap, .nowrap { white-space: nowrap; }
/* 거래 진행 6단계 */
form.inline { display: inline; }
.btn.linkish { border-color: transparent; background: none; color: var(--primary); padding: 2px 4px; text-decoration: underline; }
.mini-date { width: 128px !important; padding: 3px 6px !important; font-size: 12px !important; margin-right: 4px; }
.todo-chips { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 12px; }
.todo-chip { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px 8px 8px; border-radius: 999px; background: #fff; border: 1px solid var(--line); color: var(--text); font-size: 13px; }
.todo-chip .n { min-width: 26px; height: 26px; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center; background: var(--primary); color: #fff; font-weight: 700; font-size: 12px; padding: 0 6px; }
.todo-chip.zero { color: var(--muted); } .todo-chip.zero .n { background: #eef1f6; color: var(--muted); }
.todo-chip:hover { text-decoration: none; border-color: var(--primary); }
.todo-chip.active { border-color: var(--primary); background: #eef3fd; color: var(--primary); font-weight: 600; }
.status-tabs .tabs-search { margin-left: auto; padding-bottom: 6px; }
.status-tabs .tabs-search input { width: 220px; padding: 6px 10px; }
.deal-list { padding: 4px 0; }
/* 긴 목록 "더보기" (nav.js): 접힌 줄은 display가 grid·table-row여도 숨긴다 */
[data-more] [hidden] { display: none !important; }
.more-wrap { text-align: center; padding: 8px 0 2px; }
.deal-row { display: grid; grid-template-columns: 220px 1fr 250px; gap: 14px; align-items: center; padding: 12px 18px; border-bottom: 1px solid var(--line); }
.deal-row:last-child { border-bottom: none; }
.deal-row.stage-rejected { opacity: .6; }
.deal-info { display: flex; flex-direction: column; gap: 2px; color: var(--text); min-width: 0; }
.deal-info:hover { text-decoration: none; } .deal-info:hover b { color: var(--primary); }
.deal-info span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.deal-next { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; align-items: center; }
.deal-next .deal-more .dd-menu { min-width: 250px; }
.deal-next .deal-state { flex-basis: 100%; text-align: right; font-size: 12px; }
.deal-next .deal-state b { font-weight: 600; }
.deal-next .deal-state.st-complete b { color: #1d6b45; }
.deal-next .deal-state.st-rejected b { color: var(--muted); }
.deal-next .deal-docs { flex-basis: 100%; text-align: right; font-size: 11px; color: var(--muted); }
.deal-next .deal-docs span { white-space: nowrap; }
.deal-next .deal-docs b { font-weight: 600; color: var(--text); }
.deal-next .deal-docs b.ok-text { color: #1d6b45; }
@media (max-width: 1100px) { .deal-next .deal-docs, .deal-next .deal-state { text-align: left; } }
.dsteps { display: grid; grid-template-columns: repeat(6, 1fr); gap: 0; position: relative; }
.dstep { display: flex; flex-direction: column; align-items: center; gap: 2px; position: relative; font-size: 11px; color: var(--muted); text-align: center; }
.dstep::before { content: ''; position: absolute; top: 12px; left: -50%; right: 50%; height: 2px; background: var(--line); z-index: 0; }
.dstep:first-child::before { display: none; }
.dstep.st-done::before, .dstep.st-skip::before { background: #9fd8b8; }
.dstep .ic { position: relative; z-index: 1; width: 24px; height: 24px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 12px; background: #eef1f6; color: var(--muted); border: 2px solid #fff; }
.dstep.st-done .ic { background: var(--ok); color: #fff; }
.dstep.st-skip .ic { background: #e6ebf1; color: #9aa3b2; }
.dstep.st-next .ic { background: #fff; color: var(--primary); box-shadow: 0 0 0 2px var(--primary); }
.dstep.st-fail .ic { background: var(--danger); color: #fff; }
.dstep .lb { color: #4a5568; font-weight: 600; white-space: nowrap; }
.dstep.st-next .lb, .dstep.st-next .dt { color: var(--primary); }
.dstep.st-done .dt { color: var(--ok); }
.dstep.st-fail .dt { color: var(--danger); }
.dstep .dt { min-height: 14px; }
@media (max-width: 1100px) { .deal-row { grid-template-columns: 1fr; } .deal-next { justify-content: flex-start; } }
@media (max-width: 640px) { .dstep .lb { font-size: 10px; white-space: normal; word-break: keep-all; line-height: 1.15; padding: 0 2px; } .dstep .dt { font-size: 10px; } }
.deal-card { padding-bottom: 12px; }
.dflow { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
@media (max-width: 1100px) { .dflow { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 640px) { .dflow { grid-template-columns: 1fr; } }
.dcol { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: #fff; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.dcol .dhead { display: flex; align-items: center; gap: 6px; font-size: 12.5px; }
.dcol .dhead .ic { flex: none; width: 22px; height: 22px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 11px; background: #eef1f6; color: var(--muted); }
.dcol.st-done { border-color: #b9e4cc; background: #f6fcf8; } .dcol.st-done .ic { background: var(--ok); color: #fff; }
.dcol.st-next { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(59,111,214,.15); } .dcol.st-next .ic { background: var(--primary); color: #fff; }
.dcol.st-skip { background: #fafbfc; } .dcol.st-skip .ic { color: #9aa3b2; }
.dcol.st-fail { border-color: #f3bcbc; background: #fff7f7; } .dcol.st-fail .ic { background: var(--danger); color: #fff; }
.dcol .dbody { font-size: 12.5px; display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.dcol .dbody .btn { margin: 1px 0; }
ul.dsub { list-style: none; padding: 0; margin: 0; width: 100%; display: flex; flex-direction: column; gap: 6px; }
ul.dsub li { padding-left: 16px; position: relative; font-size: 12px; }
ul.dsub li::before { content: '○'; position: absolute; left: 0; color: var(--muted); }
ul.dsub li.ok::before { content: '✓'; color: var(--ok); font-weight: 700; }
ul.dsub li > span:first-child { display: block; color: #4a5568; font-weight: 600; }
/* 거래 흐름: 견적서 → 거래명세서 → 입금 */
.flow { display: flex; align-items: stretch; gap: 0; margin: 0 0 14px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.flow-step { flex: 1; display: flex; gap: 10px; align-items: center; padding: 10px 14px; color: var(--text); position: relative; min-width: 0; }
a.flow-step:hover { background: #f7f9fc; text-decoration: none; }
.flow-step + .flow-step { border-left: 1px solid var(--line); }
.flow-step + .flow-step::before { content: '›'; position: absolute; left: -9px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; line-height: 15px; text-align: center; background: #fff; border: 1px solid var(--line); border-radius: 50%; color: var(--muted); font-size: 12px; z-index: 1; }
.flow-n { flex: none; width: 26px; height: 26px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: #eef1f6; color: var(--muted); font-weight: 700; font-size: 12px; }
.flow-step.done .flow-n { background: #e3f6ec; color: var(--ok); }
.flow-step.current { background: #eef3fd; }
.flow-step.current .flow-n { background: var(--primary); color: #fff; }
.flow-step.todo { color: var(--muted); }
.flow-t { font-size: 12px; color: var(--muted); }
.flow-s { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.flow-step.todo .flow-s { font-weight: 400; }
.flow-act { margin-left: auto; display: flex; gap: 4px; flex: none; }
@media (max-width: 760px) { .flow { flex-direction: column; } .flow-step + .flow-step { border-left: 0; border-top: 1px solid var(--line); } .flow-step + .flow-step::before { display: none; } }
.nav-sep { width: 1px; height: 18px; background: rgba(255,255,255,.18); margin: 0 6px; align-self: center; }
@media (max-width: 900px) { .nav-sep { display: none; } }
.dd-head b { font-size: 13px; }
.dd-menu .dd-btn { color: var(--danger); }
details.create > summary.btn { padding: 6px 12px; }
details.create > summary.btn:hover { background: var(--primary-dark); }
details.userdd > summary { color: #fff; padding: 4px 8px 4px 4px; border-radius: 999px; }
details.userdd > summary:hover { background: rgba(255,255,255,.1); }
.avatar { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 50%; background: var(--primary); color: #fff; font-weight: 700; font-size: 13px; }
.uname { font-size: 13px; }

/* 빠른 검색 */
.quick-search input { width: 200px; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.15); color: #fff; padding: 6px 10px; font-size: 13px; border-radius: 7px; }
.quick-search input::placeholder { color: #9aa3b2; }
.quick-search input:focus { background: #fff; color: var(--text); outline: none; border-color: var(--primary); }

/* 섹션 하위 탭 */
.subnav { background: #273142; }
.subnav-inner { max-width: 1280px; margin: 0 auto; padding: 0 20px; display: flex; align-items: center; gap: 2px; height: 40px; }
.subnav-title { color: #9aa3b2; font-size: 12px; margin-right: 10px; }
.subnav a { color: #c9d1dd; padding: 6px 12px; border-radius: 6px; font-size: 13px; }
.subnav a:hover { background: rgba(255,255,255,.08); text-decoration: none; color: #fff; }
.subnav a.active { background: rgba(255,255,255,.14); color: #fff; font-weight: 600; }

.nav .mobile-only { display: none; }
@media (max-width: 1100px) { .quick-search input { width: 150px; } .uname { display: none; } }
@media (max-width: 900px) {
  .topbar-inner { flex-wrap: wrap; height: auto; padding: 8px 16px; gap: 10px; }
  .nav-toggle { display: inline-flex; align-items: center; justify-content: center; order: 3; }
  .topbar-right { order: 2; margin-left: auto; }
  .quick-search { display: none; }
  .nav { display: none; order: 4; width: 100%; flex-direction: column; align-items: stretch; padding: 6px 0 4px; border-top: 1px solid rgba(255,255,255,.1); }
  .nav.open { display: flex; }
  .nav .mobile-only { display: block; }
  .nav > a, .nav > details > summary { display: block; padding: 10px 12px; }
  .nav details.dd .dd-menu { position: static; box-shadow: none; border: none; background: rgba(255,255,255,.05); margin: 2px 0 6px; }
  .nav details.dd .dd-menu a { color: #e5e9f0; }
  .nav details.dd .dd-menu a small { color: #9aa3b2; }
  .nav details.dd .dd-menu a:hover, .nav details.dd .dd-menu a.active { background: rgba(255,255,255,.1); }
  .subnav-inner { overflow-x: auto; }
}
.auth-wrap { display: flex; justify-content: center; padding: 48px 0; }
.auth-card { width: 100%; max-width: 420px; }
.auth-card h1 { margin-bottom: 4px; }
.auth-card label { margin-top: 12px; }
.auth-card .btn { margin-top: 18px; }
.import-card .card-head h2 { font-size: 15px; }
.import-card .card-head label input { width: auto; margin-right: 6px; }

.container { max-width: 1280px; margin: 0 auto; padding: 20px; }
.footer { text-align: center; color: var(--muted); font-size: 12px; padding: 24px; }

.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; border: 1px solid; }
.flash.ok { background: #e8f7ef; border-color: #b9e4cc; color: #1d6b45; }
.flash.error { background: #fdeaea; border-color: #f3bcbc; color: #8d2323; }
.flash.warn { background: #fff6e0; border-color: #f1dca3; color: #7a5300; }

.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 16px; }
.card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.card-head h2 { margin: 0; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-side { display: grid; grid-template-columns: 1fr 320px; gap: 16px; align-items: start; }
@media (max-width: 960px) { .grid-2, .grid-side { grid-template-columns: 1fr; } }

.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
@media (max-width: 960px) { .tiles { grid-template-columns: repeat(2, 1fr); } }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.tile-label { color: var(--muted); font-size: 12px; }
.tile-value { font-size: 24px; font-weight: 700; margin: 4px 0; font-variant-numeric: tabular-nums; }
.tile-value .unit { font-size: 13px; font-weight: 500; color: var(--muted); margin-left: 3px; }
.tile-sub { font-size: 12px; color: var(--muted); }
.tile-warn .tile-value { color: var(--warn); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 7px 14px; border-radius: 7px; border: 1px solid #cfd6e0; background: #fff; color: var(--text);
  font-size: 13px; cursor: pointer; text-decoration: none; white-space: nowrap; font-family: inherit; line-height: 1.3;
}
.btn:hover { background: #f1f4f8; text-decoration: none; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-dark); }
.btn.danger { color: var(--danger); border-color: #ecc; }
.btn.danger:hover { background: #fdeaea; }
.btn.ghost { border-color: transparent; color: var(--muted); }
.btn.sm { padding: 4px 9px; font-size: 12px; }
.btn.lg { padding: 10px 22px; font-size: 14px; }
.btn.wide { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.icon-btn { border: none; background: transparent; color: var(--muted); font-size: 18px; cursor: pointer; line-height: 1; padding: 2px 6px; }
.icon-btn:hover { color: var(--danger); }

.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th, .table td { padding: 9px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.table th { background: #f7f9fc; color: #4a5568; font-weight: 600; font-size: 12px; white-space: nowrap; }
.table .num, .table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table.compact th, .table.compact td { padding: 6px 8px; }
.table tfoot td { background: #f7f9fc; font-weight: 600; }
.table tr.subtotal td { background: #fbfcfe; color: var(--muted); font-size: 12px; }
.table tr.muted td { color: #a0a8b4; }
.table-wrap { overflow-x: auto; }
.row-actions { white-space: nowrap; text-align: right; }
.row-actions form { display: inline; }
.row-actions .btn + .btn, .row-actions .btn + form { margin-left: 4px; }
.summary-line { display: flex; gap: 20px; flex-wrap: wrap; margin-bottom: 12px; color: var(--muted); }
.summary-line strong { color: var(--text); }
.accent { color: var(--primary) !important; }
.warn-text { color: var(--warn); }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.req { color: var(--danger); }

.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; background: #eef1f6; color: #4a5568; vertical-align: middle; }
.badge.lg { font-size: 12px; padding: 3px 10px; }
.badge.channel { background: #f1eafd; color: #6b3fb0; white-space: nowrap; } /* 판매 경로 (학교장터·쿠팡 등) */
.badge.draft, .badge.issued { background: #eef1f6; color: #4a5568; }
.badge.sent { background: #e3ecfb; color: #2a56b3; }
.badge.accepted, .badge.paid { background: #e3f6ec; color: #1d6b45; }
.badge.rejected, .badge.cancelled { background: #fbe6e6; color: #8d2323; }

input, select, textarea {
  font-family: inherit; font-size: 13px; color: var(--text);
  border: 1px solid #cfd6e0; border-radius: 6px; padding: 7px 9px; background: #fff; width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(59,111,214,.25); border-color: var(--primary); }
input[readonly] { background: #f4f6f9; color: var(--muted); }
input.num { text-align: right; }
textarea { resize: vertical; }
label { display: block; font-size: 12px; color: #4a5568; font-weight: 600; }
label > input, label > select, label > textarea, label > .with-side { margin-top: 4px; }
label.check { display: flex; align-items: center; gap: 6px; padding-top: 22px; }
label.check input { width: auto; margin: 0; }
/* 입력 칸 사이(그리드)에 놓인 체크 라벨은 글자 폭만큼만: 칸의 빈 곳을 눌러도 체크가 바뀌지 않게 (예: "단가 열 인쇄"가 모르게 꺼짐) */
.form-grid > label.check { justify-self: start; }
.with-side { display: flex; gap: 8px; align-items: center; }
.with-side > select, .with-side > input { flex: 1; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
.form-grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.form-grid .span-2 { grid-column: span 2; }
@media (max-width: 760px) { .form-grid, .form-grid.cols-4 { grid-template-columns: 1fr; } .form-grid .span-2 { grid-column: span 1; } }
.form-actions { display: flex; gap: 8px; margin-top: 16px; }
.form-actions.sticky { position: sticky; bottom: 0; background: rgba(244,246,249,.95); padding: 12px 0; margin-top: 0; backdrop-filter: blur(4px); }
.inline-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.inline-form input, .inline-form select { width: auto; }
.filter-bar { display: flex; gap: 14px; align-items: flex-end; flex-wrap: wrap; padding: 14px 20px; }
.filter-bar label { display: flex; flex-direction: column; gap: 4px; }
.filter-bar input, .filter-bar select { width: auto; margin: 0; }
.item-inline { display: flex; gap: 8px; flex-wrap: wrap; }
.item-inline input { flex: 1; min-width: 120px; }
.stack { display: flex; flex-direction: column; gap: 8px; }
.stack .btn { width: 100%; }
ul.plain { list-style: none; padding: 0; margin: 0; }
ul.plain li { padding: 6px 0; border-bottom: 1px solid var(--line); }
ul.plain li:last-child { border-bottom: none; }
.dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; margin: 0 0 12px; font-size: 13px; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; }

.table.lines input { padding: 5px 7px; }
.table.lines td { padding: 4px 4px; }
.table.lines td.calc { font-variant-numeric: tabular-nums; color: #333; padding-right: 10px; }
.table.lines td.seq { text-align: center; color: var(--muted); }
.table.lines tr.grand td { font-size: 15px; background: #eef3fd; }

.box-light { background: #f7f9fc; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin: 8px 0; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 999px; background: #eef1f6; font-size: 12px; color: #334; border: 1px solid transparent; font-family: inherit; cursor: default; }
.chip small { color: var(--primary); font-weight: 600; }
button.chip.var { cursor: pointer; background: #fff; border-color: #cfd6e0; }
button.chip.var:hover { border-color: var(--primary); color: var(--primary); }
button.chip.var.used { background: #eef3fd; border-color: #b9ccf3; }
.check-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (max-width: 760px) { .check-grid { grid-template-columns: 1fr; } }
.check-card { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; cursor: pointer; font-weight: 400; }
.check-card:hover { background: #f7f9fc; }
.check-card.req { border-color: #b9e4cc; background: #f4fbf7; }
.check-card input { width: auto; margin-top: 3px; }
.check-card b { display: block; font-size: 13px; color: var(--text); }
.check-card small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.check-card small.inputs { color: #2a56b3; margin-top: 4px; }
label.field .used-in { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; font-weight: 400; font-size: 11px; }
label.field .tag { display: inline-block; padding: 1px 7px; border-radius: 999px; background: #eef1f6; color: #6b7684; }
label.field .tag.on { background: #e3ecfb; color: #2a56b3; font-weight: 600; }
label.field.inactive input { background: #f7f8fa; color: #9aa3b2; }
/* 학교 서류 단계별 작성 */
.wiz-steps { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.wiz-docs { display: contents; }
.wiz-step { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: #fff; font: inherit; font-size: 13px; cursor: pointer; color: var(--muted); }
.wiz-step .n { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; border-radius: 50%; background: #eef1f6; font-size: 11px; font-weight: 700; }
.wiz-step.active { border-color: var(--primary); color: var(--primary); background: #eef3fd; font-weight: 600; }
.wiz-step.active .n { background: var(--primary); color: #fff; }
.wiz-step.warn .n { background: #ffe9a8; color: #7a5300; }
.wiz-nav { display: flex; gap: 8px; align-items: center; justify-content: flex-end; margin: 6px 0 16px; }
.wiz-nav .muted { margin-right: auto; }
.wiz-doc { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 16px; align-items: start; }
@media (max-width: 1000px) { .wiz-doc { grid-template-columns: 1fr; } }
.wiz-preview { padding: 0; overflow: hidden; }
.wiz-preview-head { padding: 10px 14px; border-bottom: 1px solid var(--line); background: #f7f9fc; font-size: 13px; }
.wiz-preview-head .lg-filled, .wiz-preview-head .lg-empty { padding: 0 6px; border-radius: 3px; }
.wiz-preview-head .lg-filled { background: #e6f4ea; box-shadow: inset 0 -2px 0 #7fcf9a; }
.wiz-preview-head .lg-empty { background: #fff3b0; box-shadow: inset 0 0 0 1.5px #e0b400; }
.wiz-frame-wrap { background: #e9ecef; overflow: auto; }
.wiz-frame { width: 125%; height: 900px; border: none; transform: scale(0.8); transform-origin: top left; display: block; }
.wiz-fields { position: sticky; top: 70px; }
.wiz-field-list { display: flex; flex-direction: column; gap: 10px; max-height: calc(100vh - 230px); overflow: auto; padding-right: 4px; }
.wiz-field { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
.wiz-field.filled { border-color: #b9e4cc; background: #f6fcf8; }
.wiz-field.empty { border-color: #e0b400; background: #fffbe6; }
.wiz-field.optional-empty { border-style: dashed; }
.wiz-field label { font-size: 12px; }
.wiz-field-note { font-size: 11px; color: var(--muted); margin-top: 4px; }
.wiz-field.empty .wiz-field-note .src { color: #7a5300; font-weight: 600; }
.wiz-field.filled .wiz-field-note .src { color: #1d6b45; }
.done-row { padding: 8px 10px; border-radius: 8px; margin-bottom: 6px; border: 1px solid var(--line); display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.done-row.ok { background: #f4fbf7; border-color: #b9e4cc; } .done-row.bad { background: #fffbe6; border-color: #e0b400; }
.ok-text { color: var(--ok); font-weight: 600; }
.file-status { padding: 6px 10px; border-radius: 8px; font-weight: 600; font-size: 13px; }
.file-status.st-valid { background: #e8f7ef; color: #1d6b45; }
.file-status.st-soon { background: #fff6e0; color: #7a5300; }
.file-status.st-expired, .file-status.st-none { background: #fdeaea; color: #8d2323; }
small.file-valid { color: #1d6b45 !important; } small.file-soon { color: #7a5300 !important; } small.file-expired, small.file-none { color: #8d2323 !important; }
.cdoc { border-left: 4px solid var(--ok); } .cdoc.st-soon { border-left-color: var(--warn); } .cdoc.st-expired, .cdoc.st-none { border-left-color: var(--danger); }
.cdoc-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.linkbtn { border: none; background: none; color: var(--primary); cursor: pointer; font: inherit; font-size: 11px; padding: 0; text-decoration: underline; }
details.card > summary { cursor: pointer; list-style: none; }
details.card > summary::-webkit-details-marker { display: none; }
/* 접기·펼치기는 모든 화면에서 같은 크기의 파란 표시로 구분한다. */
details > summary, details.card > summary { list-style: none; cursor: pointer; }
details > summary::-webkit-details-marker { display: none; }
details > summary::marker { content: ''; }
details > summary::before, details.card > summary::before, details.dd > summary::before {
  content: '›'; display: inline-flex; align-items: center; justify-content: center;
  flex: 0 0 28px; width: 28px; height: 28px; margin-right: 8px;
  font: 700 30px/1 Arial, sans-serif; color: #245ab6; background: #e4edff;
  border: 1px solid #b5cbf3; border-radius: 6px; vertical-align: middle;
}
details[open] > summary::before, details.card[open] > summary::before, details.dd[open] > summary::before { content: '›'; transform: rotate(90deg); }
summary .caret { display: none; }
summary:focus-visible { outline: 3px solid #82aaf1; outline-offset: 4px; border-radius: 4px; }
.topbar details > summary::before { background: #dbe8ff; color: #174b9c; }
#lines:not(.show-multiplier) .multiplier-cell { display: none; }
.inline-client { margin-top: 18px; padding: 16px; border: 1px solid #bfd0ed; border-radius: 8px; background: #f5f8fe; }
.inline-client[hidden] { display: none; }
.inline-client legend { font-weight: 700; color: var(--primary-dark); padding: 0 6px; }
.inline-client p { margin-top: 0; }
.next-task-actions { display: flex; flex-wrap: wrap; gap: 10px; flex-shrink: 0; }
.external-send-dialog { width: min(540px, calc(100% - 32px)); padding: 24px; border: 1px solid var(--line); border-radius: 12px; color: var(--text); box-shadow: 0 18px 70px #152b4940; }
.external-send-dialog::backdrop { background: #15223788; }
.external-send-dialog hr { border: 0; border-top: 1px solid var(--line); margin: 22px 0; }
.external-send-dialog label { display: flex; flex-direction: column; gap: 8px; }
.school-document-history { padding: 16px 0 0; border-top: 1px solid var(--line); }
.deal-delete-panel { display: flex; gap: 16px; align-items: center; justify-content: space-between; flex-wrap: wrap; border-color: #eacaca; }
.deal-delete-panel h2 { margin-bottom: 6px; }
.deal-delete-panel p { margin: 0; }
.document-history .table td { vertical-align: top; }
.statement-date-settings { display: flex; gap: 14px; align-items: flex-end; flex-wrap: wrap; background: #f3f6fc; padding: 16px; border-radius: 8px; margin: 0 0 16px; }
.statement-date-settings > label:first-of-type { display: flex; flex-direction: column; gap: 6px; }
.statement-date-settings .small { flex-basis: 100%; }
.settlement-card { scroll-margin-top: 90px; }
.settlement-card .card-head h2 { margin: 0; }
.settlement-form { display: flex; align-items: flex-end; flex-wrap: wrap; gap: 16px; }
.settlement-form label { display: flex; flex-direction: column; gap: 6px; width: 230px; max-width: 100%; }
.settlement-form > .btn { min-height: 38px; }
.payment-completed-record { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); display: flex; align-items: center; flex-wrap: wrap; gap: 16px; }
@media (max-width: 600px) { .settlement-form label { flex: 1 1 180px; width: auto; } }
@media (max-width: 760px) { .next-task-actions { width: 100%; } .next-task-actions > .btn { flex: 1 1 180px; } }
.preview-card { padding: 0; overflow: hidden; background: #e9ecef; }
.preview { width: 100%; height: 1120px; border: none; display: block; }

/* 설정: 저장된 메일 값 / 시험 버튼 */
.mail-saved { background: #f6f8fb; border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; margin: 0 0 12px; line-height: 1.9; }
.mail-saved code { background: #fff; border: 1px solid var(--line); border-radius: 4px; padding: 0 5px; }
.mail-saved .miss { color: #b42318; } .mail-saved .ok { color: #1d6b45; }
.mail-tests .inline-form { margin: 8px 0; }
/* 작성 화면: 품목표 열 이름 */
.col-labels { border: 1px solid var(--line); border-radius: 8px; padding: 6px 12px 10px; margin: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.col-labels legend { padding: 0 4px; font-weight: 600; font-size: 13px; }
@media (max-width: 720px) { .col-labels { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
/* 회사 증빙서류 탭: 파일 상태 */
.transaction-documents { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.transaction-documents .card { min-width: 0; }
.edit-conflict { border: 2px solid var(--warn); background: #fffbef; }
.edit-conflict details > summary { cursor: pointer; margin-bottom: 12px; }
.conflict-confirm { padding: 12px; background: #fffbef; border: 1px solid var(--warn); border-radius: 8px; }
.preserve-lines { white-space: pre-wrap; overflow-wrap: anywhere; }
@media (max-width: 720px) { .transaction-documents { grid-template-columns: 1fr; } }
.status-tabs .cnt.file-none, .status-tabs .cnt.file-expired { background: #fbe6e6; color: #8d2323; }
.status-tabs .cnt.file-soon { background: #fff3d6; color: #7a5300; }
.status-tabs .cnt.file-valid { background: #e3f6ec; color: #1d6b45; }

/* 거래 중심 화면: 목록은 간결하게, 상세는 다음 행동과 두 문서에 집중 */
.card.deal-list { padding: 0; overflow: hidden; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.deal-index { max-width: 1120px; margin-inline: auto; }
.deal-compact, .deal-compact-labels { display: grid; grid-template-columns: minmax(220px,1fr) minmax(390px,1.8fr) 176px; gap: 24px; align-items: center; padding: 16px 22px; }
.deal-compact { border-top: 1px solid var(--line); min-height: 112px; transition: background .15s; }
.deal-compact:hover { background: #f8faff; }
.deal-compact:first-child { border-top: 0; }
.deal-compact-labels { padding-top: 12px; padding-bottom: 12px; font-size: 13px; color: var(--muted); background: #fafbfd; }
.deal-compact-info { display: flex; flex-direction: column; gap: 3px; color: var(--text); min-width: 0; }
.deal-compact-info b { font-size: 15px; }
.deal-compact-info span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.deal-compact-info small { color: var(--muted); font-size: 12px; }
.deal-compact-amount { font-size: 17px; text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.deal-compact-amount small { font-size: 13px; font-weight: 400; margin-left: 3px; }
.deal-compact-labels > span:nth-child(2) { text-align: center; }
.deal-compact-labels > span:nth-child(3) { text-align: right; }
.deal-status { display: inline-flex; justify-content: center; width: fit-content; padding: 5px 10px; font-size: 13px; font-weight: 600; border-radius: 7px; background: #eef3fd; color: #2855a8; }
.deal-status.complete { background: #e8f7ef; color: #1d6b45; }
.deal-status.rejected { background: #eef1f4; color: #59616e; }
.deal-compact-summary { display: flex; flex-direction: column; align-items: flex-end; gap: 7px; }
.deal-open { white-space: nowrap; font-size: 13px; font-weight: 600; }
.deal-visual-progress { min-width: 0; padding: 0; }
.deal-visual-progress .dstep { font-size: 13px; }
.deal-visual-progress .dstep .lb { font-size: 12px; }
.deal-visual-progress .dstep .dt { font-size: 12px; }
.deal-heading { align-items: center; margin-bottom: 22px; }
.deal-heading h1 { margin-top: 8px; font-size: 26px; }
.deal-heading p { margin: 5px 0 0; }
.deal-heading-total { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.deal-heading-total > strong { font-size: 28px; letter-spacing: -.04em; }
.deal-heading-total .deal-status { margin-left: 10px; align-self: center; }
.next-task { display: flex; justify-content: space-between; align-items: center; gap: 24px; border: 1px solid #c8d8f6; border-radius: 12px; padding: 24px; background: #f0f5ff; }
.next-task .eyebrow { color: #355c9e; font-size: 13px; font-weight: 700; }
.next-task h2 { font-size: 21px; margin: 5px 0 8px; }
.next-task p { color: #58677e; margin: 0; max-width: 680px; }
.next-task .btn { white-space: nowrap; }
.next-task.done { background: #f0faf4; border-color: #c6e6d2; }
.next-task.closed { background: #f2f4f7; border-color: var(--line); }
.admin-wait { color: #626e80; white-space: nowrap; }
.deal-facts { display: flex; align-items: center; flex-wrap: wrap; gap: 12px 20px; padding: 15px 2px 24px; font-size: 13px; color: var(--muted); }
.deal-facts b { color: var(--text); margin-left: 4px; }
.deal-facts a { margin-left: auto; }
.section-heading { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.section-heading h2, .section-heading p { margin: 0; }
.document-overview { align-items: start; }
.document-card { padding: 0; overflow: hidden; }
.document-card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 16px 18px; }
.document-card-head h3 { margin: 0 0 3px; font-size: 17px; }
.document-card-head small { color: var(--muted); font-size: 12px; }
.document-preview { position: relative; background: #e9edf3; border-block: 1px solid var(--line); max-height: 1000px; overflow: auto; }
.document-preview-stage { position: relative; width: 100%; min-height: 300px; }
.document-preview-frame { position: absolute; top: 0; left: 0; width: 850px; height: 1200px; border: 0; transform-origin: top left; display: block; }
.document-preview-frame[hidden] { display: none; }
.preview-message { position: absolute; top: 30px; inset-inline: 20px; text-align: center; color: #4b5e77; }
.document-card-tools { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; padding: 14px; }
.document-card-tools .small { font-size: 13px; margin-left: auto; }
.document-pending { min-height: 420px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 36px; border-style: dashed; color: var(--muted); }
.document-pending > span { font-size: 48px; color: #98a8be; }
.document-pending h3 { font-size: 18px; color: #566579; }
.deal-checklist, .payment-panel, [id^="checklist-"], #submissions { scroll-margin-top: 90px; }
.deal-checklist > summary, .payment-panel > summary, .doc-settings > summary { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px; font-size: 16px; }
.deal-checklist > summary .muted, .payment-panel > summary .muted, .doc-settings > summary .muted { font-size: 13px; }
.checklist-row { display: flex; justify-content: space-between; align-items: center; gap: 18px; padding: 20px 0; border-top: 1px solid var(--line); }
.checklist-row:first-of-type { margin-top: 18px; }
.checklist-row h3 { margin: 0 0 5px; font-size: 15px; }
.checklist-row p { margin: 0; color: #59687b; }
.checklist-row small { color: #805d21; display: block; margin-top: 5px; font-size: 13px; }
.checklist-actions, .check-action { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.check-action input[type="date"] { width: 142px; padding: 7px; font-size: 13px; }
.payment-panel[open] > summary { margin-bottom: 20px; }
.tax-issued-record { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; padding: 14px; margin-bottom: 20px; background: #f6f8fc; border: 1px solid var(--line); border-radius: 8px; }
.tax-issued-record p { margin: 5px 0 0; }
.doc-basics h2 { margin-bottom: 16px; }
.doc-settings[open] > summary { margin-bottom: 22px; }
.doc-settings .col-labels { grid-column: 1 / -1; }
.line-help { font-size: 13px; color: #59687b; padding: 12px 0 0; }
.line-help summary { cursor: pointer; }
.line-help p { margin: 8px 0; }
@media (max-width: 950px) {
  .deal-compact, .deal-compact-labels { grid-template-columns: minmax(170px,1fr) minmax(340px,1.8fr) 155px; gap: 16px; padding-inline: 16px; }
  .next-task { flex-wrap: wrap; }
  .transaction-documents.document-overview { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .deal-visual-progress { grid-column: 1 / -1; grid-row: 2; width: min(100%, 500px); justify-self: center; padding: 8px 0 0; }
  .deal-visual-progress .dstep .lb, .deal-visual-progress .dstep .dt { font-size: 11px; }
  .deal-compact-labels { display: none; }
  .deal-compact { grid-template-columns: minmax(0,1fr) auto; gap: 12px; padding: 16px; }
  .deal-compact-amount { font-size: 16px; }
  .deal-compact-info span { white-space: normal; }
  .deal-compact-summary { grid-column: 2; grid-row: 1; gap: 6px; }
  .deal-open { justify-self: end; }
  .deal-heading h1 { font-size: 23px; }
  .deal-heading-total > strong { font-size: 24px; }
  .next-task { padding: 18px; gap: 14px; }
  .next-task h2 { font-size: 19px; }
  .next-task p { font-size: 14px; }
  .deal-facts { gap: 10px 16px; }
  .deal-facts a { margin-left: 0; }
  .checklist-row { flex-direction: column; align-items: flex-start; }
  .document-card-tools { gap: 8px; }
  .document-pending { min-height: 260px; }
}
