/* Bizeni - Standard Fluent UI Base Styles */

:root {
    /* Basic Brand Colors (kept for branding but using Fluent tokens where possible) */
    --bizeni-ci-blue: #004494;
    --accent-fill-rest: var(--bizeni-ci-blue);
    --bizeni-shell-header-h: 50px;
    --bizeni-shell-footer-h: 1.375rem;
    --bizeni-page-action-footer-h: 3.25rem;
}

.bizeni-shell-no-footer {
    --bizeni-shell-footer-h: 0px;
}

/* 전역 앱 셸 Footer — 연한 톤·낮은 높이, 본문과는 상단선으로만 구분 */
.bizeni-app-shell-footer.footer {
    flex-shrink: 0;
    min-height: var(--bizeni-shell-footer-h);
    box-sizing: border-box;
    padding: 0.125rem 1rem 0.15rem;
    padding-bottom: max(0.15rem, env(safe-area-inset-bottom, 0));
    margin: 0;
    position: relative;
    z-index: 24;
    background: color-mix(in srgb, var(--neutral-layer-2) 45%, var(--neutral-layer-1));
    color: var(--neutral-foreground-hint);
    border-top: 1px solid color-mix(in srgb, var(--neutral-stroke-divider-rest) 65%, transparent);
    box-shadow: none;
    font-size: var(--type-ramp-minus-2-font-size, 0.6875rem);
    line-height: 1.15;
    letter-spacing: 0.01em;
}

@supports not (background: color-mix(in srgb, white 50%, black)) {
    .bizeni-app-shell-footer.footer {
        background: var(--neutral-layer-1);
        border-top-color: var(--neutral-stroke-divider-rest);
    }
}

.bizeni-app-shell-footer__copy,
.bizeni-app-shell-footer__version {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bizeni-app-shell-footer__version {
    font-variant-numeric: tabular-nums;
    opacity: 0.8;
}

.bizeni-app-shell-footer__copy {
    opacity: 0.85;
}

@media print {
    .bizeni-app-shell-footer {
        display: none !important;
    }
}

body {
    margin: 0;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--neutral-layer-1);
    color: var(--neutral-foreground-rest);
}

/* Ensure Fluent Layout takes full height */
#app {
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ResponsiveDualView 및 목록 툴바와 동일 브레이크포인트(≥769px 데스크톱) */
@media (max-width: 768px) {
    .bizeni-show-md-up {
        display: none !important;
    }
}

@media (min-width: 769px) {
    .bizeni-show-sm-only {
        display: none !important;
    }
}

/* Custom styles for specific Bizeni components that don't have a Fluent equivalent yet */
.bizeni-brand-connected-logo {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 1rem;
}

.bizeni-brand-connected-logo__svg {
    max-width: 240px;
    height: auto;
}

/* ─── 견적 편집(/sales/quotations 편집·직접 URL): 메인 영역 스크롤 + sticky 헤더/푸터 ─── */
.bizeni-quote-edit-page-host {
    display: flex;
    flex-direction: column;
    width: 100%;
    box-sizing: border-box;
    padding: 0 1.5rem 1rem 1.5rem;
    min-height: 100%;
}

.bizeni-quote-edit-page-host--standalone {
    padding-top: 0.75rem;
}

.bizeni-quote-edit-page-host .bizeni-quote-detail-root--page {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.bizeni-quote-detail-chrome.bizeni-quote-detail-chrome--page,
.bizeni-order-detail-root--page.bizeni-quote-detail-chrome--page {
    display: flex;
    flex-direction: column;
    min-height: min(100%, calc(100dvh - 7rem));
    /* 테이블 thead sticky 시 Level1 바로 아래 정렬 */
    --bizeni-quote-sticky-context-h: 3.5rem;
}

@media (max-width: 768px) {
    .bizeni-quote-detail-chrome.bizeni-quote-detail-chrome--page,
    .bizeni-order-detail-root--page.bizeni-quote-detail-chrome--page {
        --bizeni-quote-sticky-context-h: 6.5rem;
    }
}

.bizeni-quote-edit-page-host .bizeni-order-detail-root--page {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.bizeni-customer-edit-panel__header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
    padding-bottom: 0.35rem;
}

/* 서랍·분할·모달: 패널 내부 스크롤 유지 */
.bizeni-customer-edit-panel__scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* 전체 페이지: 내부 세로 스크롤 없음 — FluentBodyContent(본문)이 스크롤 */
.bizeni-quote-detail-page-main {
    flex: 1 1 auto;
    min-height: 0;
    overflow: visible;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.bizeni-quote-detail-error-bar {
    margin-bottom: 0.25rem;
}

.bizeni-quote-detail-success-bar {
    margin-bottom: 0.25rem;
}

/* Page 전용: 슬림 Sticky 컨텍스트 바 (번호·상태·고객·합계·액션) */
.bizeni-quote-page-context-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem 0.75rem;
    padding: 0.35rem 0;
    box-sizing: border-box;
}

.bizeni-quote-page-context-bar--sticky {
    position: sticky;
    top: 0;
    z-index: 45;
    margin: 0 0 0.35rem 0;
    padding: 0.4rem 0 0.5rem;
    background: var(--neutral-layer-1);
    border-bottom: 1px solid var(--neutral-stroke-divider-rest);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.06);
}

