/* =========================================================================
   상세 프레임 공통 페이지 패턴 (목록 / 폼)
   - .app-page-list : 목록 (sticky 툴바 + 테이블)
   - .app-page-form : 조회·수정 폼 (sticky 액션바)
   ========================================================================= */

.app-page-list,
.app-page-form {
  background: var(--app-surface-muted, #f4f6f9);
  min-height: 100%;
  padding: 0 0 20px;
}

.app-page-toolbar {
  position: sticky;
  top: 0;
  z-index: 8;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  padding: 12px 16px;
  margin: 0;
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid var(--app-border, #e2e8f0);
  backdrop-filter: blur(4px);
}

.app-page-toolbar__title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--app-text, #1f2d3d);
  line-height: 1.3;
  white-space: nowrap;
}

.app-page-toolbar__sub {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  font-weight: 500;
  color: var(--app-text-muted, #6c7a90);
}

.app-page-toolbar__main {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  flex: 1 1 auto;
  min-width: 0;
}

.app-page-toolbar__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.app-page-toolbar .pms-search,
.app-page-toolbar form.pms-search {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0;
  width: auto !important;
  flex: 1 1 auto;
  min-width: 0;
}

.app-page-toolbar .form-control,
.app-page-toolbar .custom-select,
.app-page-toolbar select.form-control {
  height: calc(1.5em + 0.5rem + 2px);
  padding: 0.25rem 0.5rem;
  font-size: 0.875rem;
}

.app-page-toolbar .btn {
  white-space: nowrap;
}

.app-page-toolbar .btn-primary,
.app-page-body .btn-primary {
  background-color: var(--app-accent, #214789);
  border-color: var(--app-accent, #214789);
}
.app-page-toolbar .btn-primary:hover,
.app-page-body .btn-primary:hover {
  background-color: var(--app-shell-nav-2, #1b3c72);
  border-color: var(--app-shell-nav-2, #1b3c72);
}

.app-page-body {
  padding: 12px 16px 0;
}

.app-page-panel {
  background: var(--app-surface, #fff);
  border: 1px solid var(--app-border, #e2e8f0);
  border-radius: 8px;
  overflow: visible;
}
.app-page-list .app-page-panel {
  /* sticky 페이징이 app-detail 스크롤에 붙도록 overflow 제한 해제 */
  overflow: visible;
}

.app-page-panel > .card,
.app-page-list .card,
.app-page-form .card {
  margin-bottom: 0;
  border: 0;
  box-shadow: none;
  background: transparent;
}

/* 공통 테이블 */
.app-page-list .table,
.app-page-body .table.app-page-table {
  margin-bottom: 0;
  background: #fff;
  table-layout: fixed;
  width: 100%;
}
.app-page-list .table thead th,
.app-page-body .table.app-page-table thead th,
.app-page-list .pms-thead th {
  background: var(--app-accent, #214789) !important;
  color: #fff !important;
  border-color: rgba(255, 255, 255, 0.12) !important;
  font-size: 13px;
  font-weight: 700;
  padding: 0.55rem 0.6rem;
  vertical-align: middle;
  white-space: nowrap;
}
.app-page-list .table td,
.app-page-body .table.app-page-table td {
  font-size: 13px;
  padding: 0.5rem 0.6rem;
  vertical-align: middle;
  border-color: #eef2f7;
}
/* 목록 텍스트 — 1줄 말줄임 (table-layout:fixed 전제) */
.app-page-table .cell-ellipsis,
.app-page-table .cell-ellipsis-2 {
  max-width: 0;
  width: 1%;
  overflow: hidden;
  vertical-align: middle;
  text-align: center;
}
.app-page-table .cell-ellipsis > span,
.app-page-table .cell-ellipsis-2 > span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  word-break: normal;
  max-width: 100%;
  text-align: center;
  margin: 0 auto;
}
.app-page-list tr[data-app-detail-url],
.app-page-list tr[role="button"][data-app-detail-url] {
  cursor: pointer;
}
.app-page-list tr[data-app-detail-url]:hover,
.app-page-list tr[role="button"][data-app-detail-url]:hover {
  background: var(--app-row-hover, #eef3fa) !important;
}
.app-page-list tr[data-app-detail-url]:focus {
  outline: 2px solid rgba(33, 71, 137, 0.35);
  outline-offset: -2px;
}

.app-page-empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--app-text-muted, #6c7a90);
  font-size: 14px;
}
.app-page-empty .btn {
  margin-top: 12px;
}

/* 폼 패턴 */
.app-page-form .app-page-toolbar {
  border-bottom-color: var(--app-border, #e2e8f0);
}
.app-page-form .app-page-body {
  max-width: 920px;
}
.app-page-form .form-group label {
  font-weight: 600;
  font-size: 13px;
  color: var(--app-text, #1f2d3d);
}
.app-page-form .card-header {
  display: none;
}

/* 구형 content-header / breadcrumb — 공통 패턴 화면에서는 숨김 가능 */
.app-page-list > .content-header,
.app-page-form > .content-header,
.app-page-list .content-header.d-none-app,
.app-page-form .content-header.d-none-app {
  display: none !important;
}

body.app-shell-on .app-page-list .content-wrapper,
body.app-shell-on .app-page-form .content-wrapper {
  background: transparent;
  padding: 0;
  margin: 0;
}

/* -------------------------------------------------------------------------
   상세·폼 섹션 유틸 (신규 화면은 app-page 패턴만 사용)
   ------------------------------------------------------------------------- */
.app-page-section {
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--app-border, #e2e8f0);
}
.app-page-section:last-child {
  border-bottom: 0;
  margin-bottom: 0;
  padding-bottom: 0;
}
.app-page-section__title {
  margin: 0 0 0.65rem;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--app-text, #1f2d3d);
}
.app-page-field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem 1rem;
}
.app-page-field-grid .form-group {
  margin-bottom: 0;
}
.app-page-field-grid .app-page-field-wide {
  grid-column: 1 / -1;
}
@media (max-width: 767.98px) {
  .app-page-field-grid {
    grid-template-columns: 1fr;
  }
}
.app-page-form .app-page-panel {
  padding: 1rem 1.1rem;
}
.app-page-form .form-control,
.app-page-form .custom-select {
  font-size: 0.9rem;
}
.app-page-pagination {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 0;
  padding: 12px 16px 14px;
  border-top: 1px solid var(--app-border, #e2e8f0);
  background: #f1f5f9;
}
.app-page-pagination .pagination {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none !important;
}
.app-page-pagination .pagination > .page-item {
  display: inline-flex;
  list-style: none !important;
  margin: 0;
}
.app-page-pagination .page-link {
  min-width: 2.1rem;
  min-height: 2rem;
  padding: 0.3rem 0.65rem;
  font-size: 0.875rem;
  line-height: 1.25;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #1e293b;
  border: 1px solid #94a3b8;
  border-radius: 4px;
  background: #fff;
  text-decoration: none;
}
.app-page-pagination .page-item + .page-item {
  margin-left: 0;
}
.app-page-pagination .page-item.active .page-link {
  background-color: var(--app-accent, #214789);
  border-color: var(--app-accent, #214789);
  color: #fff;
  font-weight: 600;
}
.app-page-pagination .page-item.disabled .page-link {
  color: #94a3b8;
  background: #f8fafc;
  pointer-events: none;
}
.app-page-list .app-page-panel > .card-body,
.app-page-list .app-page-panel > .table-responsive {
  padding: 0;
}
.app-page-list .app-page-panel .table {
  margin-bottom: 0;
}

/* -------------------------------------------------------------------------
   매출/매입 공통 — 요약 카드 + 모달
   ------------------------------------------------------------------------- */
.estimate-pane-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.estimate-empty-cta {
  text-align: center;
  padding: 28px 16px;
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  background: #f8fafc;
}
.estimate-empty-title {
  font-weight: 700;
  color: #334155;
  margin-bottom: 4px;
}
.estimate-empty-desc {
  font-size: 13px;
  color: #64748b;
  margin-bottom: 12px;
}

.pv-card-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.pv-card {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.pv-card:hover,
.pv-card:focus {
  border-color: #93c5fd;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
  outline: none;
}
.pv-card-main {
  min-width: 0;
  flex: 1 1 auto;
}
.pv-card-title {
  font-size: 0.98rem;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 6px;
  word-break: break-word;
}
.pv-card-title + .pv-card-tasks {
  margin-top: -2px;
}
.pv-card-tasks {
  font-size: 12.5px;
  font-weight: 600;
  color: #334155;
  margin-bottom: 6px;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}
.pv-card-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  font-size: 12px;
  color: #64748b;
}
.pv-card-aside {
  flex: 0 0 auto;
  text-align: right;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: flex-end;
  gap: 8px;
}
.pv-card-amount {
  font-size: 1.05rem;
  font-weight: 700;
  color: #b45309;
  white-space: nowrap;
}
.pv-card-amount small {
  font-size: 11px;
  font-weight: 600;
  margin-left: 2px;
  color: #92400e;
}
.pv-card-actions {
  cursor: default;
}

.estimate-modal-meta {
  margin-bottom: 4px;
}
.estimate-modal-section {
  margin-top: 10px;
}
.estimate-modal-section-title {
  font-size: 13px;
  font-weight: 700;
  color: #334155;
  margin-bottom: 6px;
}
.estimate-modal-contract {
  padding-top: 10px;
  border-top: 1px solid #e8eef6;
}

#purchaseVendorModal.pv-modal-view #pv_vendor_display,
#purchaseVendorModal.pv-modal-view #pv_order_date,
#purchaseVendorModal.pv-modal-view #pv_memo,
#salesEstimateModal.se-modal-view #se_customer_display,
#salesEstimateModal.se-modal-view #se_sales_date,
#salesEstimateModal.se-modal-view #se_sales_memo {
  background-color: #f8fafc;
  color: #334155;
}

.sales-estimate-summary .pv-card-amount {
  color: #1d4ed8;
}
.sales-estimate-summary .pv-card-amount small {
  color: #1e40af;
}

/* 수행원 검색: 키보드 포커스 후보 */
#memberSearchResults .list-group-item.member-search-focus {
  outline: 2px solid #3b82f6;
  outline-offset: -2px;
  z-index: 1;
}
#memberSearchResults .list-group-item.member-search-focus:not(.active) {
  background-color: #eff6ff;
}




