.orders-table td,
.cell-center {text-align: center;}
.cell-center input[type="checkbox"] {
    width: 18px;
    height: 18px;
    border-radius: 100px;
    accent-color: var(--primary-orange);
}
.orders-wrap.editing td:nth-child(3) {
    width: initial;
}
.section_wrap {
    display: flex;
    flex-direction: row;
    gap: 20px;
}
.section02 {
    width: 100%;
    margin: 0 auto;
}
#pageDateH1::after {
    content: "▾";
    font-size: .8em;
    color: #6b7280;
}
#pageDateH1 {
    margin: 0;
    font-weight: 800;
    font-size: 28px;
    font-weight: 900;
    line-height: 1.2;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}
#dateStart {
    position: absolute;
    top: 40px;
    left: 0 ;
    font-size: 0;
}
#dateEnd {
    position: absolute;
    top: 40px;
    left: 180px ;
    font-size: 0;
}
input[name="date"] {
    padding-left: 20px;
}
input[name="manager"] {
  width: 100%;
  height: 34px;
  border-radius: 8px;
  padding: 0 10px;
  outline: none;
  font-size: 14px;
  font-weight: 500;
  text-align: center;
}
textarea[name="memo"] {
    width: 100%;
}
/* 행 - 체크버튼 누른시간 */
.check-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.stamp {
  font-size: 11px;
  color: #888;
  margin-top: 4px;
  line-height: 1.2;
}
/* ------------------- 필터 css --------------- */
.orders-filter{
    display:flex;
    align-items:center;
    gap:10px 14px;
    padding:10px 12px;
    border:1px solid #e5e7eb;
    border-radius:12px;
    background:#fff;
}
.orders-filter label,
.orders-filter fieldset,
.orders-filter select,
.orders-filter button{
    font-size:14px;
}
.orders-filter select{
    padding:6px 10px;
    border:1px solid #e5e7eb;
    border-radius:8px;
    background:#fff;
}
.orders-filter fieldset#weekdayFilter{
    display:flex;
    gap:6px;
    align-items:center;
    border:none;
    margin:0;
    padding:0;
}
.orders-filter fieldset#weekdayFilter > label{
    display:inline-flex;
    gap:4px;
    align-items:center;
    padding:4px 8px;
    border:1px solid #e5e7eb;
    border-radius:999px;
    background:#f9fafb;
    cursor:pointer;
}
.orders-filter fieldset#weekdayFilter input[type="checkbox"]{
    accent-color:#2563eb;
}
.orders-filter #missingOnly + span,
.orders-filter label[for="missingOnly"]{
    cursor:pointer;
}
.orders-filter #filterClear{
    padding: 6px 14px;
    height: 40px;
    font-size: 14px;
    font-weight: 500;
    color: #374151;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
}
.orders-filter .filter-badge{
    margin-left:auto;
    background:#fff6ee;
    color: var(--primary-orange);
    border:1px solid #ffcda1;
    padding:4px 10px;
    border-radius:999px;
    font-weight:700;
}
#missingOnly[type="checkbox"] {
    width: 18px;
    height: 18px;
    border-radius: 100px;
    accent-color: var(--primary-orange);
}
/* 활성화 시 테두리 강조 */
.orders-filter.active{
  border-color: #FF511770;
  box-shadow:0 0 0 3px #fff6ee;
}
.orders-filter label {
    user-select: none;
    -webkit-user-select: none; 
}
.orders-filter input,
.orders-filter select,
.orders-filter button {
    cursor: pointer;
}
.orders-filter {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
}
.date-sort {
    color: #374151;
    font-weight: 600;
    display: flex;
    text-align: center;
    justify-content: center;
    align-items: center;
    gap: 8px;
}
/* ------------------- 필터 css end --------------- */
/****** section02 ******/
.settle-summary {
    display: flex;
    gap: 20px;
    padding-right: 10px;
}
/* ====== 정산서 편집 오버레이 ====== */
#settleOverlay[hidden] { display:none; }
#settleOverlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

