/* 단가표 테이블 스크롤 및 모바일 터치 스크롤 보강 */
#tableWrap {
    max-height: 60vh;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    overscroll-behavior: contain;
}
@media (max-width: 600px) {
    #tableWrap {
        max-height: 55vh;
        touch-action: pan-y;
    }
}
/* 브랜드 뱃지 명확하게 표시 */
.brand-badge {
    display: inline-block;
    font-size: 10px !important;
    color: #444 !important;
    background: #e0e0e0 !important;
    border-radius: 5px !important;
    padding: 0.5px 4px !important;
    margin-left: 0 !important;
    font-weight: 700 !important;
    letter-spacing: 0.3px;
    vertical-align: middle;
    line-height: 1.05;
    box-shadow: none;
    max-width: 48px;
    min-width: 16px;
    word-break: break-all;
}
/* 모바일에서 nav-right(설정 등) 아이콘 항상 보이게 */
@media (max-width: 600px) {
    .top-nav {
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        z-index: 9999;
        background: var(--lime-light);
        box-shadow: 0 2px 5px rgba(0,0,0,0.05);
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0 4px;
        min-height: 56px;
    }
    .nav-right {
        background: var(--lime-light);
        z-index: 10000;
        position: relative;
        display: flex;
        flex-direction: row;
        flex-wrap: nowrap;
        gap: 4px;
        margin-right: 2px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .menu-btn {
        font-size: 15px;
        padding: 7px 10px;
        min-width: 60px;
        flex: 0 1 auto;
        white-space: nowrap;
        flex-shrink: 0;
    }
}
/* ================================
       기본 색상 테마
================================ */
:root {
    --lime-light: #f2ffe5;
    --lime: #d9ffb3;
    --lime-dark: #96d35f;

    --mint: #d7fff7;
    --mint-dark: #58c4b7;

    --gray-light: #f6f6f6;
    --gray: #cccccc;
    --dark: #333;
}

/* ================================
      전체 기본 스타일
================================ */
body {
    margin: 0;
    background: #ffffff;
    font-family: "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
    color: var(--dark);
}

.page-container {
    padding-top: 70px;
}

.page-section {
    padding: 12px 8px;
}

.section-title {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 20px;
}

/* ================================
      상단 네비바 (1줄)
================================ */
.top-nav {
    position: fixed;
    top: 0;
    width: 100%;
    min-height: 56px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fbfd 100%);
    border-bottom: 1px solid #e6eef2;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
    padding: 6px 6px;
    z-index: 9999;
    box-shadow: 0 10px 24px rgba(0,0,0,0.05);
}

/* ================================
        날짜 컨트롤 (왼쪽)
================================ */
.nav-left {
    display: flex;
    align-items: center;
    gap: 4px;
}

.date-btn {
    width: 36px;
    height: 36px;
    background: #e7f8ed;
    color: #1b8a4a;
    border: 2px solid #48c774;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 2px 0 rgba(72, 199, 116, 0.12) inset;
}
.date-btn:active { transform: translateY(1px); }

.date-text {
    font-size: 16px;
    font-weight: 800;
    min-width: 100px;
    text-align: center;
    background: transparent;
    color: #1b8a4a;
    border: none;
    padding: 4px 8px;
}

/* 달력 & 엑셀 아이콘 */
.icon-btn {
    width: 36px;
    height: 36px;
    background: #eef5ff;
    border: 2px solid #a9cfff;
    border-radius: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 16px;
    color: #2b73d2;
    cursor: pointer;
    box-shadow: 0 3px 10px rgba(10, 54, 140, 0.08);
}
.icon-btn:active { transform: translateY(1px); }

/* ================================
        메뉴 버튼 (오른쪽)
================================ */
.nav-right {
    display: flex;
    align-items: center;
    gap: 0;
    flex-wrap: wrap;
    justify-content: flex-end;
    z-index: 10001;
    position: relative;
}

.menu-btn {
    padding: 4px 4px;
    background: transparent;
    border: none;
    font-weight: 600;
    font-size: 14px;
    color: #888;
    cursor: pointer;
    transition: 0.15s;
    padding: 8px 12px;
    border-radius: 4px;
    z-index: 10001;
    position: relative;
}

.menu-btn.active {
    color: #1b8a4a;
    font-weight: 700;
}

