:root {
    --bg: #F1F5F8;
    --surface: #FFFFFF;
    --blue: #105edd;
    --sidebar: #0F2A44;
    --text: #1E293B;
    --text-sub: #2b4468;
    --border: #E5E7EB;

    --status-검토: #3B82F6;
    --status-보류: #EF4444;
    --status-접수: #F59E0B;
    --status-실사완료: #22C55E;
    --status-진행중단: #8B5CF6;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: 'Pretendard', -apple-system, sans-serif;
}

h1, h2, h3 {
    font-family: 'Pretendard', sans-serif;
}

/* 상단 헤더 */
.topbar {
    background: var(--sidebar);
    color: #FFFFFF;
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.topbar h1 { margin: 0; font-size: 20px; }
.topbar a { color: #FFFFFF; text-decoration: none; opacity: 0.85; }
.topbar a:hover { opacity: 1; }

.page-body { padding: 24px; }


/* 검색/필터 바 */
.search-bar {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 20px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}
.search-bar input, .search-bar select {
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 8px 10px;
    font-size: 14px;
}
.btn {    
    background: var(--blue);
    color: #FFFFFF;
    border: none;
    border-radius: 5px;
    padding: 8px 16px;
    font-size: 16px;
    font-weight:600;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
}
.btn:hover { opacity: 0.9; }
.btn-outline {
    background: #FFFFFF;
    color: var(--blue);
    border: 1px solid var(--blue);
}
.btn-danger { background: #EF4444; }
.btn-disabled {
    background: var(--border);
    color: var(--text-sub);
    cursor: not-allowed;
}

a.btn, button.btn {
    font-family: inherit;
    font-size: 14px;
    line-height: 1.4;
    box-sizing: border-box;
    border-width: 1px;
    border-style: solid;
    border-color: transparent;
    appearance: none;
    -webkit-appearance: none;
    vertical-align: middle;
}
a.btn.btn-outline, button.btn.btn-outline {
    border-color: var(--blue);
}

/* 햄버거 버튼 (평소엔 숨김, 모바일에서만 보임) */
.topbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
}
.hamburger-btn {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text);
    padding: 4px;
}

/* 사이드바 뒤 어두운 배경 (모바일에서 메뉴 열렸을 때) */
.sidebar-overlay {
    display: none;
}

@media (max-width: 900px) {
    .hamburger-btn {
        display: block;
    }

    .app-sidebar {
        position: fixed;
        top: 64px;
        left: 0;
        height: calc(100vh - 64px);
        transform: translateX(-100%);
        transition: transform 0.25s ease;
        z-index: 100;
    }
    .app-sidebar.open {
        transform: translateX(0);
    }

    .sidebar-overlay {
        display: block;
        position: fixed;
        top: 64px;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0,0,0,0.4);
        z-index: 90;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.25s ease;
    }
    .sidebar-overlay.show {
        opacity: 1;
        pointer-events: auto;
    }

    .app-content {
        padding: 16px;
    }
  
}


/* 카드 그리드: PC 2열, 모바일 1열 */
.sales-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}
@media (max-width: 1600px) {
    .sales-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 1199px) {
    .sales-grid { grid-template-columns: 1fr; }
}

.sale-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
}

.sale-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 10px 16px;
    
}
.sale-card-header .addr {
    font-weight: 700;
    font-size: 17px;
}
.sale-card-header .addr .tag {
    background: #16397f;
    color: #FFFFFF;
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 16px;
    margin-right: 4px;
}


.sale-card-actions a {
    font-size: 13px;
    margin-left: 2px;
}




.sale-card-footer {
    padding: 10px 16px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
}
.status-badge {
    display: inline-block;
    color: #FFFFFF;
    border-radius: 5px;
    padding: 7px 16px;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.4;
    border: 1px solid transparent;
    vertical-align: middle;
}
.status-검토 { background: var(--status-검토); }
.status-보류 { background: var(--status-보류); }
.status-접수 { background: var(--status-접수); }
.status-실사완료 { background: var(--status-실사완료); }
.status-진행중단 { background: var(--status-진행중단); }

