@media screen {
  .delivery-history-table {
    width:100%;
    min-width:0;
    table-layout:fixed;
  }

  .delivery-history-table th:nth-child(1),
  .delivery-history-table td:nth-child(1) { width:18%; }
  .delivery-history-table th:nth-child(2),
  .delivery-history-table td:nth-child(2) { width:15%; text-align:center; }
  .delivery-history-table th:nth-child(3),
  .delivery-history-table td:nth-child(3) { width:13%; text-align:left; }
  .delivery-history-table th:nth-child(4),
  .delivery-history-table td:nth-child(4) { width:10%; text-align:right; }
  .delivery-history-table th:nth-child(5),
  .delivery-history-table td:nth-child(5) { width:14%; text-align:right; }
  .delivery-history-table th:nth-child(6),
  .delivery-history-table td:nth-child(6) { width:17%; text-align:right; }
  .delivery-history-table th:nth-child(7),
  .delivery-history-table td:nth-child(7) {
    width:13%;
    text-align:center;
    white-space:nowrap;
  }

  @media (max-width:720px) {
    .delivery-history-table th,
    .delivery-history-table td { padding-left:4px; padding-right:4px; font-size:13px; }
    .delivery-history-table th:nth-child(2),
    .delivery-history-table td:nth-child(2) { display:none; }
    .delivery-history-table th:nth-child(1),
    .delivery-history-table td:nth-child(1) { width:30%; white-space:nowrap; }
    .delivery-history-table th:nth-child(3),
    .delivery-history-table td:nth-child(3) { width:17%; overflow-wrap:anywhere; }
    .delivery-history-table th:nth-child(4),
    .delivery-history-table td:nth-child(4) { width:9%; }
    .delivery-history-table th:nth-child(5),
    .delivery-history-table td:nth-child(5) { width:19%; }
    .delivery-history-table th:nth-child(6),
    .delivery-history-table td:nth-child(6) { width:25%; }
    .delivery-history-table th:nth-child(7),
    .delivery-history-table td:nth-child(7) { width:48px; }
    .delivery-history-table .delivery-weekday { display:block; margin:2px 0 0; }
    .delivery-history-table tr.delivery-history-total th { white-space:normal; font-size:12px; }
  }

  .delivery-detail-modal {
    box-sizing:border-box;
    width:min(1040px,calc(100vw - 32px));
    max-width:1040px;
    max-height:calc(100dvh - 32px);
    overflow:auto;
  }

  .delivery-detail-meta {
    grid-template-columns:repeat(3,minmax(0,1fr)) !important;
    gap:8px;
    margin-bottom:12px;
  }

  .delivery-detail-meta > div {
    min-width:0;
    padding:11px 13px;
    border-radius:12px;
    background:var(--tds-grey-50,#f7f8fa);
  }

  .delivery-detail-meta small,
  .delivery-detail-route-summary small {
    display:block;
    color:var(--muted);
    font-size:11px;
    font-weight:750;
  }

  .delivery-detail-meta strong {
    display:block;
    margin-top:4px;
    overflow:hidden;
    color:var(--ink);
    font-size:14px;
    font-variant-numeric:tabular-nums;
    text-overflow:ellipsis;
    white-space:nowrap;
  }

  .delivery-detail-route-list {
    display:grid;
    gap:10px;
  }

  .delivery-detail-route-summary {
    display:grid;
    grid-template-columns:minmax(0,1.35fr) minmax(340px,.9fr);
    gap:12px;
    padding:13px;
    border:1px solid var(--line);
    border-radius:16px;
    background:#fff;
  }

  .delivery-detail-route-path {
    display:grid;
    grid-template-columns:38px minmax(0,1fr) 24px minmax(0,1fr);
    gap:10px;
    align-items:center;
    min-width:0;
  }

  .delivery-detail-route-number {
    display:grid;
    place-items:center;
    width:32px;
    height:32px;
    border-radius:11px;
    background:var(--tds-blue-50,#eaf3ff);
    color:var(--tds-blue-600,#1b64da);
    font-weight:850;
  }

  .delivery-detail-route-arrow {
    color:var(--tds-grey-400,#b0b8c1);
    font-size:18px;
    text-align:center;
  }

  .delivery-detail-point {
    min-width:0;
  }

  .delivery-detail-point strong,
  .delivery-detail-point span {
    display:block;
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
  }

  .delivery-detail-point strong {
    margin-top:3px;
    font-size:14px;
  }

  .delivery-detail-point span {
    margin-top:3px;
    color:var(--tds-grey-600,#6b7684);
    font-size:12px;
    font-variant-numeric:tabular-nums;
  }

  .delivery-detail-route-metrics {
    display:grid;
    grid-template-columns:repeat(3,minmax(0,1fr));
    overflow:hidden;
    border-radius:12px;
    background:var(--tds-grey-50,#f7f8fa);
  }

  .delivery-detail-route-metrics > div {
    min-width:0;
    padding:10px 12px;
    text-align:right;
  }

  .delivery-detail-route-metrics > div + div {
    border-left:1px solid var(--line);
  }

  .delivery-detail-route-metrics strong {
    display:block;
    margin-top:4px;
    overflow:hidden;
    font-size:13px;
    font-variant-numeric:tabular-nums;
    text-overflow:ellipsis;
    white-space:nowrap;
  }

  .delivery-detail-route-proof {
    grid-column:1/-1;
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:12px;
    padding:11px 12px;
    border:1px solid var(--line);
    border-radius:12px;
    background:var(--tds-grey-50,#f7f8fa);
  }

  .delivery-detail-route-proof strong {
    display:block;
    margin-top:3px;
    font-size:13px;
  }

  .delivery-detail-route-proof.has-photo {
    border-color:var(--tds-blue-100,#c2dcff);
    background:var(--tds-blue-50,#e8f2ff);
  }

  .delivery-detail-route-proof.has-photo strong { color:var(--tds-blue-700,#003ea8); }

  .delivery-detail-photo-button {
    display:inline-flex;
    align-items:center;
    justify-content:center;
    gap:7px;
    width:auto;
    min-width:150px;
    min-height:42px;
    padding:0 14px;
    color:var(--tds-blue-600,#0050d9);
    background:#fff;
  }

  .delivery-detail-photo-button svg {
    width:18px;
    height:18px;
    fill:none;
    stroke:currentColor;
    stroke-width:2;
    stroke-linecap:round;
    stroke-linejoin:round;
  }

  .delivery-detail-photo-missing {
    color:var(--tds-grey-500,#8b95a1);
    font-size:12px;
    font-weight:750;
  }
}

@media screen and (max-width:720px) {
  .delivery-detail-modal {
    width:calc(100vw - 16px);
    max-height:calc(100dvh - 16px);
    padding:16px;
    border-radius:24px;
  }

  .delivery-detail-modal .card-head {
    margin-bottom:8px;
  }

  .delivery-detail-modal .delivery-summary-grid.compact {
    grid-template-columns:repeat(3,minmax(0,1fr)) !important;
    gap:6px;
    margin:6px 0 8px;
  }

  .delivery-detail-modal .delivery-summary-grid.compact > div {
    min-height:0;
    padding:8px 5px;
  }

  .delivery-detail-modal .delivery-summary-grid.compact small {
    min-height:28px;
    margin:0;
    font-size:9px;
    line-height:1.35;
  }

  .delivery-detail-modal .delivery-summary-grid.compact strong {
    margin-top:2px;
    font-size:18px;
    line-height:1.15;
  }

  .delivery-detail-meta {
    grid-template-columns:repeat(3,minmax(0,1fr)) !important;
    gap:6px;
    margin-bottom:8px;
  }

  .delivery-detail-meta > div {
    padding:8px;
  }

  .delivery-detail-meta small {
    font-size:9px;
  }

  .delivery-detail-meta strong {
    margin-top:2px;
    font-size:12px;
  }

  .delivery-detail-route-list {
    gap:7px;
  }

  .delivery-detail-route-summary {
    grid-template-columns:1fr;
    gap:8px;
    padding:10px;
    border-radius:14px;
  }

  .delivery-detail-route-path {
    grid-template-columns:30px minmax(0,1fr) 18px minmax(0,1fr);
    gap:6px;
  }

  .delivery-detail-route-number {
    width:28px;
    height:28px;
    border-radius:9px;
    font-size:12px;
  }

  .delivery-detail-point small {
    font-size:9px;
  }

  .delivery-detail-point strong {
    margin-top:2px;
    font-size:12px;
  }

  .delivery-detail-point span {
    margin-top:1px;
    font-size:10px;
  }

  .delivery-detail-route-metrics > div {
    padding:7px 6px;
  }

  .delivery-detail-route-metrics small {
    font-size:8px;
    white-space:nowrap;
  }

  .delivery-detail-route-metrics strong {
    margin-top:2px;
    font-size:11px;
  }

  .delivery-detail-route-proof {
    padding:8px;
  }

  .delivery-detail-route-proof strong {
    margin-top:2px;
    font-size:11px;
  }

  .delivery-detail-photo-button {
    min-width:132px;
    min-height:40px;
    padding:0 10px;
    font-size:11px;
  }

  .delivery-detail-modal .action-grid {
    margin-top:10px;
  }
}

/* Keep the main content aligned after the responsive sidebar is hidden. */
@media screen and (max-width: 1024px) {
  main {
    margin-left: 0;
    width: 100%;
    max-width: 100vw;
  }
}

/* Keep the header actions and page cards on one shared content line. */
@media screen and (min-width:721px) {
  body:not(.logged-out) { --app-content-gutter:24px; }
  body:not(.logged-out) .topbar {
    right:0;
    width:auto;
    max-width:none;
    padding-left:var(--app-content-gutter);
    padding-right:var(--app-content-gutter);
  }
  body:not(.logged-out) .content {
    padding-left:var(--app-content-gutter);
    padding-right:var(--app-content-gutter);
  }
  body:not(.logged-out) .top-heading { min-width:0; }
  body:not(.logged-out) .top-actions { position:static; justify-self:end; padding-right:0; }
  body:not(.logged-out) .logout-button { position:static; width:100px; min-width:100px; transform:none; }
  body:not(.logged-out) .topbar .eyebrow { flex-wrap:nowrap; overflow:hidden; }
  body:not(.logged-out) .topbar .header-company-name { min-width:0; }
}

@media screen and (min-width:721px) and (max-width:1024px) {
  body:not(.logged-out) .topbar { left:0; display:flex; }
  body:not(.logged-out) .mobile-menu { flex:0 0 44px; width:44px; }
  body:not(.logged-out) .top-heading { flex:1; }
  body:not(.logged-out) .top-actions { flex:0 0 auto; margin-left:auto; }
}

@media screen and (min-width:1025px) {
  body:not(.logged-out) { --app-content-gutter:40px; }
  body:not(.logged-out) .topbar {
    left:var(--app-sidebar-width);
    display:grid;
    grid-template-columns:minmax(0,1fr) max-content;
  }
}

/* 거래 내역: 출고 상품가액과 실제 수금액을 분리해 비교한다. */
.history-page-card .history-card-head{display:flex;align-items:center;justify-content:space-between;margin-bottom:16px}.history-page-card .history-card-head h2{margin:0;font-size:22px}.history-page-card .history-toolbar{align-items:flex-end}.history-page-card .history-search-field{flex:0 1 380px;min-width:320px}.history-page-card .history-search-field input{width:100%}.split-amount-history{table-layout:fixed}.split-amount-history th,.split-amount-history td{overflow-wrap:anywhere}.split-amount-history .history-receipt-col .receipt-link{white-space:nowrap}.split-amount-history .history-quantity-col,.split-amount-history .history-unit-price-col,.split-amount-history .history-payment-method-col,.split-amount-history .history-product-amount-col,.split-amount-history .history-payment-amount-col{white-space:nowrap}.split-amount-history th.history-quantity-col,.split-amount-history td.history-quantity-col,.split-amount-history th.history-unit-price-col,.split-amount-history td.history-unit-price-col,.split-amount-history th.history-product-amount-col,.split-amount-history td.history-product-amount-col,.split-amount-history th.history-payment-amount-col,.split-amount-history td.history-payment-amount-col{text-align:right;font-variant-numeric:tabular-nums}.history-employee-table .history-date-col{width:7%}.history-employee-table .history-type-col{width:5%}.history-employee-table .history-quantity-col{width:7%}.history-employee-table .history-unit-price-col{width:8%}@media(max-width:720px){.history-page-card .history-search-field{flex-basis:100%;min-width:100%}.history-page-card .history-card-head h2{font-size:19px}}

@media screen {
  .history-page-card { overflow:visible; }
  .history-page-card #historyContent { max-width:100%; overflow-x:auto; }
  .history-page-card #historyPartnerResults {
    z-index:90;
    max-height:min(498px,60dvh);
    overflow-y:auto;
  }
}.history-employee-table .history-partner-code-col{width:9%}.history-employee-table .history-party-col{width:10%}.history-employee-table .history-customer-col{width:14%}.history-employee-table .history-receipt-col{width:8%}.history-employee-table .history-product-col{width:7%}.history-employee-table .history-payment-method-col{width:7%}.history-employee-table .history-product-amount-col{width:9%}.history-employee-table .history-payment-amount-col{width:9%}

/* 거래 내역 표의 긴 다국어 헤더는 열 안에서 단어 단위로 줄바꿈한다. */
.split-amount-history thead th[class] {
  white-space:normal;
  overflow-wrap:normal;
  word-break:normal;
  line-height:1.35;
  vertical-align:middle;
}

.split-amount-history .history-receipt-col .receipt-link,
.split-amount-history td.history-payment-method-col {
  max-width:100%;
  white-space:normal;
  overflow-wrap:anywhere;
  line-height:1.35;
}

/* 거래처별 내역의 출고·수금 기타 입력값은 마지막 열에서 읽기 쉽게 보인다. */
.split-amount-history{min-width:1390px}.history-partner-table .history-date-col{width:7%}.history-partner-table .history-partner-code-col{width:8%}.history-partner-table .history-party-col{width:12%}.history-partner-table .history-type-col{width:5%}.history-partner-table .history-receipt-col{width:8%}.history-partner-table .history-product-col{width:8%}.history-partner-table .history-quantity-col{width:7%}.history-partner-table .history-unit-price-col{width:8%}.history-partner-table .history-product-amount-col{width:9%}.history-partner-table .history-payment-method-col{width:7%}.history-partner-table .history-payment-amount-col{width:9%}.history-partner-table .history-other-col{width:12%}.split-amount-history td.history-other-col{white-space:normal;overflow-wrap:anywhere;line-height:1.35}

/* Keep sidebar branding visible when lower navigation items receive focus. */
@media screen and (min-width:1025px){
  .sidebar>.brand,.sidebar>.sidebar-foot{flex:0 0 auto}
  .sidebar>nav{flex:1 1 0;min-height:0;overflow-y:auto;align-content:start;overscroll-behavior:contain}
}

/* Mobile titles wrap to two lines. */
@media screen and (max-width:720px){
  body:not(.logged-out) .topbar h1{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;max-width:none;overflow:hidden;white-space:normal;word-break:keep-all;font-size:17px;line-height:1.15}
}
