* { font-family: 'Malgun Gothic', '맑은 고딕', sans-serif; font-size: 12px; box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body { background: #f0f0f0; min-width: 1400px; overflow-x: auto; display: flex; flex-direction: column; }

/* ── GNB ── */
#hd { background: #1a4a8a; position: sticky; top: 0; z-index: 1000; flex-shrink: 0; }
.gnb-inner { padding: 0 20px; }
.menubar { display: flex; flex-wrap: nowrap; align-items: center; background: #2563a8; padding: 0; min-height: 36px; position: relative; z-index: 200; overflow: visible; }
.menu-item { position: relative; flex-shrink: 0; }
.menu-item > a { color: #cce0ff; padding: 8px 14px; border-radius: 3px; text-decoration: none; white-space: nowrap; font-weight: bold; display: flex; align-items: center; gap: 4px; line-height: 36px; }
.menu-item > a:hover, .menu-item > a.active { background: #4fdfd0; color: #000; }
.menu-item > a.has-sub::after { content: " ▾"; font-size: 9px; opacity: 0.8; }
.submenu { display: none; position: absolute; top: 100%; left: 0; background: #1a3a6a; min-width: 140px; border-radius: 0 0 4px 4px; box-shadow: 0 4px 12px rgba(0,0,0,0.35); z-index: 1001; }
.menu-item:hover .submenu { display: block; }
.submenu a { display: block; color: #cce0ff; padding: 8px 16px; text-decoration: none; white-space: nowrap; font-size: 12px; border-bottom: 1px solid rgba(255,255,255,0.07); }
.submenu a:last-child { border-bottom: none; }
.submenu a:hover, .submenu a.active { background: #4fdfd0; color: #000; }
.menubar-login { margin-left: auto; display: flex; align-items: center; gap: 10px; color: #cce0ff; padding: 0 14px; white-space: nowrap; }
.menubar-login .login-user { display: flex; align-items: center; gap: 5px; font-size: 12px; font-weight: bold; }
.menubar-login .login-role { font-size: 11px; color: #a0c8ff; font-weight: normal; margin-left: 2px; }
.menubar-login .login-user i { font-size: 16px; color: #7fb8ff; }
.menubar-login .login-sep { color: #4a7ac0; font-size: 13px; }
.menubar-login a { color: #cce0ff; text-decoration: none; font-size: 12px; font-weight: bold; display: flex; align-items: center; gap: 4px; padding: 4px 8px; border-radius: 3px; }
.menubar-login a:hover { background: #4fdfd0; color: #000; }
.menubar-login .btn-logout { color: #ffaaaa !important; }
.menubar-login .btn-logout:hover { background: #cc3333 !important; color: #fff !important; }

/* ── 로더 / 토스트 ── */
#loader { display: none; position: fixed; inset: 0; background: rgba(255,255,255,.45); z-index: 9998; align-items: center; justify-content: center; }
#loader.show { display: flex; }
#loader::after { content: ''; width: 36px; height: 36px; border: 4px solid #ccc; border-top-color: #3366cc; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
#toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: #333; color: #fff; padding: 8px 20px; border-radius: 6px; font-size: 12px; z-index: 9999; opacity: 0; transition: opacity .3s; pointer-events: none; white-space: nowrap; }
#toast.show { opacity: 1; }
#toast.err { background: #cc3333; }

/* ── 버튼 ── */
.btn { padding: 3px 10px; border: none; border-radius: 3px; cursor: pointer; font-size: 12px; font-weight: bold; }
.btn-blue   { background: #3366cc; color: #fff; } .btn-blue:hover   { background: #2255bb; }
.btn-green  { background: #33aa66; color: #fff; } .btn-green:hover  { background: #229955; }
.btn-red    { background: #cc3333; color: #fff; } .btn-red:hover    { background: #bb2222; }
.btn-orange { background: #ff9900; color: #fff; } .btn-orange:hover { background: #ee8800; }
.btn-gray   { background: #888;    color: #fff; } .btn-gray:hover   { background: #666; }
.btn-sm { padding: 2px 7px; font-size: 11px; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* ── 만기임박 배너 ── */
#near-banner { display: none; background: #fff3cd; border: 1px solid #ffc107; border-radius: 4px; padding: 7px 14px; margin: 6px 12px 0; font-size: 12px; color: #856404; flex-shrink: 0; }
#near-banner.show { display: block; }
#near-banner strong { color: #c0392b; }

/* ═══════════════════════════════════════
   ① 검색바
═══════════════════════════════════════ */
#search-bar {
  background: #2563a8;
  padding: 8px 14px;
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
  border-bottom: 2px solid #1a4a8a;
}
#search-bar label { color: #fff; font-weight: bold; white-space: nowrap; font-size: 12px; }
#search-kw {
  height: 28px; border: 1px solid #aabbd4; padding: 0 10px; font-size: 12px;
  border-radius: 3px; width: 260px; background: #fff;
}
#search-kw:focus { outline: 2px solid #4fdfd0; }
#selected-badge {
  background: #4fdfd0; color: #1a3a6a; padding: 3px 12px; border-radius: 12px;
  font-weight: bold; font-size: 12px; display: none; white-space: nowrap;
}
#selected-badge.show { display: inline-block; }

/* ═══════════════════════════════════════
   ② 전체상황판 (요약카드)
═══════════════════════════════════════ */
#summary-area {
  display: flex;
  gap: 0;
  padding: 0;
  flex-shrink: 0;
  border-bottom: 2px solid #d0d8e8;
}
.sum-card {
  cursor: pointer;
  transition: background 0.15s;
  flex: 1;
  background: #fff;
  padding: 10px 14px;
  text-align: center;
  border-right: 1px solid #dde3ef;
  cursor: default;
}
.sum-card:last-child { border-right: none; }
.sum-card .sum-label { color: #667; font-size: 11px; margin-bottom: 3px; }
.sum-card .sum-val   { font-size: 22px; font-weight: bold; color: #1a4a8a; line-height: 1.2; }
.sum-card.near .sum-val  { color: #c0392b; }
.sum-card.pend .sum-val  { color: #e67e22; }
.sum-card.done .sum-val  { color: #888; }
.sum-card .sum-sub   { font-size: 10px; color: #aaa; margin-top: 1px; }
.sum-card:hover { background: #f0f4ff; }

/* ═══════════════════════════════════════
   공통 섹션 박스
═══════════════════════════════════════ */
.section-box {
  background: #fff;
  border: 1px solid #ccd4e0;
  border-radius: 4px;
  margin: 7px 12px 0;
  flex-shrink: 0;
}
.section-box .sec-hd {
  background: #e8f0ff;
  padding: 5px 12px;
  border-bottom: 1px solid #ccd4e0;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
}
.section-box .sec-hd .sec-title i { margin-right: 5px; }
.section-box .sec-body { padding: 6px 10px; }

/* ═══════════════════════════════════════
   ③ 폼+우패널 2분할 컨테이너 (개통정보는 위에 별도)
═══════════════════════════════════════ */
#main-split {
  display: flex;
  flex: 1;
  gap: 0;
  margin: 0 12px 0;
  align-items: stretch;
  min-height: 0;
}

/* 좌측 패널: 임대기본정보 폼 + 임대목록 */
#left-pane {
  flex: 0 0 68%;
  display: flex;
  flex-direction: column;
  gap: 0;
  min-width: 0;
}

/* 임대목록 박스: 남은 세로 공간 모두 채움 */
#list-box {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 200px;
  margin: 0 0 6px 0;
}
#list-box .list-wrap {
  flex: 1;
  overflow-y: auto;
}

/* 우측 패널: 계약현황 + 납부현황 */
#right-pane {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0;
  min-width: 0;
  margin-left: 6px;
}

/* 납부현황 섹션박스: 남은 세로 공간 모두 채움 */
#right-pane .fee-grow {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
#right-pane .fee-grow .sec-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 6px 10px;
}
#right-pane .fee-grow .fee-table-wrap {
  flex: 1;
  overflow-y: auto;
}

/* 패널 안의 섹션박스는 margin 제거 */
#left-pane .section-box,
#right-pane .section-box {
  margin: 0 0 6px 0;
}

/* ═══════════════════════════════════════
   ④ 개통정보 (full-width, main-split 위)
═══════════════════════════════════════ */
#act-box { margin: 7px 12px 0; }
#act-box .sec-hd { background: #e8f0ff; }
.act-table-wrap { overflow-x: auto; }
.act-table { border-collapse: collapse; font-size: 12px; table-layout: fixed; }
.act-table th {
  position: relative;
  background: #dde8ff; padding: 4px 8px; border: 1px solid #b8c8e8;
  text-align: center; white-space: nowrap; font-weight: bold; overflow: hidden;
}
.act-table td {
  padding: 4px 8px; border: 1px solid #dde; background: #fafcff;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.act-empty {
  text-align: center; color: #aaa; padding: 10px 0; font-size: 12px;
}
.act-empty i { font-size: 16px; color: #ccd; display: block; margin-bottom: 3px; }
.act-col-resizer {
  position: absolute; right: 0; top: 0; width: 5px; height: 100%;
  cursor: col-resize; user-select: none; z-index: 10;
}
.act-col-resizer:hover, .act-col-resizer.dragging { background: rgba(80,120,220,0.45); }

/* ═══════════════════════════════════════
   ⑤ 임대정보 입력폼 (좌측 패널)
═══════════════════════════════════════ */
#form-box .sec-hd { background: #e8f5ec; border-bottom-color: #b8d8c0; }

.form-split { display: block; }
.form-left  { padding: 6px 10px; }
.form-right { display: none; }

/* 우측 패널 계약/납부 섹션 */
#right-pane .section-box .sec-hd { background: #e8f5ec; border-bottom-color: #b8d8c0; }

/* 공통 form-table */
.form-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.form-table th {
  background: #d4edda; padding: 5px 8px; border: 1px solid #b0d4bb;
  text-align: center; white-space: nowrap; font-weight: bold; width: 82px;
}
.form-table td {
  padding: 4px 6px; border: 1px solid #dde; background: #f9fff9;
}
.form-table input[type=text],
.form-table input[type=date],
.form-table select,
.form-table textarea {
  width: 100%; border: 1px solid #bbb; padding: 3px 6px; font-size: 12px;
  border-radius: 2px; background: #fff;
}
.form-table input:focus,
.form-table select:focus,
.form-table textarea:focus { outline: 2px solid #4fdfd0; }
.form-table textarea { resize: vertical; min-height: 36px; }
.req { color: #e53e3e; font-size: 10px; margin-left: 2px; }

/* 우측 납부현황 영역 */
.fee-section-title {
  font-size: 11px; font-weight: bold; color: #2e7d32;
  padding: 4px 0 3px; border-bottom: 1px solid #c8e6c9; margin-bottom: 5px;
  display: flex; align-items: center; gap: 4px;
}
.fee-section-title i { margin-right: 2px; }
.fee-table-wrap { overflow-y: auto; margin-bottom: 4px; }

/* 납부 입력 폼 테이블 (우측) */
.fee-form-table { width: 100%; border-collapse: collapse; font-size: 12px; margin-bottom: 8px; }
.fee-form-table th {
  background: #e8f5e9; padding: 4px 7px; border: 1px solid #b0d4bb;
  text-align: center; white-space: nowrap; font-weight: bold; width: 80px;
}
.fee-form-table td {
  padding: 3px 5px; border: 1px solid #dde; background: #fff;
}
.fee-form-table input[type=text],
.fee-form-table select {
  width: 100%; border: 1px solid #bbb; padding: 3px 5px; font-size: 12px;
  border-radius: 2px; background: #fff;
}
.fee-form-table input:focus,
.fee-form-table select:focus { outline: 2px solid #4fdfd0; }

/* 납부이력 테이블 */
.fee-hist-table { width: 100%; border-collapse: collapse; font-size: 11px; }
.fee-hist-table thead th {
  background: #2e7d32; color: #fff; padding: 3px 6px; border: 1px solid #1b5e20;
  text-align: center; white-space: nowrap;
}
.fee-hist-table tbody td {
  padding: 3px 5px; border: 1px solid #ddd; white-space: nowrap;
}
.fee-hist-table tbody tr:nth-child(even) td { background: #f1faf3; }
.fee-hist-table .no-data td {
  text-align: center; color: #aaa; padding: 10px 0; font-size: 11px;
}
/* 납부여부 뱃지 */
.rcv-yes { background: #ccffcc; color: #006600; padding: 1px 7px; border-radius: 10px; font-size: 10px; font-weight: bold; }
.rcv-no  { background: #e53e3e; color: #fff;    padding: 2px 8px; border-radius: 10px; font-size: 10px; font-weight: bold; letter-spacing: 0.3px; }
.rcv-part{ background: #fff3cd; color: #856404; padding: 1px 7px; border-radius: 10px; font-size: 10px; font-weight: bold; }

/* 주소검색 버튼 */
.addr-row { display:flex; gap:4px; align-items:center; }
.addr-row input { flex:1; min-width:0; }
.btn-addr { flex:0 0 auto; padding:3px 9px; font-size:11px; background:#3366cc; color:#fff;
  border:none; border-radius:2px; cursor:pointer; white-space:nowrap; }
.btn-addr:hover { background:#2255aa; }
/* 무상임대 사유 */
.free-reason-wrap { display:flex; align-items:center; gap:5px; }
.free-reason-wrap input[type=checkbox] { width:auto; flex:0 0 auto; cursor:pointer; }
.free-reason-wrap input[type=text] { flex:1; min-width:0; }
/* form-table number/date readonly */
.form-table input[type=number] {
  width:100%; border:1px solid #bbb; padding:3px 6px; font-size:12px;
  border-radius:2px; background:#fff;
}
.form-table input[readonly] { background:#f5f5f5; color:#555; }

/* 폼 비활성화 오버레이 */
#form-box.disabled .form-left {
  position: relative;
  pointer-events: none;
}
#form-box.disabled .form-left::after {
  content: '고객을 먼저 검색하여 선택하세요.';
  position: absolute;
  inset: 0;
  background: rgba(240,244,255,0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: #3366cc;
  font-weight: bold;
  border-radius: 3px;
  pointer-events: none;
  z-index: 2;
}
#right-pane.disabled,
#right-pane.disabled * { pointer-events: none; }
#right-pane.disabled .section-box { opacity: 0.55; }
#form-box.disabled .form-table input,
#form-box.disabled .form-table select,
#form-box.disabled .form-table textarea,
#form-box.disabled .fee-form-table input,
#form-box.disabled .fee-form-table select { background: #f0f0f0; color: #aaa; }

/* ═══════════════════════════════════════
   ⑤ 임대 목록
═══════════════════════════════════════ */
#list-box {
  flex: 1;
  background: #fff;
  border: 1px solid #ccd4e0;
  border-radius: 4px;
  margin: 7px 12px 8px;
  display: flex;
  flex-direction: column;
  min-height: 220px;
}
#list-box .sec-hd { background: #e8f0ff; border-bottom: 1px solid #ccd4e0; border-radius: 4px 4px 0 0; }
.filter-tabs {
  display: flex;
  align-items: center;
  border-bottom: 1px solid #dde3ef;
  flex-shrink: 0;
  background: #f7f9ff;
}
.ftab {
  padding: 5px 16px; cursor: pointer; border-right: 1px solid #dde3ef;
  font-weight: bold; color: #555; user-select: none; font-size: 12px;
}
.ftab:hover { background: #e8f4ff; color: #1a4a8a; }
.ftab.active { background: #3366cc; color: #fff; }
.ftab-excel {
  flex: 1; display: flex; justify-content: center; align-items: center; padding: 3px 0;
}
.btn-excel {
  background: #1d6f42; color: #fff; border: none; border-radius: 3px;
  padding: 4px 14px; font-size: 12px; font-weight: bold; cursor: pointer;
  display: flex; align-items: center; gap: 5px;
}
.btn-excel:hover { background: #155232; }
.btn-del-sel {
  background: #cc3333; color: #fff; border: none; border-radius: 3px;
  padding: 4px 14px; font-size: 12px; font-weight: bold; cursor: pointer;
  display: flex; align-items: center; gap: 5px; margin-left: 6px;
}
.btn-del-sel:hover { background: #aa1111; }
.list-toolbar {
  margin-left: auto; padding: 3px 8px; display: flex; gap: 6px; align-items: center;
}
.list-wrap { flex: 1; overflow: auto; min-height: 0; }
.rental-table { border-collapse: collapse; font-size: 11px; table-layout: auto; white-space: nowrap; }
.rental-table thead { position: sticky; top: 0; z-index: 2; }
.rental-table th {
  background: #3366cc; color: #fff; padding: 4px 5px; border: 1px solid #2255aa;
  text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  position: relative;
}
.rental-table td {
  padding: 3px 5px; border: 1px solid #ddd; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.rental-table tr:nth-child(even) td { background: #f8f8ff; }
.rental-table tr:not(.expand-row):hover td { background: #e8f4ff !important; cursor: pointer; }
.rental-table tr.selected-row td { background: #d0f0d0 !important; }
.rental-col-resizer {
  position: absolute; right: 0; top: 0; width: 5px; height: 100%;
  cursor: col-resize; user-select: none; z-index: 10;
}
.rental-col-resizer:hover, .rental-col-resizer.dragging { background: rgba(80,120,220,0.45); }

/* 상태 뱃지 */
.badge { padding: 1px 7px; border-radius: 10px; font-size: 10px; font-weight: bold; }
.badge-on   { background: #ccffcc; color: #006600; }
.badge-near { background: #ffe0b2; color: #e65100; }
.badge-pend { background: #ffcccc; color: #c62828; }
.badge-done { background: #e0e0e0; color: #555; }
.badge-collect { background: #fff3cd; color: #856404; }
/* 수거완료 버튼 */
.btn-collect {
  background: #e67e22; color: #fff; border: none; border-radius: 3px;
  padding: 2px 8px; font-size: 11px; font-weight: bold; cursor: pointer;
  white-space: nowrap;
}
.btn-collect:hover { background: #ca6f1e; }
/* 수거완료 th/td 쌍 — 대리점소유 선택 시만 표시 */
#collect-th, #collect-td { display: none; }
#collect-th.show { display: table-cell; }
#collect-td.show { display: table-cell; }
#device-collect-inline { display: flex; align-items: center; gap: 6px; flex-wrap: nowrap; }
#device-collect-inline label { font-size: 11px; color: #555; white-space: nowrap; display: flex; align-items: center; gap: 3px; cursor: pointer; }
#device-collect-inline input[type="date"] { font-size: 11px; padding: 1px 4px; border: 1px solid #aaa; border-radius: 2px; width: 100px; }
#device-collect-inline input[type="date"]:disabled { background: #f0f0f0; color: #aaa; }
.collect-delay { font-size: 10px; color: #c0392b; font-weight: bold; margin-left: 4px; }

/* D-day */
.dday-warn    { color: #c62828; font-weight: bold; }
.dday-caution { color: #e65100; font-weight: bold; }

/* ── 행 확장 ── */
tr.expand-row td { background: #f0fff4 !important; padding: 8px 12px; }
.expand-inner { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.expand-section { border: 1px solid #c8e6c9; border-radius: 4px; padding: 7px 10px; background: #fff; }
.expand-section h4 { font-size: 11px; font-weight: bold; color: #2e7d32; margin-bottom: 5px; border-bottom: 1px solid #c8e6c9; padding-bottom: 3px; }
.expand-section table { width: 100%; border-collapse: collapse; font-size: 11px; }
.expand-section th { background: #e8f5e9; padding: 3px 6px; border: 1px solid #c8e6c9; text-align: center; white-space: nowrap; }
.expand-section td { padding: 2px 5px; border: 1px solid #e0e0e0; }

/* ── 고객검색 모달 ── */
#srch-modal-bg { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.48); z-index: 9990; align-items: flex-start; justify-content: center; padding-top: 90px; }
#srch-modal-bg.open { display: flex; }
#srch-modal-box { background: #fff; border-radius: 8px; box-shadow: 0 8px 32px rgba(0,0,0,.28); width: 580px; max-width: 95vw; max-height: 60vh; display: flex; flex-direction: column; }
#srch-modal-hd { background: #2563a8; color: #fff; padding: 10px 16px; font-weight: bold; font-size: 13px; display: flex; align-items: center; justify-content: space-between; flex-shrink: 0; border-radius: 8px 8px 0 0; }
#srch-modal-close { background: none; border: none; font-size: 22px; cursor: pointer; color: #fff; font-weight: bold; line-height: 1; }
#srch-modal-close:hover { color: #ffd; }
#srch-modal-list { overflow-y: auto; flex: 1; }
.srch-item { padding: 9px 16px; border-bottom: 1px solid #eee; cursor: pointer; }
.srch-item:hover { background: #e8f4ff; }
.srch-item .si-top { display: flex; align-items: center; gap: 8px; font-weight: bold; color: #1a4a8a; font-size: 12px; }
.srch-item .si-sub { color: #666; font-size: 11px; margin-top: 3px; line-height: 1.5; }

/* ── 이력 모달 ── */
#hist-modal-bg { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 9991; align-items: flex-start; justify-content: center; padding-top: 110px; }
#hist-modal-bg.open { display: flex; }
#hist-modal-box { background: #fff; border-radius: 8px; box-shadow: 0 8px 32px rgba(0,0,0,.25); width: 500px; max-width: 95vw; max-height: 65vh; display: flex; flex-direction: column; }
#hist-modal-hd { background: #3366cc; color: #fff; padding: 10px 16px; font-weight: bold; font-size: 13px; display: flex; align-items: center; justify-content: space-between; border-radius: 8px 8px 0 0; }
#hist-modal-close { background: none; border: none; font-size: 22px; cursor: pointer; color: #fff; font-weight: bold; }
#hist-modal-body { padding: 12px 16px; overflow-y: auto; flex: 1; }

/* ── 검색어 이전기록 드롭다운 ── */
#search-history-dropdown .sh-item { display:flex;align-items:center;padding:7px 12px;font-size:12px;color:#333;cursor:pointer;white-space:nowrap;overflow:hidden;text-overflow:ellipsis; }
#search-history-dropdown .sh-item:hover { background:#e8f4ff; }
#search-history-dropdown .sh-del { margin-left:auto;padding-left:10px;color:#bbb;font-size:14px;font-weight:bold;flex-shrink:0; }
#search-history-dropdown .sh-del:hover { color:#e53e3e; }
