* { box-sizing: border-box; }
body {
    margin: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Malgun Gothic", sans-serif;
    background: #f5f6f8; color: #222;
}
.topbar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 16px; background: #0C1222; color: #fff;
    position: sticky; top: 0; z-index: 10;
}
.topbar h1 { font-size: 18px; margin: 0; }

.navtabs {
    display: flex; gap: 4px; background: #fff; padding: 0 10px;
    border-bottom: 1px solid #e5e7eb; overflow-x: auto;
}
.navtabs a {
    padding: 12px 14px; text-decoration: none; color: #666; font-size: 14px;
    border-bottom: 2px solid transparent; white-space: nowrap;
}
.navtabs a.active { color: #2d6cdf; border-bottom-color: #2d6cdf; font-weight: 600; }

.main { padding: 14px; max-width: 720px; margin: 0 auto; }

.search-bar { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.search-bar input {
    flex: 1; min-width: 160px; padding: 10px 12px; border: 1px solid #ddd;
    border-radius: 8px; font-size: 15px;
}

.btn {
    padding: 10px 14px; border: 0; border-radius: 8px; font-size: 14px;
    cursor: pointer; white-space: nowrap;
}
.btn-open { background: #2d6cdf; color: #fff; }
.btn-lock { background: #e5e7eb; color: #333; }
.btn-unlock { background: #fff3cd; color: #7a5a00; }

.list-card {
    background: #fff; border-radius: 12px; padding: 14px 16px; margin-bottom: 10px;
    box-shadow: 0 1px 4px rgba(0,0,0,.06);
}
.lc-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.lc-title { font-size: 16px; font-weight: 700; }
.lc-info { font-size: 13.5px; color: #555; line-height: 1.6; }
.lc-info div { margin-bottom: 2px; }
.lc-actions { display: flex; gap: 8px; margin-top: 10px; }
.lc-actions .btn { flex: 1; padding: 8px; font-size: 13px; }

.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 13px; color: #555; margin-bottom: 5px; }
.form-group input, .form-group textarea {
    width: 100%; padding: 10px; border: 1px solid #ddd; border-radius: 6px; font-size: 15px;
    font-family: inherit;
}

.modal {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0; z-index: 100;
    display: flex; align-items: center; justify-content: center; padding: 16px;
}
.modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,.4); z-index: 99; }
.modal-content {
    background: #fff; border-radius: 12px; width: 100%; max-width: 440px;
    max-height: 90vh; display: flex; flex-direction: column; z-index: 101;
}
.modal-header { display: flex; justify-content: space-between; align-items: center; padding: 16px; border-bottom: 1px solid #eee; }
.modal-header h3 { margin: 0; font-size: 17px; }
.modal-header button { background: none; border: 0; font-size: 18px; cursor: pointer; }
.modal-body { padding: 16px; overflow-y: auto; }
.modal-footer { display: flex; gap: 8px; padding: 14px 16px; border-top: 1px solid #eee; }
.modal-footer .btn { flex: 1; }

.badge { display: inline-block; padding: 3px 9px; border-radius: 10px; font-size: 12px; }
.badge-ok { background: #e6f4ea; color: #2e7d32; }
.badge-fail { background: #fdecea; color: #c62828; }
.badge-other { background: #eef1f5; color: #555; }

/* 거래처: 두 칸 배치·담당자 입력줄·검색 근거 */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.two-col > div { min-width: 0; }
.contact-row {
    display: grid; grid-template-columns: 1fr 1fr; gap: 6px;
    border: 1px solid #e3e3e3; border-radius: 6px; padding: 8px; margin-bottom: 6px;
}
.contact-row input { padding: 8px; font-size: 14px; }
.match-line { font-size: 12.5px; color: #2d6cdf; margin: 2px 0 4px; }

/* 거래처 선택 상자(견적·일정 공통, partner_picker.js) */
.pp-wrap { position: relative; }
.pp-list {
    position: absolute; left: 0; right: 0; top: 100%; z-index: 120; margin-top: 2px;
    background: #fff; border: 1px solid #ddd; border-radius: 6px; max-height: 260px; overflow-y: auto;
    box-shadow: 0 6px 18px rgba(0,0,0,.12);
}
.pp-item { padding: 9px 10px; cursor: pointer; border-bottom: 1px solid #f0f0f0; }
.pp-item:last-child { border-bottom: 0; }
.pp-item:hover, .pp-item.active { background: #eef4ff; }
.pp-item .pp-name { font-size: 14.5px; font-weight: 600; }
.pp-item .pp-sub { font-size: 12px; color: #888; margin-top: 2px; }
.pp-empty { padding: 10px; color: #999; font-size: 13px; }
.pp-chosen { font-size: 12.5px; color: #2e7d32; margin-top: 4px; }

/* 명함 입력 비교표 */
.card-cmp { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.card-cmp td { border-bottom: 1px solid #eee; padding: 7px 4px; vertical-align: top; }
.card-cmp td:first-child { width: 28px; }
.card-cmp .lbl { color: #666; font-size: 12px; }
.card-cmp .old { color: #999; text-decoration: line-through; font-size: 12.5px; }
.card-cmp .new { color: #222; }
.card-cmp input[type=text] { width: 100%; padding: 6px; border: 1px solid #ddd; border-radius: 5px; font-size: 14px; }

/* 거래처 거래 내역 */
.tl-line { padding: 4px 0; border-top: 1px dashed #eee; }
.tl-line:first-of-type { border-top: none; }
.tl-sub { color: #888; font-size: 12.5px; padding-left: 8px; }
.tl-total { text-align: right; font-weight: 700; margin-top: 4px; }
.list-card details summary { cursor: pointer; color: #2d6cdf; margin-top: 4px; }

/* 판매 입력 화면 */
.sl-mode { display: flex; gap: 0; margin-bottom: 12px; border: 1px solid #2d6cdf; border-radius: 8px; overflow: hidden; }
.sl-mode button { flex: 1; padding: 10px; border: 0; background: #fff; color: #2d6cdf; font-size: 15px; cursor: pointer; }
.sl-mode button.active { background: #2d6cdf; color: #fff; font-weight: 700; }
.sl-banner { background: #fff3cd; color: #7a5a00; padding: 8px 10px; border-radius: 6px; margin-bottom: 10px; font-size: 14px; }
.sl-section { background: #fff; border-radius: 10px; padding: 12px; margin-bottom: 12px; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.sl-section-head { font-weight: 700; margin-bottom: 8px; }
.sl-section input[type=search] { width: 100%; padding: 10px; border: 1px solid #ddd; border-radius: 6px; font-size: 15px; }
.sl-tabs { display: flex; gap: 6px; margin: 8px 0; }
.sl-tabs button { flex: 1; padding: 7px; border: 1px solid #ddd; background: #f8f9fa; border-radius: 6px; cursor: pointer; font-size: 14px; }
.sl-tabs button.active { background: #e7f0ff; border-color: #2d6cdf; color: #2d6cdf; font-weight: 600; }
.sl-group summary { padding: 8px 4px; cursor: pointer; font-weight: 600; border-bottom: 1px solid #f0f0f0; }
.sl-group .sl-group { margin-left: 12px; }
.sl-group summary .n { color: #888; font-weight: 400; font-size: 13px; }
.sl-prod { display: flex; align-items: center; gap: 8px; padding: 8px 4px; border-bottom: 1px solid #f3f3f3; }
.sl-prod .info { flex: 1; min-width: 0; }
.sl-prod .m { font-weight: 600; }
.sl-prod .s { color: #777; font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sl-prod .p { color: #2d6cdf; font-size: 13px; white-space: nowrap; }
.sl-prod .add { padding: 6px 12px; border: 0; border-radius: 6px; background: #2d6cdf; color: #fff; cursor: pointer; font-size: 14px; }
.sl-more { width: 100%; padding: 8px; margin-top: 6px; border: 1px dashed #bbb; background: #fff; border-radius: 6px; cursor: pointer; }
.sl-line { border-bottom: 1px solid #eee; padding: 8px 0; }
.sl-line .top { display: flex; gap: 6px; align-items: center; }
.sl-line .top input { flex: 1; padding: 7px; border: 1px solid #ddd; border-radius: 5px; font-size: 14px; }
.sl-line .row { display: flex; gap: 6px; margin-top: 6px; align-items: center; flex-wrap: wrap; }
.sl-line .row input { width: 70px; padding: 7px; border: 1px solid #ddd; border-radius: 5px; font-size: 14px; }
.sl-line .row input.price { width: 110px; }
.sl-line .row select { padding: 6px; border: 1px solid #ddd; border-radius: 5px; }
.sl-line .amt { margin-left: auto; font-weight: 700; white-space: nowrap; }
.sl-line .rm { padding: 6px 10px; border: 0; background: #f1f3f5; border-radius: 5px; cursor: pointer; }
.sl-line .hint { color: #888; font-size: 12px; margin-top: 3px; }
.sl-totals { text-align: right; margin-top: 10px; line-height: 1.7; }
.sl-totals b { font-size: 17px; }
.sl-actions { display: flex; gap: 8px; margin-bottom: 8px; }
.sl-actions .btn { flex: 1; padding: 12px 6px; font-size: 15px; }
.sl-help { color: #777; font-size: 13px; line-height: 1.5; }

/* ── 수금 ── */
.rv-summary { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.rv-summary > div { flex: 1; min-width: 120px; background: #fff; border-radius: 10px; padding: 10px 12px; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.rv-summary span { display: block; font-size: 12.5px; color: #777; }
.rv-summary b { font-size: 18px; }
.rv-summary small { margin-left: 6px; color: #777; }
.rv-summary .due, .rv-bal.due { color: #c62828; }
.rv-bal { font-weight: 700; font-size: 16px; }
.rv-bal.over { color: #2e7d32; }
.rv-row { cursor: pointer; }
.rv-check { display: block; font-size: 13.5px; color: #555; margin: -6px 0 10px; }
.rv-kinds { display: flex; border: 1px solid #2d6cdf; border-radius: 8px; overflow: hidden; margin-bottom: 12px; }
.rv-kinds button { flex: 1; padding: 9px 4px; border: 0; background: #fff; color: #2d6cdf; font-size: 14px; cursor: pointer; }
.rv-kinds button.active { background: #2d6cdf; color: #fff; }
.rv-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.rv-table th, .rv-table td { padding: 6px 4px; border-bottom: 1px solid #eee; text-align: left; vertical-align: top; }
.rv-table th { color: #777; font-weight: 600; }
.rv-table .num { text-align: right; white-space: nowrap; }
.rv-del { border: 0; background: none; color: #c62828; cursor: pointer; font-size: 14px; }

/* ── 매출·매입 목록 ── */
.ls-views { display: flex; gap: 6px; margin-bottom: 12px; }
.ls-views button { flex: 1; padding: 10px; border: 1px solid #ddd; background: #fff; border-radius: 8px; font-size: 15px; cursor: pointer; }
.ls-views button.active { background: #0C1222; color: #fff; border-color: #0C1222; }
.ls-quick { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.ls-quick button { padding: 6px 10px; border: 1px solid #ccc; background: #fff; border-radius: 14px; font-size: 13px; cursor: pointer; }
.ls-quick button.active { background: #2d6cdf; border-color: #2d6cdf; color: #fff; }
.two-col input[type=date], .ls-q, #ls-partner-q { width: 100%; padding: 9px 10px; border: 1px solid #ddd; border-radius: 8px; font-size: 14px; }
.ls-tag { display: inline-block; padding: 2px 7px; border-radius: 6px; font-size: 12px; margin-right: 6px; font-weight: 600; }
.ls-tag.sale { background: #e8f0fe; color: #2d6cdf; }
.ls-tag.purchase { background: #fff3e0; color: #b45309; }
.ls-chips { margin: 4px 0; }
.ls-chips .badge { margin-right: 4px; }
.ls-hit { background: #fff59d; }

/* ── 견적 조건 ── */
.sl-terms summary { cursor: pointer; list-style: none; }
.sl-terms summary::after { content: ' ▾'; color: #888; font-weight: 400; }
.sl-terms[open] summary::after { content: ' ▴'; }
.sl-terms textarea, .sl-terms input[type=date], .sl-terms input[type=text] { width: 100%; padding: 9px 10px; border: 1px solid #ddd; border-radius: 8px; font-size: 14px; }

/* ── 일정: 달력·카드 ── */
.ls-views .btn-add { flex: 0 0 auto; background: #2d6cdf; color: #fff; border-color: #2d6cdf; font-weight: 600; }
.cal-nav { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.cal-nav b { flex: 1; text-align: center; font-size: 16px; }
.cal-nav button { border: 1px solid #ddd; background: #fff; border-radius: 8px; padding: 6px 12px; font-size: 15px; cursor: pointer; }
.cal-nav .cal-today { font-size: 13px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2px; }
.cal-w { text-align: center; font-size: 12px; color: #777; padding: 2px 0; }
.cal-d { min-height: 62px; border-radius: 6px; background: #f8f9fb; padding: 3px; cursor: pointer; overflow: hidden; }
.cal-d .n { font-size: 12px; font-weight: 600; }
.cal-d.other { opacity: .45; }
.cal-d.today .n { background: #2d6cdf; color: #fff; border-radius: 10px; padding: 0 6px; }
.cal-d.sel { outline: 2px solid #2d6cdf; background: #eef4ff; }
.cal-w.sun, .cal-d.sun .n { color: #c62828; }
.cal-w.sat, .cal-d.sat .n { color: #2d6cdf; }
.cal-d.today.sun .n, .cal-d.today.sat .n { color: #fff; }
.cal-e { font-size: 10.5px; line-height: 1.3; margin-top: 2px; padding: 0 3px; border-radius: 3px; background: #e8f0fe; color: #1a4fb0;
         white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-e.done { background: #e6f4ea; color: #2e7d32; }
.cal-more { font-size: 10.5px; color: #777; }
.sc-card.done, .sc-card.cancelled { opacity: .7; }
.sc-links { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.sc-btn { display: inline-block; padding: 6px 10px; border: 1px solid #ddd; border-radius: 16px; background: #fff; color: #333;
          font-size: 13px; text-decoration: none; }
.sc-btn:active { background: #eef1f5; }

/* ── 택배 일정·알림 ── */
.sc-picks { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.sc-pick { padding: 5px 10px; border: 1px solid #ccc; border-radius: 14px; background: #fff; font-size: 13px; cursor: pointer; }
.sc-check { display: flex; align-items: center; gap: 6px; font-size: 14px; margin: 6px 0; }
.link-btn { border: 0; background: none; color: #2d6cdf; font-size: 13px; cursor: pointer; padding: 0 4px; }
.cal-e.ship { background: #fff3e0; color: #b45309; }
.sc-card.ship { border-left: 4px solid #f59e0b; }
.delivery-only input, .delivery-only textarea { width: 100%; padding: 9px 10px; border: 1px solid #ddd; border-radius: 8px; font-size: 14px; }
.sc-remind { font-size: 12px; font-weight: 400; color: #b45309; background: #fff3e0; border-radius: 8px; padding: 1px 6px; }
/* ── 택배 일정 창 품목 담기 ── */
.sc-presults { max-height: 220px; overflow-y: auto; margin: 4px 0; }
.sc-prow { display: block; width: 100%; text-align: left; padding: 8px 10px; border: 0; border-bottom: 1px solid #eee; background: #fff; font-size: 14px; cursor: pointer; }
.sc-prow:active { background: #eef4ff; }
.sc-line { border: 1px solid #e3e6ea; border-radius: 8px; padding: 6px; margin: 6px 0; }
.sc-line .nm { width: 100%; margin-bottom: 4px; }
.sc-line .row { display: flex; align-items: center; gap: 6px; }
.sc-line .row input { width: 64px; padding: 7px; border: 1px solid #ddd; border-radius: 6px; font-size: 14px; }
.sc-line .row input.pr { width: 96px; }
.sc-line .amt { flex: 1; text-align: right; font-size: 13px; color: #333; }
.sc-line .rm { border: 0; background: none; color: #c62828; font-size: 16px; cursor: pointer; }
.sc-line.ro { display: flex; justify-content: space-between; font-size: 14px; background: #f8f9fb; }
.sc-lock { font-weight: 400; font-size: 12px; color: #b45309; }
#sc-psearch { width: 100%; padding: 9px 10px; border: 1px solid #ddd; border-radius: 8px; font-size: 14px; margin-top: 4px; }

/* ── 가망 고객 ── */
.pp-tag { display: inline-block; font-size: 11px; font-weight: 600; color: #7c3aed; background: #f3e8ff; border-radius: 6px; padding: 1px 6px; vertical-align: middle; }
.pp-new { color: #2d6cdf; font-weight: 600; border-top: 1px dashed #ddd; }
.pp-modal-back { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 3000; display: flex; align-items: center; justify-content: center; padding: 16px; }
.pp-modal-back[hidden] { display: none; }
.pp-modal { box-sizing: border-box; background: #fff; border-radius: 12px; padding: 16px; width: 100%; max-width: 420px; max-height: 90vh; overflow-y: auto; }
.pp-modal h3 { margin: 0 0 6px; font-size: 17px; }
.pp-modal .pp-help { color: #666; font-size: 13px; margin: 0 0 8px; line-height: 1.5; }
.pp-modal label { display: block; color: #555; font-size: 13px; margin: 8px 0 3px; }
.pp-modal input { width: 100%; padding: 9px 10px; border: 1px solid #ccc; border-radius: 8px; font-size: 15px; box-sizing: border-box; }
.pp-modal .pp-two { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pp-modal .pp-msg { color: #c62828; font-size: 13px; min-height: 18px; margin-top: 6px; }
.pp-modal .pp-btns { display: flex; gap: 6px; margin-top: 10px; }
.pp-modal .pp-btns button { flex: 1; padding: 10px 6px; border: 0; border-radius: 8px; font-size: 14px; cursor: pointer; }
.pp-modal .pp-btns .cl { background: #eee; }
.pp-modal .pp-btns .ok { background: #2d6cdf; color: #fff; }
.badge-prospect { background: #f3e8ff; color: #7c3aed; }

/* ── 문의 붙여넣기 ── */
.iq-modal { max-width: 520px; }
.iq-modal textarea { width: 100%; padding: 9px 10px; border: 1px solid #ccc; border-radius: 8px; font-size: 14px; font-family: inherit; box-sizing: border-box; }
.iq-dup { background: #fff7ed; border: 1px solid #fed7aa; border-radius: 8px; padding: 8px 10px; margin-bottom: 6px; font-size: 13px; }
.iq-radio { display: flex !important; align-items: center; gap: 6px; color: #333 !important; font-size: 14px !important; margin: 6px 0 !important; }
.iq-radio input { width: auto !important; }
.iq-item { display: flex; gap: 4px; margin-bottom: 4px; }
.iq-item .nm { flex: 2; } .iq-item .qt { width: 56px !important; flex: none; } .iq-item .nt { flex: 1.3; }
.iq-item .rm { border: 0; background: none; color: #c62828; font-size: 16px; cursor: pointer; }
.sl-memo #sl-memo { font-size: 13px; line-height: 1.6; color: #333; max-height: 260px; overflow-y: auto; }
.iq-check { color: #b45309; font-weight: 700; }
.iq-item input { min-width: 0; }
.pp-modal .pp-two > div { min-width: 0; } .pp-modal input, .pp-modal textarea { max-width: 100%; }