.bizeni-quote-page-context-bar__lead {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem 0.65rem;
    min-width: 0;
    flex: 1 1 12rem;
}

.bizeni-quote-page-context-bar__back {
    flex-shrink: 0;
}

.bizeni-quote-page-context-bar__doc {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
    min-width: 0;
}

.bizeni-quote-page-context-bar__no {
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    font-size: var(--type-ramp-base-font-size);
    max-width: 14rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bizeni-quote-page-context-bar__draft {
    font-size: var(--type-ramp-minus-1-font-size);
    color: var(--neutral-foreground-hint);
}

.bizeni-quote-page-context-bar__cust {
    display: inline-flex;
    align-items: baseline;
    gap: 0.25rem;
    min-width: 0;
    max-width: min(28rem, 100%);
    font-size: var(--type-ramp-minus-1-font-size);
    color: var(--neutral-foreground-rest);
}

.bizeni-quote-page-context-bar__cust-label {
    flex-shrink: 0;
    color: var(--neutral-foreground-hint);
}

.bizeni-quote-page-context-bar__cust-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 600;
}

.bizeni-quote-page-context-bar__trail {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 0.35rem;
    flex-shrink: 0;
}

.bizeni-quote-page-context-bar__total {
    font-size: var(--type-ramp-minus-1-font-size);
    color: var(--neutral-foreground-rest);
    margin-inline-end: 0.25rem;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.bizeni-quote-page-context-bar__btn {
    flex-shrink: 0;
}

.bizeni-quote-page-context-bar__btn--primary {
    font-weight: 600;
}

/* Page: 견적 상세(날짜·조건·비고) — sticky 아님 */
.bizeni-quote-detail-meta-scroll {
    margin-top: 0;
}

.bizeni-form-section--quote-header-compact .bizeni-form-section__title {
    margin: 0 0 0.5rem;
    font-size: var(--type-ramp-plus-1-font-size);
}

/* 견적 기본정보 필드: 모바일 1열 · 넓은 화면 2열, 비고는 전폭 */
.bizeni-field-grid--quote-header-compact {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 0.4rem 1rem;
    align-items: start;
}

@media (min-width: 880px) {
    .bizeni-field-grid--quote-header-compact {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.bizeni-field-grid--quote-header-compact .bizeni-field--span-full {
    grid-column: 1 / -1;
}

/* 넓은 화면: 상세 3열(권장안 Level 2) */
@media (min-width: 1024px) {
    .bizeni-field-grid--quote-detail-3col {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

.bizeni-quote-detail-body--compact-gap {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.bizeni-quote-detail-footer-sticky {
    position: sticky;
    bottom: 0;
    z-index: 40;
    margin-top: 0.75rem;
    padding-top: 0.65rem;
    padding-bottom: env(safe-area-inset-bottom, 0);
    background: var(--neutral-layer-1);
    border-top: 1px solid var(--neutral-stroke-divider-rest);
    box-shadow: 0 -4px 14px rgba(0, 0, 0, 0.06);
}

.bizeni-quote-detail-footer-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    justify-content: space-between;
}

.bizeni-quote-detail-footer-bar__lead {
    min-width: 0;
}

.bizeni-quote-detail-footer-bar__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    align-items: center;
    justify-content: flex-end;
    margin-left: auto;
}

/* Page: 푸터는 인쇄·수주 전환 등 보조만(저장은 상단 바) */
.bizeni-quote-detail-footer--secondary-only .bizeni-quote-detail-footer-bar {
    justify-content: flex-end;
}

.bizeni-quote-detail-footer--secondary-only .bizeni-quote-detail-footer-bar__lead:empty {
    display: none;
}

/* 견적 라인 엑셀: 문서(메인) 스크롤 모드 — 호스트에 세로 스크롤바를 두지 않음 */
.bizeni-quote-lines-excel-grid-host--outer-scroll {
    max-height: none;
    overflow-x: auto;
    overflow-y: visible;
}

/* Level 3: 품목 그리드 열 헤더 — Page 에서 Level1 아래에 고정 */
.bizeni-quote-lines-excel-grid-host--outer-scroll .bizeni-excel-grid__table thead th {
    position: sticky;
    top: var(--bizeni-quote-sticky-context-h, 3.5rem);
    z-index: 28;
    background: var(--neutral-layer-1);
    box-shadow: 0 1px 0 var(--neutral-stroke-divider-rest);
}

.quotation-lines-excel--outer-doc-scroll {
    min-height: unset !important;
}

/* 수주 라인 HTML 테이블: Page 모드에서 열 헤더 sticky */
.sales-lines-table-host--sticky-head .sales-lines-table thead th {
    position: sticky;
    top: var(--bizeni-quote-sticky-context-h, 3.5rem);
    z-index: 28;
    background: var(--neutral-layer-1);
    box-shadow: 0 1px 0 var(--neutral-stroke-divider-rest);
}

/* 수주 Page: 하단 액션바 — 저장은 상단 컨텍스트 바로 이동 */
.bizeni-order-editor-actions.bizeni-quote-detail-footer--secondary-only .bizeni-order-save-btn {
    display: none;
}
