:root{
  --eco-brand:#7fb21d;
  --eco-brand-dark:#5f8f11;
  --ink:#111827;
  --muted:#6b7280;
  --line:#e5e7eb;
  --line2:#f1f5f9;
  --bg:#fff;
  --radius:12px;
}

.order-view{
  max-width:1100px;
  margin:0 auto;
  padding:22px 18px 70px;
}

.ov-topbar{
  display:flex;
  align-items:center;
  justify-content:flex-end;
  margin-bottom:10px;
}

.btn{
  height:38px;
  padding:0 16px;
  border-radius:10px;
  border:1px solid #d1d5db;
  background:#fff;
  cursor:pointer;
  transition:.15s ease;
  font-weight:800;
}
.btn:hover{ background:#f3f4f6; }

.btn--print{
  border:none;
  background:#0a7a3a;
  color:#fff;
  border-radius:10px;
  height:40px;
  padding:0 18px;
}
.btn--print:hover{ background:var(--eco-brand-dark); }

.section{
  margin-top:18px;
}

.section-title{
  display:flex;
  align-items:center;
  gap:10px;
  font-weight:700;
  font-size:16px;
  padding:14px 0 10px;
  margin-bottom:0px;
}

.table-wrap{
  border-top:1px solid #111;
}

.table{
  width:100%;
  border-collapse:collapse;
  table-layout:fixed;
}

.table th{
  font-size:13px;
  font-weight:700;
  padding:12px 10px;
  border-bottom:1px solid var(--line);
  color:#111;
  background:#f3f4f6;
}
.table td{
  padding:14px 10px;
  border-bottom:1px solid var(--line);
  font-size:14px;
  vertical-align:middle;
}

.col-no{width:60px;text-align:center}
.col-prod{width:auto}
.col-spec{width:100px;text-align:center}
.col-qty{width:100px;text-align:center}
.col-price{width:120px;text-align:right}
.col-sum{width:130px;text-align:right}

.prod{
  display:flex;
  align-items:center;
  gap:10px;
  min-width:0;
}
.prod img{
  width:34px;height:34px;
  object-fit:cover;
  border-radius:6px;
  border:1px solid var(--line);
  background:#fff;
  flex:0 0 auto;
}
.prod .pname{
  font-weight:700;
  color:#111;
  line-height:1.35;
  word-break:break-word;
}

.num{
  font-variant-numeric: tabular-nums;
  font-weight:900;
  color:#374151;
}
.total-row td{
  border-bottom:none;
  padding:16px 10px;
}
.total-label{
  text-align:right;
  font-weight:900;
  color:#b91c1c;
}
.total-value{
  text-align:right;
  font-weight:900;
  color:#b91c1c;
}

/* 배송지정보 표 */
.info{
  width:100%;
  border-collapse:collapse;
  margin-top:8px;
  border:1px solid var(--line);
}
.info th{
  width:170px;
  text-align:left;
  border-bottom:1px solid var(--line);
  border-right:1px solid var(--line);
  font-weight:900;
  color:#111;
  background:#f8fafc;
}
.info td{
  border-bottom:1px solid var(--line);
  border-right:1px solid var(--line);
  color:#111;
  word-break:break-word;
}

.info th,.info td{ padding:8px 10px; }
.info td:last-child{
  border-right:none;
}

.ov-bottom{
  margin-top:28px;
  display:flex;
  justify-content:center;
}
.btn--list{
  height:44px;
  min-width:120px;
  border-radius:12px;
  background:#111;
  color:#fff;
  border:1px solid #111;
}
.btn--list:hover{ background:#0a7a3a; }

.btn--receipt{
  height:34px;
  padding:0 14px;
  border-radius:8px;
  border:1px solid #0a7a3a;
  background:#fff;
  color:#0a7a3a;
  font-weight:600;
}
.btn--receipt:hover{
  background:#0a7a3a;
  color:#fff;
}

/* =========================
    인쇄 스타일
   ========================= */
@media print {
  /* 버튼과 네비게이션 숨기기 */
  .ov-topbar, 
  .ov-bottom,
  .btn--receipt { 
    display: none !important; 
  }
  
  /* print_area가 아닌 모든 요소 숨기기 */
  body * {
    visibility: hidden;
  }
  
  /* print_area와 그 하위 요소만 표시 */
  #print_area,
  #print_area * {
    visibility: visible;
  }
  
  /* print_area를 페이지 상단으로 이동 */
  #print_area {
    position: absolute;
    left: 0;
    top: 0px;
    width: 100%;
  }
  
  /* 인쇄 상단 헤더 추가 */
  #print_area::before {
    content: "주문내역서 - (사)부산울산경남생태유아공동체";
    display: block;
    text-align: center;
    font-size: 20px;
    font-weight: 700;
    padding: 20px 0;
    margin-bottom: 10px;
  
  }
  
  .order-view { 
    padding: 0; 
    max-width: none; 
  }
  
  a { 
    text-decoration: none; 
    color: #000; 
  }
  
  .section-title{
    
    margin-top: 15px;
  }
  
  /* 상품 이미지 숨김 */
  .prod img {
    display: none !important;
  }
  
  /* 상품명 왼쪽 정렬 */
  .prod {
    justify-content: flex-start;
  }
  
  .prod .pname {
    text-align: left;
  }
  
  /* 테이블 스타일 강제 유지 */
  .table-wrap{
    border-top: 1px solid #111 !important;
    background: none !important;
    border-radius: 0 !important;
  }
  
  .table {
    table-layout: fixed !important;
    border-collapse: collapse !important;
  }
  
  .table thead {
    display: table-header-group !important;
  }
  
  .table tbody {
    display: table-row-group !important;
  }
  
  .table tbody tr {
    display: table-row !important;
    background: none !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    transform: none !important;
    grid-template-columns: none !important;
    gap: 0 !important;
  }
  
  .table tbody td {
    display: table-cell !important;
    border-bottom: 1px solid #e5e7eb !important;
    padding: 8px 10px !important;
    margin: 0 !important;
  }
  
  .table tbody td:nth-child(2){
    grid-column: auto !important;
    padding-bottom: 8px !important;
    border-bottom: 1px solid #e5e7eb !important;
    margin-bottom: 0 !important;
  }
  
  /* 모바일 스타일 강제 해제 */
  .table tbody td::before {
    content: none !important;
    display: none !important;
  }
  
  .total-row {
    display: table-row !important;
    background: #f3f4f6 !important;
    border: none !important;
    margin: 0 !important;
    padding: 0 !important;
  }
  
  .total-row td {
    display: table-cell !important;
    padding: 12px 10px !important;
  }
  
  /* 배송지 정보 테이블 강제 유지 */
  .info {
    border: 1px solid #e5e7eb !important;
    border-collapse: collapse !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    display: table !important;
  }
  
  .info tbody {
    display: table-row-group !important;
  }
  
  .info tr {
    display: table-row !important;
    border-bottom: 1px solid #e5e7eb !important;
  }
  
  .info th,
  .info td {
    display: table-cell !important;
    width: auto !important;
    padding: 8px 10px !important;
    border-right: 1px solid #e5e7eb !important;
    border-bottom: 1px solid #e5e7eb !important;
    margin: 0 !important;
    font-size: 13px !important;
    text-transform: none !important;
    letter-spacing: normal !important;
  }
  
  .info th {
    background: #f8fafc !important;
    font-weight: 700 !important;
    color: #111 !important;
  }
  
  .info td {
    color: #111 !important;
    font-weight: normal !important;
  }
  
  .info td:last-child {
    border-right: none !important;
  }
  
  .section {
    page-break-inside: avoid;
  }
}