.pagination {
    margin-top: 20px;
    display: flex;
    justify-content: center;
    gap: 6px;
}
.pagination a, .pagination span {
    display: inline-block;
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    text-decoration: none;
    color: var(--text);
    font-size: 14px;
    background: var(--surface);
}
.pagination .active {
    background: var(--blue);
    color: #FFFFFF;
    border-color: var(--blue);
}

.empty-state {
    text-align: center;
    color: var(--text-sub);
    padding: 60px 0;
}

/* 로그인 화면 */
.login-box {
    max-width: 360px;
    margin: 100px auto;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 32px;
    text-align: center;
}
.login-box h1 { font-size: 18px; margin-bottom: 20px; }
.login-box input {
    width: 100%;
    padding: 10px;
    margin-bottom: 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
}
.login-box .error { color: #EF4444; font-size: 13px; }



/* ===== 레이아웃 (사이드바 + 상단바) ===== */
.app-shell { min-height: 100vh; }

.app-topbar {
    background: #FFFFFF;
    border-bottom: 1px solid var(--border);
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
}
.app-topbar .brand {
    font-weight: 700;
    font-size: 24px;
    color: var(--text);
}
.app-topbar .brand-icon { color: var(--blue); }
.app-topbar .topbar-right {
    font-size: 14px;
    color: var(--text-sub);
}
.app-topbar .topbar-right a { color: var(--blue); text-decoration: none; }

.app-body {
    display: flex;
}

.app-sidebar {
    width: 200px;
    background: #0F2A44;
    border-right: 1px solid var(--border);
    min-height: calc(100vh - 64px);
    padding: 16px 0;
}
.app-sidebar nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.app-sidebar .nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 12px;
    padding: 10px 14px;
    border-radius: 8px;
    color: #CBD5E1;
    text-decoration: none;
    font-size: 14px;
}
.app-sidebar .nav-item svg {
    flex-shrink: 0;
}
.app-sidebar .nav-item:hover {
    background: #11355A;
    color: #FFFFFF;
}
.app-sidebar .nav-item.active {
    background: #3B82F6;
    color: #FFFFFF;
    font-weight: 700;
}
.app-sidebar .nav-item.disabled {
    color: #64748B;
    cursor: not-allowed;
}
.app-sidebar .nav-item.disabled:hover {
    background: transparent;
    color: #64748B;
}

.app-content {
    flex: 1;
    padding: 24px 32px;
    background: var(--bg);
}

/* ===== 영업목록 상단 영역 ===== */
.list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}
.list-header h1 { font-size: 22px; margin: 0; }
.list-header .count { font-size: 14px; color: var(--text-sub); font-weight: 400; margin-left: 8px; }

/* 상태 필터 탭 (색상 점 + 전체) */
.filter-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}
.filter-tabs .tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: #FFFFFF;
    color: var(--text);
    font-size: 13px;
    text-decoration: none;
}
.filter-tabs .tab.active {
    background: var(--blue);
    color: #FFFFFF;
    border-color: var(--blue);
}
.filter-tabs .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}
.dot-검토 { background: var(--status-검토); }
.dot-보류 { background: var(--status-보류); }
.dot-접수 { background: var(--status-접수); }
.dot-실사완료 { background: var(--status-실사완료); }
.dot-진행중단 { background: var(--status-진행중단); }

/* 카드 좌측 상태 색상 바 */
.sale-card { border-left: 4px solid var(--border); position: relative; }
.sale-card.border-검토 { border-left-color: var(--status-검토); }
.sale-card.border-보류 { border-left-color: var(--status-보류); }
.sale-card.border-접수 { border-left-color: var(--status-접수); }
.sale-card.border-실사완료 { border-left-color: var(--status-실사완료); }
.sale-card.border-진행중단 { border-left-color: var(--status-진행중단); }


/* 카드 헤더에 배지+번호+버튼 한 줄 배치 (기존 sale-card-header 보완) */
.sale-card-header .addr { 
    margin-top: 7px;
}
.sale-card-header .addr .num { color: var(--text-sub); font-weight: 400; margin-left: 6px; }


.attached-files {
    margin-top: 10px;
    font-size: 13px;
    color: var(--text-sub);
}