#settleOverlay .sheet {
    border-radius: 20px;
    width: min(1400px, 96vw);
    max-height: 92vh;
    background: #fff;
    overflow: auto;
    box-shadow: 0 20px 50px rgba(0,0,0,.25);
    display: flex;
    flex-direction: column;
}
#settleOverlay .sheet header {
    position: sticky; 
    top: 0;
    display: flex; 
    gap: 12px; 
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid #eee;
    background:#fff;
}
#settleOverlay .sheet header .title {
    font-weight: 800; 
    font-size: 20px;
}
#settleOverlay .sheet header .sub {
    color:#6b7280; font-size: 13px; margin-left: 8px;
}
#settleOverlay .sheet header .actions { display:flex; gap:8px; }
#settleOverlay .close-btn{
    appearance:none; 
    border:0; 
    display: flex;
    align-items: center;
    color: #111;
    padding: 5px 5px; 
    border-radius: 100px; 
    cursor:pointer; 
    font-weight: 400;
    transition: all 0.3s ease;
}
#settleOverlay .close-btn:hover {
    background:#111; 
    color:#fff;
}
#settleOverlay .close-btn:focus-visible{ 
    outline: 3px solid #1113; 
    outline-offset: 3px; 
}

/* 시트 안에 기존 .page(에디터+프리뷰) 들어감 */
#settleOverlay .sheet .page { margin:0; padding:16px; }
@media (max-width: 960px){
  #settleOverlay { padding: 8px; }
  #settleOverlay .sheet { width: 100%; max-height: 100vh; border-radius: 0; }
  #settleOverlay .sheet .page { padding: 12px; }
}

/* 프리뷰 A4 축소(이미 쓰고 있던 규칙 B안) */
.card.preview .preview-wrap{ width: calc(210mm * var(--scale)); }
.card.preview .preview-wrap .invoice{
  width: 210mm; height: 297mm; transform: scale(var(--scale)); transform-origin: top left;
}
/****** section02 end ******/
/****** section03 ******/
.section03 {margin-top: initial;}
.section02, 
.section03,
.section03 .page,
.card, 
.make_invoice, 
.early_view,
.preview, 
.preview-pane, 
.preview-wrap {
  min-width:0 !important;
}

.section03 .page {
  display: inline-flex !important;
  gap: 20px !important;
  flex-wrap: nowrap !important;
  justify-content: center;
  width: 100%;
}
.preview-wrap {
    transform: none !important;
}
.invoice {
    margin-left: auto;
    padding: 20px;
}
.table, 
.orders-table, 
.settlement-table{
  max-width: 100%;
}
.preview-pane{ overflow:auto; }
/* 결제방법 */
.pay-cell .paywrap{
    display:inline-flex;
    gap:6px;
    align-items:center;
    flex-wrap:wrap;
    justify-content:center;
}
.pay-cell .pill{
  display:inline-block; padding:4px 8px; border-radius:999px;
  background:#f3f4f6; color:#374151; font-weight:700; font-size:12px; line-height:1;
}
.pay-cell .pill:nth-child(1){ background:var(--label-bg); color: var(--label-text); }
.pay-cell .pill:nth-child(2){ background:var(--label-bg02); color: var(--label-text02);  }
/****** section03 end ******/
.page {
    display: flex;
    justify-content: flex-start;
    gap: 20px;
    overflow: auto;
}
.page::-webkit-scrollbar {
    width: 8px;
}
.page::-webkit-scrollbar-track {
    background: transparent;
}
.page::-webkit-scrollbar-thumb {
    background-color: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
}
@media (max-width: 1024px){ .page{grid-template-columns: 1fr} }

.card{
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow:0 8px 30px rgba(2,6,23,.06)
}
.card .card-head{
    padding: 20px 20px 10px 20px;
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    gap: 8px;
}
.card-head .title{
    font-weight: 700;
    font-size: 18px;
    color: var(--primary-orange);
    margin-left: 10px;
}
.form {
    padding: 20px;
    height: auto;
}
.form .row{
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: 8px 10px;
    margin-bottom: 10px;
}
.form .row label{
    color:var(--muted);
    font-weight: 600;
    padding-top: 7px;
}
.form input[type="text"],
.form input[type="tel"],
.form input[type="date"],
.form input[type="number"],
.form textarea,
.form select,
input.priceDisplay {
  width: 100%;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background:#fff;
  font: inherit;
}
input[name="company"],
input.priceDisplay {
    text-align: center;
    font-size: 16px;
    font-weight: 600;
}
.form textarea{
    min-height:64px;
    resize: vertical;
}
.form .inline{
    display: flex;
    gap: 8px;
    align-items: center;
}
.form small{color:var(--muted)}