/* ================================
    배송비/수수료 합계 (섹션 헤더 또는 네비바)
================================ */
.navbar-delivery-summary {
        display: flex;
        gap: 4px;
        align-items: center;
        font-size: 15px;
        font-weight: 700;
        color: #dc3545;
        margin-left: 8px;
}

/* 모바일에서 네비바 순배송비 강조 */
@media (max-width: 600px) {
    #navbarNetDeliveryFee {
        font-size: 17px;
        color: #dc3545;
        background: #fff6f6;
        border-radius: 8px;
        padding: 2px 8px 2px 6px;
        margin-left: 2px;
        box-shadow: 0 1px 4px rgba(220,53,69,0.07);
        font-weight: 800;
        display: flex;
        align-items: center;
    }
    #navbarNetDeliveryFee .summary-label {
        display: inline;
        font-size: 14px;
        color: #dc3545;
        margin-right: 4px;
        font-weight: 700;
    }
}

.section-header {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 16px;
    width: 100%;
    padding: 12px 0;
    border-bottom: 1px solid #e0e0e0;
    position: sticky;
    top: 64px;
    background: #ffffff;
    z-index: 10;
}

.section-header h3 {
    display: none;
}

.delivery-summary-container {
    display: flex;
    gap: 8px;
    align-items: center;
}

#orderList {
    margin-top: 8px;
}

.delivery-summary-left {
    display: flex;
    gap: 8px;
    padding: 0;
}

.delivery-summary-right {
    display: flex;
    gap: 8px;
    padding: 0;
}

.summary-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
}

.summary-label {
    display: none;
}

.summary-value {
    font-size: 16px;
    font-weight: 700;
    color: #ff6b35;
}

/* 순배송비 빨간색 */
#netDeliveryFee {
    color: #dc3545;
}

/* 배송비합, 수수료 파란색 */
#totalDeliveryFee,
#totalCommission {
    color: #0d6efd;
}

.order-box {
    background: #ffffff;
    border: 1.5px solid var(--gray);
    border-radius: 12px;
    padding: 14px;
    margin-bottom: 16px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}

.order-header {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 6px;
}


.order-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 22px rgba(255, 185, 90, 0.18);
}

/* 미상차 상태: 회색 처리 */
.order-item.undeliverable {
    background: #e8e8e8;
    opacity: 0.7;
    pointer-events: auto;
}

.order-item.undeliverable:hover {
    transform: none;
    box-shadow: none;
}

.order-item .badge {
    font-size: 13px;
    padding: 6px 8px;
    border-radius: 8px;
}

.same-addr {
  display: inline-block;
  background: #fff4e6;
  color: #d97706;
  border: 1px solid #ffd8a8;
  padding: 2px 6px;
  margin-left: 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
}
/* previous sync-badge styles removed; using .same-addr for identical-address badges */

/* unlink button for grouped coords */
/* unlink-group removed */

.order-item a {
    color: var(--mint-dark);
    text-decoration: none;
}

.order-item .mt-2 {
    margin-top: 8px !important;
}

.geo-failed {
    color: #dc3545; /* Bootstrap danger red */
    font-weight: 700;
    margin-left: 8px;
}