@media print {
  @page { 
    margin: 0.5cm 1.6cm; 
  }
}

/* =========================
   영수증 모달
   ========================= */
.modal-overlay{
  display:none;
  position:fixed;
  inset:0;
  background:rgba(0,0,0,.6);
  z-index:9999;
  align-items:center;
  justify-content:center;
}

.modal-box{
  width:90%;
  max-width:600px;
  height:90vh;
  background:#fff;
  border-radius:14px;
  overflow:hidden;
  display:flex;
  flex-direction:column;
}

.modal-header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:12px 16px;
  background:#111;
  color:#fff;
  font-weight:900;
}

.modal-close{
  background:none;
  border:none;
  color:#fff;
  font-size:26px;
  cursor:pointer;
}

#receiptFrame{
  width:100%;
  height:100%;
  border:none;
}

/* 모바일에서 더 크게 */
@media screen and (max-width:600px) {
  .modal-box{
    width:100%;
    height:100vh;
    border-radius:0;
  }
}

/* =========================
   모바일: 가로 스크롤 없이 2~3줄 접힘
   ========================= */
/* =========================
   모바일 개선: 카드형 더 깔끔 + 금액 강조
   ========================= */
@media screen and (max-width:860px) {
  .order-view{ padding:16px 12px 64px; }

  /* 상단 버튼 영역 */
  .ov-topbar{
    position: sticky;
    top: 0;
    z-index: 10;
    padding: 10px 0 12px;
    background: linear-gradient(to bottom, rgba(255,255,255,1), rgba(255,255,255,0.92));
    backdrop-filter: blur(6px);
  }
  .btn--print{
    width:100%;
    height:48px;
    border-radius:14px;
    font-size:15px;
    font-weight:900;
    letter-spacing:-0.2px;
    box-shadow: 0 6px 16px rgba(10,122,58,0.18);
  }

  /* 테이블 래퍼 */
  .table-wrap{
    border-top:none;
    background:transparent;
    border-radius:0;
    overflow:visible;
  }

  /* 헤더 숨김 */
  .table thead{ display:none; }

  /* 카드 행 */
  .table tbody tr{
    display:block;
    background:#fff;
    border:1px solid rgba(229,231,235,0.95);
    border-radius:16px;
    padding:14px 14px 12px;
    margin:12px 0;
    box-shadow: 0 6px 22px rgba(17,24,39,0.06);
    cursor:pointer;
    transition: transform .12s ease, box-shadow .12s ease;
  }

  /* 모바일 탭 피드백 */
  .table tbody tr:active{
    transform: scale(0.995);
    box-shadow: 0 4px 16px rgba(17,24,39,0.08);
  }

  /* 기본 td 정리 */
  .table tbody td{
    display:block;
    border-bottom:none;
    padding:0;
    min-width:0;
  }
  .table tbody td:nth-child(1){ display:none; } /* 번호 숨김 */

  /* 상품 영역 */
  .table tbody td:nth-child(2){
    padding-bottom:12px;
  
    border-bottom:1px solid #f1f5f9;
  }
  .prod{
    gap:12px;
    align-items:flex-start;
  }
  .prod img{
    width:56px;
    height:56px;
    border-radius:14px;
    border:1px solid rgba(229,231,235,0.9);
    box-shadow: 0 6px 16px rgba(0,0,0,0.08);
    background:#fff;
    flex:0 0 auto;
  }
  .prod .pname{
    font-size:15px;
    line-height:1.35;
    letter-spacing:-0.2px;
    font-weight:900;
    color:#111;
    margin-top:2px;
  }

  /* 2열 그리드 (규격/수량/단가/총액) */
  .table tbody td:nth-child(3),
  .table tbody td:nth-child(4),
  .table tbody td:nth-child(5),
  .table tbody td:nth-child(6){
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:10px;
    padding:10px 2px;
    border-bottom:1px dashed #eef2f7;
    font-size:14px;
    font-weight:800;
    color:#111;
  }
  .table tbody td:nth-child(6){
    border-bottom:none;
    padding-bottom:2px;
  }

  /* 라벨(좌) / 값(우) 구조로 변경 */
  .table tbody td:nth-child(3)::before{ content:"규격"; }
  .table tbody td:nth-child(4)::before{ content:"공급수량"; }
  .table tbody td:nth-child(5)::before{ content:"판매금액"; }
  .table tbody td:nth-child(6)::before{ content:"총금액"; }

  .table tbody td:nth-child(3)::before,
  .table tbody td:nth-child(4)::before,
  .table tbody td:nth-child(5)::before,
  .table tbody td:nth-child(6)::before{
    display:inline-block;
    font-size:12px;
    font-weight:700;
    color:#6b7280;
    letter-spacing:-0.1px;
    margin:0;
  }

  /* 값(우측) 더 강조 */
  .table tbody td:nth-child(5) .num,
  .table tbody td:nth-child(6) .num{
    font-weight:900;
    font-variant-numeric: tabular-nums;
  }

  /* 총금액만 배지처럼 강조 */
  .table tbody td:nth-child(6) .num{
    display:inline-flex;
    align-items:center;
    padding:6px 10px;
    border-radius:999px;
    background:#ecfdf5;
    border:1px solid rgba(10,122,58,0.22);
    color:#0a7a3a;
  }

  /* 합계(총주문금액) 카드 */
  .total-row{
    display:block !important;
    background: linear-gradient(180deg, #fff7ed, #fff);
    border:1px solid #fed7aa !important;
    border-radius:16px;
    overflow:hidden;
    margin:14px 0 0 !important;
    box-shadow: 0 8px 22px rgba(124,45,18,0.08);
  }
  .total-row td{
    display:block;
    padding:16px 14px !important;
    border:none !important;
  }
  .total-label{
    text-align:left;
    font-size:13px;
    font-weight:900;
    color:#9a3412;
    margin-bottom:6px;
  }
  .total-value{
    text-align:left;
    font-size:24px;
    font-weight:900;
    color:#9a3412;
    letter-spacing:-0.5px;
  }

  /* 섹션 타이틀 */
  .section-title{
    font-size:16px;
    padding:16px 2px 10px;
    font-weight:900;
    letter-spacing:-0.2px;
  }

  /* 배송지/결제 정보: 완전 카드형 */
  .info{
    border:none;
    border-radius:16px;
    overflow:hidden;
    box-shadow: 0 8px 22px rgba(17,24,39,0.06);
    background:#fff;
  }
  .info, .info tbody, .info tr{ display:block; }
  .info tr{
    padding:12px 14px;
    border-bottom:1px solid #f1f5f9;
  }
  .info tr:last-child{ border-bottom:none; }
  .info th, .info td{
    display:block;
    width:100%;
    border:none;
    padding:0 !important;
  }
  .info th{
    font-size:12px;
    font-weight:800;
    color:#6b7280;
    letter-spacing:-0.1px;
    text-transform:none;
    background:transparent;
    margin-bottom:6px;
  }
  .info td{
    font-size:15px;
    font-weight:900;
    color:#111;
    line-height:1.35;
  }

  /* 영수증 버튼 모바일 */
  .btn--receipt{
    width:100%;
    height:42px;
    border-radius:12px;
    font-weight:900;
  }

  /* 목록 버튼 */
  .ov-bottom{
    position: sticky;
    bottom: 0;
    z-index: 10;
    padding: 10px 0 12px;
    background: linear-gradient(to top, rgba(255,255,255,1), rgba(255,255,255,0.92));
    backdrop-filter: blur(6px);
  }
  .btn--list{
    width:100%;
    height:52px;
    border-radius:16px;
    font-size:16px;
    font-weight:900;
    box-shadow: 0 10px 24px rgba(17,24,39,0.14);
  }
}

/* 아주 작은 화면 */
@media screen and (max-width:420px){
  .prod img{ width:52px; height:52px; }
  .prod .pname{ font-size:14px; }
}


/* 아주 작은 화면에서 글씨/간격 약간 줄임 */
@media screen and (max-width:420px) {
  .prod .pname{ font-size:14px; }
}