.toolbar {
    display: flex;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 80px;
}
.toolbar .btn{
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 40px;
    border-radius: 100px;
    border: 1px solid var(--line-normal);
    background:#fff;
    cursor: pointer;
    box-shadow: initial;
}
.toolbar .btn.primary{
    background:var(--primary-orange);
    border-color:var(--primary-orange);
    color:#fff;
}
.toolbar .btn.ghost{background:#fff;}
.danger{
    color: var(--red);
    box-shadow: initial;
    border: 1px solid var(--line-normal);
    transition: all 0.3s;
}
.danger:hover {
    background-color: var(--red);
    color: white;
    border: 1px solid var(--red);
}
.toolbar .btn {
    display: flex;
    justify-content: center;
}
.table{
    width: 100%;
    border-collapse: collapse;
    border: 1px solid var(--line);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 20px;
}
.table th,.table td{
    border-top: 1px solid var(--line);
    padding: 6px 10px;
    text-align: left;
    background:#fff;
}
.table th{
    background:#f3f4f6;
    font-weight: 700;
}
/* Chrome, Safari, Edge (Webkit) */
.table input[type="number"]::-webkit-inner-spin-button,
.table input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
/* Firefox */
.table input[type="number"] {
    -moz-appearance: textfield;
}
.table input[type="number"]{text-align:left}
.table .center{text-align:center}
.table tfoot td{background:#fafafa;font-weight:700}
.preview-pane{
    padding: 20px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

.preview-wrap{
    width: 100%;
    display: flex;
    justify-content: center;
}
.invoice {
    width: 210mm;
    min-height: 297mm;
    background:#fff;
    border: 1px solid var(--line);
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.invoice-title {
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 50px;
    padding: 24px 0 0 24px;
}
.invoice-title .invoice_month {
    font-size: 22px;
    font-weight: 800;
}
.invoice-title .for_name {
    font-size: 18px;
    font-weight: 700;
    margin: 4px 0;
}
.invoice-title .ext {
    color: var(--muted);
    font-size: 14px;
    margin-top: 4px;
}
.invoice-head {
    display: flex;
    gap: 24px;
    align-items: flex-start;
}
.invoice-head ul {
    list-style: none;
    margin: 0;
    padding: 0;
}
.invoice-head li p {
    display: grid;
    grid-template-columns: 72px 1fr;
    gap: 6px;
    margin: 6px 0;
}
.invoice-body {
    border-top: 2px solid #1f2937;
}
.inv_body_tit,
.inv_body_con {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1fr 1fr 1fr;
    gap: 0;
    border-bottom: 1px solid var(--line);
}
.inv_body_tit li,.inv_body_con li{padding:10px 8px}
.inv_body_tit{background:#f9fafb;font-weight:700}
.inv_body_con:nth-child(even){background:#fcfcfd}

.invoice_footer {
    display: flex;
    gap: 24px;
    justify-content: space-between;
    padding: 16px 24px 24px;
    border-top: 2px solid #1f2937;
}
.invoice_footer .memo {flex:1;}
.invoice_footer .meomo_tit{
    font-weight: 700;
    margin-bottom: 6px;
}
.invoice_footer .summary{min-width:280px;}
.invoice_footer .summary ul{
    display: grid;
    grid-template-columns: 1fr 1fr;
}
.invoice_footer .summary ul:not(.total){
    border-bottom: 1px dashed var(--line);
    line-height: 200%;
}
.invoice_footer .summary .total {
    font-size: 2.4rem;
    font-weight: 700;
    margin-top: 20px;
    align-items: center;
}

.invoice_download{
    padding: 10px 24px;
    display: flex;
    justify-content: flex-end;
}
.loader_btn.download {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 10px 40px;
    border-radius: 100px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
}

.invoice-modal{
    background:#fff;
    border-radius: 16px;
    max-width: 980px;
    width: 100%;
    max-height: 95vh;
    overflow: auto;
    border: 1px solid var(--line);
}
.page_move{
    display: flex;
    justify-content: center;
    gap: 8px;
    padding: 10px;
}

.helper{
    display: flex;
    justify-content: center;
    padding: 20px;
    color: var(--muted);
    font-size: 12px;
}
.right{
    justify-content: center;
}
.krw{font-variant-numeric: tabular-nums;}
.total-box{
    display: flex;
    gap: 10px;
    align-items: center;
}

/* 인쇄 시 .invoice(#canvas)만 보이게 */
@media print {
  @page { size: A4; margin: 0; }
  body * { visibility: hidden; }
  *, body, html {
    font-size-adjust: none !important;
    -webkit-text-size-adjust: none !important;
    text-size-adjust: none !important;
  }
  #canvas, #canvas * { visibility: visible; }
  #canvas {
    position: absolute;
    inset: 0;
    width: 210mm;
    height: 297mm;
    padding: 10mm 10mm;
    box-sizing: border-box;
    overflow: hidden !important;
    background: #fff;
  }
  .invoice {
    transform: scale(1.3) translateX(-7%) translateY(10%);
    transform-origin: top right;
    border: 1px solid #ccc;
  }
  .invoice {
    background-color: white;
    border: none !important;
    border-radius: 0 !important;
  }
  /* 인쇄 불필요 UI 숨김 */
  .invoice_download, .page_move, .invoice-actions { display: none !important; }
}
/* === 인쇄 컬러 보존 강제 === */
@media print {
  html, body {
    -webkit-print-color-adjust: exact !important; /* Chrome/Safari */
            print-color-adjust: exact !important; /* 표준화 진행 중 */
    color-adjust: exact !important;               /* 구버전 대응 */
  }

  #canvas,
  #canvas * {
    -webkit-print-color-adjust: exact !important;
            print-color-adjust: exact !important;
  }

  .invoice,
  .inv_body_tit,
  .inv_body_con:nth-child(even),
  .invoice_footer .summary ul:not(.total) {
    background: #ffffff !important;
  }
  .inv_body_tit { background: #f3f4f6 !important; }
  .inv_body_con:nth-child(even){ background:#fcfcfd !important; }

  .invoice,
  .invoice * {
    box-shadow: none !important;
    border-color: #1f2937 !important;
  }

  svg path { fill: #111111 !important; stroke: #111111 !important; }
}
.amount-edit-wrap{ 
    display:flex; 
    flex-direction: column;
    gap:6px; 
    justify-content:flex-end; 
    align-items:center; 
}
.i-amount-input{ width:120px; text-align:right; padding:4px 8px; box-sizing:border-box; }
.amount-cell.modified{ background:#fff7ed; } /* 수정됨 시 강조 */
.badge-mod{
  display:inline-block; padding:2px 6px; font-size:11px;
  background:#f59e0b; color:#fff; border-radius:6px; line-height:1; 
}
/* === A4 고정 프리뷰 박스 === */
.a4-pages{
  display:flex; flex-direction:column; gap:20px; align-items:center;
}
.a4-page{
  width:1240px; /* 디자인 기준 폭(= 캡처 기준 폭) */
  height: calc(1240px * 1.41421356); /* A4 비율 */
  background:#fff; box-shadow:0 6px 24px rgba(0,0,0,.08);
  overflow:hidden; position:relative;
}

/* invoice를 A4 페이지 꽉 차게 레이아웃 */
.a4-page .invoice{ 
  width:100%; height:100%; 
  display:flex; flex-direction:column;
}

/* 본문은 가변 높이, 스크롤 없이(페이지네이션이 담당) */
.a4-page .invoice_header{ /* 타이틀 + 표 머리까지 포함 */
  flex:0 0 auto;
}
.a4-page .invoice-body{
  flex:1 1 auto; overflow:hidden;
}
.a4-page .invoice_footer{
  flex:0 0 auto;
}

/* 표 구조를 명확히: 타이틀 줄은 각 페이지마다 반복되고, 실제 행은 #p_items의 .inv_body_con */
.inv_body_tit{ margin:0; padding:0; }
.inv_body_con{ margin:0; padding:0; }