/* 그룹된 같은집 박스: 기존 주문 카드(.order-item)를 감싸서 묶음으로 보여줌 */
.group-box {
    border: 2.2px solid #f8d4a8; /* 굵은 테두리 */
    background: #ffffff; /* 흰색 배경 */
    padding: 6px;
    margin-bottom: 12px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(255, 185, 90, 0.06);
}
.group-box .group-header {
    font-size: 13px;
    color: #8b5a3c;
    font-weight: 800;
    margin-bottom: 6px;
    background: transparent;
    padding: 0;
    border-radius: 0;
    display: block;
}
.group-box .group-address {
    font-size: 14px;
    color: #0d47a1;
    font-weight: 700;
    margin-bottom: 8px;
    padding: 4px 0;
    border-bottom: 1px solid #f0f0f0;
    display: block;
}
.group-box .group-inner {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Infowindow specific styles */
.infowindow-time {
    font-size: 16px !important;
    padding: 8px 10px !important;
    min-width: 140px;
    border-radius: 8px;
    border: 1px solid #d0c2a1;
    background: #fff;
}
.infowindow-tel {
    display: inline-block;
    margin-top: 6px;
    color: #1b5e20;
    font-weight: 700;
    text-decoration: none;
}
.infowindow-tel:hover { text-decoration: underline; }

/* delivery note inside infowindow */
.infowindow-note {
    margin-top: 8px;
    font-size: 13px;
    color: #5a4a2a;
    background: rgba(250,240,220,0.6);
    padding: 6px 8px;
    border-radius: 6px;
}

/* 리스트와 일반 UI용 시간 드롭다운을 더 크게 만들어 클릭/터치 편의성 향상 */
.time-dropdown {
    font-size: 16px;
    padding: 8px 12px;
    min-width: 120px;
    border-radius: 8px;
    border: 1px solid #ffd29b;
    background: #fff;
    box-shadow: none;
}

/* 리스트 내부 시간 드롭다운 강제 적용(더 크고 읽기 쉬운 스타일) */
.order-item .time-dropdown {
    font-size: 16px;
    padding: 8px 12px;
    min-width: 130px;
}

/* 상태 드롭다운 스타일(시간 드롭다운과 통일) */
.status-dropdown {
    font-size: 16px;
    padding: 8px 12px;
    min-width: 140px;
    border-radius: 8px;
    border: 1px solid #ffd29b;
    background: #fffef6;
    margin-left: 6px;
}

@media (max-width: 600px) {
    .time-dropdown, .infowindow-time {
        font-size: 16px;
        padding: 8px 12px;
        min-width: 140px;
    }
}

/* per-row retry button removed */

/* 주소 링크을 리스트에서 검은색으로 표시 */
.order-item .address-link {
    color: #0d47a1 !important;
    font-weight: 700;
}

/* 상품명: 진하게 하지 않고 약간 크게 보이도록 조정 */
.product-names {
    font-weight: 500;
    color: #222;
    font-size: 20px;
}

/* 인포윈도우/리스트 전화번호 파란색 */
.infowindow-tel {
    color: #1976d2 !important;
    font-weight: 700;
    text-decoration: none;
}
.infowindow-tel:hover {
    text-decoration: underline;
}

/* 모바일에서 카드 간격 조정 */
@media (max-width: 600px) {
    .order-item {
        padding: 12px;
        margin-bottom: 10px;
    }
    .date-text { min-width: 90px; }
}

/* ================================
   Mobile-only Navbar polish (screenshot style)
================================ */
@media (max-width: 600px) {
    .top-nav {
        background: #ffffff;
        border-bottom: 1px solid #e6eef2;
        box-shadow: 0 4px 14px rgba(0,0,0,0.06);
        padding: 6px 8px;
        min-height: 64px;
    }
    .nav-left { gap: 3px; }

    /* Date pill and arrows */
    .date-btn {
        width: 32px;
        height: 32px;
        background: #e7f8ed;
        color: #1b8a4a;
        border: 1.4px solid #48c774;
        border-radius: 8px;
        font-weight: 800;
    }
    .date-text {
        background: transparent;
        color: #1b8a4a;
        border: none;
        padding: 4px 6px;
        font-weight: 800;
        font-size: 14px;
        min-width: 90px;
    }

    /* Toolbar icon buttons */
    .icon-btn {
        width: 32px;
        height: 32px;
        background: #eef7ff;
        border: 1.5px solid #9bc6ff;
        color: #2b73d2;
        border-radius: 8px;
        font-size: 14px;
    }

    /* Menu pills */
    .nav-right { gap: 0; }
    .menu-btn {
        padding: 4px 3px;
        background: transparent;
        border: none;
        color: #888;
        font-weight: 600;
        font-size: 13px;
    }
    .menu-btn.active {
        color: #1b8a4a;
        font-weight: 700;
    }
}

/* 초소형 화면(<=360px)에서 날짜 글자 더 축소 */
@media (max-width: 360px) {
    .date-text {
        font-size: 14px;
        padding: 5px 10px;
        min-width: 105px;
    }
}

/* 모바일에서 배송비 합계 표시 (섹션 헤더) */
@media (max-width: 600px) {
    .navbar-delivery-summary {
        display: none !important;
    }
    .section-header {
        display: flex !important;
    }
    .section-header {
        flex-wrap: nowrap;
        align-items: center;
        gap: 6px;
        margin-bottom: 8px;
    }
    .section-header h3 {
        font-size: 18px;
        margin: 0;
        flex-shrink: 0;
    }
    .delivery-summary-container {
        display: flex;
        gap: 6px;
        align-items: center;
    }
    .delivery-summary-right {
        gap: 6px;
    }
    .summary-value {
        font-size: 14px;
        font-weight: 700;
    }
}

/* 극소형 화면(<=340px)에서 네비바 2줄 분리 */
@media (max-width: 340px) {
    .top-nav {
        justify-content: center;
        gap: 8px;
    }
    .nav-left {
        width: 100%;
        order: 1;
        justify-content: center;
    }
    .nav-right {
        width: 100%;
        order: 2;
        justify-content: space-around;
    }
    .menu-btn {
        flex: 1;
        min-width: auto;
        padding: 4px 5px;
        font-size: 13px;
        background: transparent;
        border: none;
    }
}

/* 저장 시 잠깐 하이라이트 */
.saved-flash {
    box-shadow: 0 0 0 3px rgba(46, 204, 113, 0.35) inset, 0 8px 22px rgba(255, 185, 90, 0.18) !important;
    transition: box-shadow 0.2s ease;
}

/* ================================
        지도 영역
================================ */
.map-area {
    width: 100%;
    height: calc(100vh - 70px);
    border-radius: 12px;
    overflow: hidden;
}

/* 네이버 지도 로고만 숨김 (최소한으로) */
.map-area a[title*="NAVER"],
.map-area a[href*="naver.com"][target="_blank"] {
    display: none !important;
}

/* ================================
        대시보드
================================ */
.dash-card-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.dash-card {
    background: var(--lime-light);
    padding: 18px;
    border-radius: 12px;
    flex: 1;
    min-width: 140px;
    text-align: center;
    border: 1.8px solid var(--lime);
}

.dash-icon {
    font-size: 28px;
    color: var(--lime-dark);
}

.dash-value {
    font-size: 20px;
    font-weight: 800;
    margin: 10px 0 4px;
}

.dash-label {
    font-size: 14px;
    color: #666;
}

/* ================================
        설정 페이지
================================ */
.memo-box {
    width: 100%;
    height: 120px;
    border-radius: 10px;
    border: 2px solid #ddd;
    padding: 12px;
    font-size: 16px;
    font-family: inherit;
    resize: vertical;
    box-sizing: border-box;
}

.memo-box:focus {
    outline: none;
    border-color: #48c774;
    box-shadow: 0 0 8px rgba(72, 199, 116, 0.3);
}

.save-btn {
    background: linear-gradient(135deg, #4a90e2 0%, #357abd 100%);
    color: white;
    padding: 14px 24px;
    border-radius: 10px;
    border: none;
    font-weight: 600;
    font-size: 16px;
    cursor: pointer;
    display: block;
    width: 100%;
    margin-top: 16px !important;
    box-sizing: border-box;
    transition: all 0.3s ease;
}

.save-btn:hover {
    box-shadow: 0 4px 12px rgba(74, 144, 226, 0.4);
    transform: translateY(-2px);
}

.save-btn:active {
    transform: translateY(0);
}

.login-btn {
    background: linear-gradient(135deg, #4a90e2 0%, #357abd 100%);
    color: #ffffff;
    padding: 14px 28px;
    border-radius: 12px;
    border: none;
    font-weight: 700;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(74, 144, 226, 0.3);
    transition: all 0.3s ease;
    width: 100%;
}

.login-btn:hover {
    box-shadow: 0 6px 16px rgba(74, 144, 226, 0.4);
    transform: translateY(-2px);
}

.login-btn:active {
    transform: translateY(0);
}

.logout-btn {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a52 100%);
    color: #ffffff;
    padding: 14px 28px;
    border-radius: 12px;
    border: none;
    font-weight: 700;
    font-size: 16px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(255, 107, 107, 0.3);
    transition: all 0.3s ease;
    width: 100%;
}

.logout-btn:hover {
    box-shadow: 0 6px 16px rgba(255, 107, 107, 0.4);
    transform: translateY(-2px);
}

.logout-btn:active {
    transform: translateY(0);
}

/* 숨김 */
.d-none {
    display: none !important;
}

/* 등록일(regDate) 표시 스타일 */
.reg-date {
    display: inline-block;
    background: #e0e0e0;
    color: #666;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 12px;
    margin-left: 6px;
    font-weight: 500;
}

/* 단가표 버튼 스타일 */
.price-list-btn {
    display: inline-block;
    background: #e0e0e0;
    color: #ff5252;
    font-size: 12px;
    padding: 4px 12px;
    border-radius: 15px;
    border: none;
    margin-left: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.price-list-btn:hover {
    background: #d0d0d0;
    color: #ff1744;
    text-decoration: none;
}

/* 배송비 계산기 스타일 */
.delivery-example {
    font-size: 12px;
    padding: 6px 0;
}

.fee-option {
    display: inline-block;
    background: #e8f5e9;
    color: #2e7d32;
    padding: 3px 8px;
    margin: 0 4px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 11px;
    transition: all 0.2s ease;
}

.fee-option:hover {
    background: #c8e6c9;
    transform: scale(1.05);
}

.comm-option {
    display: inline-block;
    background: #f5f5f5;
    color: #999;
    padding: 3px 8px;
    margin: 0 4px;
    border-radius: 10px;
    cursor: default;
    font-size: 11px;
    transition: all 0.2s ease;
    pointer-events: none;
}

/* 수수료 클릭 비활성화 - hover 효과 제거 */
/* .comm-option:hover {
    background: #ffe0b2;
    transform: scale(1.05);
} */

.delivery-calc {
    display: flex;
    align-items: center;
}

.calc-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.calc-input {
    width: 70px;
    padding: 6px 8px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 13px;
    text-align: right;
}

.calc-save-btn {
    background: #48c774;
    color: white;
    border: none;
    padding: 6px 16px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.calc-save-btn:hover {
    background: #3ba662;
}

.delivery-confirmed {
    font-size: 14px;
    color: #333;
    padding: 0 0 0 6px;
    white-space: nowrap;
}

/* ================================
   데스크탑(넓은 화면) 분할 뷰: 왼쪽 리스트, 오른쪽 지도
   화면이 넓을 때(예: >= 992px) 리스트와 지도를 50/50으로 나누어 표시
================================ */
@media (min-width: 992px) {
    .page-container {
        display: flex;
        gap: 20px;
        align-items: flex-start;
    }

    /* 페이지 섹션 중 리스트와 지도는 항상 보이도록 함 */
    #orders, #mapPage {
        display: block !important;
        width: 50%;
        box-sizing: border-box;
        padding: 12px 8px;
        height: calc(100vh - 70px);
        overflow: auto;
    }

    /* 지도는 오른쪽 영역에 꽉 차게 표시 */
    #map {
        height: calc(100vh - 70px - 32px); /* 섹션 padding 보정 */
        border-radius: 12px;
    }

    /* 네비바: 배송비 합계는 섹션 헤더로 이동 */
    .navbar-delivery-summary {
        display: flex;
    }
    .section-header {
        display: none;
    }

    /* 대시보드나 설정은 기존 동작 유지 (필요 시 직접 선택해서 표시) */
}

/* ================================
   jQuery UI Datepicker 스타일 수정
================================ */
.ui-datepicker {
    z-index: 99999 !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 10px;
    background: white;
}

.ui-datepicker-header {
    background: #48c774;
    color: white;
    border-radius: 6px;
    padding: 8px;
    margin-bottom: 8px;
}

.ui-datepicker-title {
    color: white;
    font-weight: 600;
}

.ui-datepicker .ui-datepicker-prev,
.ui-datepicker .ui-datepicker-next {
    cursor: pointer;
}

.ui-datepicker td {
    padding: 2px;
}

.ui-datepicker td a {
    text-align: center;
    padding: 6px;
    border-radius: 6px;
}

.ui-datepicker td .ui-state-default {
    background: #f5f5f5;
    border: 1px solid #ddd;
}

.ui-datepicker td .ui-state-active {
    background: #48c774 !important;
    color: white !important;
    border: 1px solid #48c774 !important;
}

.ui-datepicker td .ui-state-hover {
    background: #e8f5e9;
    border: 1px solid #48c774;
}
/* ====== M / 계좌 버튼 스타일 ====== */
.m-link {
    background: #4a90e2;
    color: white;
    padding: 6px 10px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 600;
    font-size: 13px;
    margin-left: 6px;
    display: inline-block;
    transition: all 0.2s ease;
}

.m-link:hover {
    background: #357abd;
    transform: scale(1.05);
}

.custom-link {
    background: #ffc107;
    color: #333;
    padding: 6px 10px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 600;
    font-size: 13px;
    margin-left: 6px;
    display: inline-block;
    transition: all 0.2s ease;
}

.custom-link:hover {
    background: #ffb300;
    transform: scale(1.05);
}

/* ====== 월 선택 버튼 스타일 ====== */
.month-nav-btn {
    background: #48c774;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 1.2em;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 600;
}

.month-nav-btn:hover {
    background: #3aa360;
    transform: scale(1.1);
}

.month-nav-btn:active {
    transform: scale(0.95);
}