.sale-card-wrap {
    display: flex;
    flex-direction: column;
}


.card-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 19px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 6px;
    padding: 0 2px;
}
.card-title .tag-bracket {
    color: var(--blue);
    font-weight: 700;
    margin-left: 4px;
    font-size: 18px;
}
.card-title-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* 상세 내용 표 (이미지 참고 디자인) */
.detail-table {
    width: calc(100% - 30px);
    border-collapse: collapse;
    font-size: 16px;
    margin: 0 15px 15px 15px;
}
.detail-table td {
    border: 1px solid var(--border);
    padding: 10px 14px;
    vertical-align: top;
}
.detail-table .dt-label {
    background: #F1F5F9;
    color: #092344;
    width: 110px;
    font-weight: 500;
    white-space: nowrap;
    text-align:center;
}
.detail-table .dt-value {
    color: var(--text);
}

.line-check-row {
    display: flex;
    gap: 28px;
}
.line-checklist {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
    gap: 3px;
    font-size: 13px;
    white-space: nowrap;
    margin:5px 0 4px 5px;
}
.line-checklist .on { color: var(--blue); font-weight: 700; }
.line-checklist .off { color: var(--text-sub); }
.line-detail {
    color: var(--text);
    font-weight: 400;
    line-height: 1.7;
}
.line-detail .num-highlight {
    color: var(--blue);
    font-weight: 700;
}



/* ===== 입력 폼 디자인 ===== */
.form-page {
    max-width: 900px;
    margin: 0 auto;
}
.form-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}
.form-topbar h1 { font-size: 22px; margin: 0; }
.form-topbar .back-link { font-size: 14px; color: var(--text-sub); text-decoration: none; }
.form-topbar .back-link:hover { color: var(--blue); }

.form-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 20px 24px;
    margin-bottom: 16px;
}
.form-card h3 {
    margin: 0 0 16px 0;
    font-size: 15px;
    color: var(--text);
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
}
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px 24px;
}
@media (max-width: 700px) {
    .form-grid { grid-template-columns: 1fr; }
}
.form-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.form-field.full { grid-column: 1 / -1; }
.form-field label {
    font-size: 13px;
    color: var(--text-sub);
    font-weight: 500;
}
.form-field .required-mark { color: #EF4444; margin-left: 2px; }
.form-field input,
.form-field select,
.form-field textarea {
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 9px 12px;
    font-size: 14px;
    font-family: inherit;
    width: 100%;
}
.form-field textarea { min-height: 70px; resize: vertical; }

.input-with-unit { display: flex; gap: 8px; }
.input-with-unit input { flex: 1; }
.input-with-unit select { width: 90px; flex-shrink: 0; }

.checkbox-group {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
    padding: 4px 0;
}
.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    color: var(--text);
    font-weight: 400;
}
.checkbox-group input[type="checkbox"] { width: 16px; height: 16px; }

.line-set-card {
    border: 1px dashed var(--border);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 12px;
    position: relative;
}
.line-set-label {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-sub);
    margin-bottom: 8px;
}
.remove-line-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    font-size: 12px;
    padding: 5px 10px;
}

.file-field {
    border: 1px dashed var(--border);
    border-radius: 8px;
    padding: 14px;
    margin-bottom: 10px;
}
.file-field label {
    display: block;
    font-size: 13px;
    color: var(--text-sub);
    margin-bottom: 6px;
    font-weight: 500;
}
.existing-file-note { font-size: 12px; margin-bottom: 6px; }
.existing-file-note a { color: var(--blue); }

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin: 20px 0 40px 0;
}
.form-actions .btn { padding: 10px 24px; font-size: 15px; }

.users-table td {
    text-align: center;
    vertical-align: middle;
}

.settings-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}
.settings-tabs a {
    display: inline-flex;
    align-items: center;
    padding: 8px 18px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    border: 1px solid var(--border);
    background: #FFFFFF;
    color: var(--text-sub);
}
.settings-tabs a.active {
    background: var(--sidebar);
    color: #FFFFFF;
    border-color: var(--sidebar);
}

.form-actions-center {
    justify-content: center;
}