/* Screen-only print previews. Exported images and Excel keep the original table. */
@media screen and (max-width: 768px) {
  #quoteSheetModal > div {
    box-sizing: border-box;
    width: calc(100% - 16px) !important;
    max-width: none !important;
    max-height: calc(100dvh - 16px) !important;
    padding: 8px !important;
    overflow: hidden;
  }

  #quoteSheetModal .quote-sheet-toolbar,
  .quotation-output-dialog .quotation-output-toolbar {
    display: grid !important;
    flex-wrap: nowrap !important;
    align-items: center;
    gap: 4px !important;
    margin-bottom: 8px !important;
    flex: none;
    min-width: 0;
    overflow-x: auto;
  }

  #quoteSheetModal .quote-sheet-toolbar {
    grid-template-columns: repeat(2, minmax(44px, 1fr)) minmax(76px, 1.4fr) minmax(44px, 1fr);
  }
  #quoteSheetModal .quote-sheet-toolbar > div > button[onclick="printQuoteSheet()"] { display: none !important; }
  #quoteSheetModal .quote-sheet-toolbar > div { display: contents !important; }
  #quoteSheetShareArea,
  .quotation-output-dialog .quotation-output-share { min-width: 0; }
  #quoteSheetShareArea > .btn,
  .quotation-output-dialog .quotation-output-share > .quotation-btn { width: 100%; }
  #quoteSheetModal .quote-sheet-toolbar .btn,
  .quotation-output-dialog .quotation-output-toolbar .quotation-btn {
    box-sizing: border-box;
    width: 100%;
    min-width: 0 !important;
    height: 36px;
    justify-content: center;
    padding: 7px 3px !important;
    white-space: nowrap;
  }
  .quotation-output-dialog {
    box-sizing: border-box;
    width: calc(100% - 16px) !important;
    max-width: none !important;
    max-height: calc(100dvh - 16px) !important;
    padding: 8px !important;
    overflow: hidden;
  }
  .quotation-output-dialog .quotation-output-toolbar {
    grid-template-columns: repeat(2, minmax(44px, 1fr)) minmax(76px, 1.4fr) minmax(44px, 1fr);
  }
  .quotation-output-dialog .quotation-output-spacer { display: none; }
  .quotation-output-dialog > [role="status"] { flex: none; }
  #quoteSheetCaptureStatus [hidden],
  .quotation-output-dialog [hidden] { display: none !important; }

  #quoteSheetContent { min-height: 0; overscroll-behavior: contain; }
  #quoteSheetContent > div:first-child { margin-bottom: 10px !important; }
  #quoteSheetContent h2 { font-size: 18px !important; }
  #quoteSheetContent > div:first-child > div {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    text-align: left;
    overflow-wrap: anywhere;
  }

  #quoteSheetContent .quote-sheet-table,
  #quoteSheetContent .quote-sheet-table tbody,
  #quoteSheetContent .quote-sheet-table tfoot { display: block; width: 100%; }
  #quoteSheetContent .quote-sheet-table thead { display: none; }
  #quoteSheetTbody tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 6px 12px;
    position: relative;
    padding: 10px 0;
    border-top: 1px solid #dce3ee;
  }
  #quoteSheetTbody td {
    display: block;
    min-width: 0;
    width: auto !important;
    border: 0 !important;
    padding: 0 !important;
    text-align: left !important;
    line-height: 1.5;
  }
  #quoteSheetTbody td::before {
    color: #77849a;
    font-size: 12px !important;
    margin-right: 6px;
    font-weight: 400;
  }
  #quoteSheetTbody td:nth-child(1) {
    position: absolute;
    top: 10px;
    left: 0;
    width: 24px !important;
    color: #77849a;
  }
  #quoteSheetTbody td:nth-child(2) {
    grid-column: 1 / -1;
    padding-left: 28px !important;
    font-weight: 600;
    white-space: normal !important;
    word-break: normal;
    overflow-wrap: anywhere;
  }
  #quoteSheetContent #quoteSheetTbody td:nth-child(3) {
    grid-column: 1 / -1;
    white-space: normal !important;
    overflow-wrap: anywhere;
  }
  #quoteSheetTbody td:nth-child(3)::before { content: '电压'; }
  #quoteSheetTbody td:nth-child(4)::before { content: '单位'; }
  #quoteSheetTbody td:nth-child(5)::before { content: '数量'; }
  #quoteSheetTbody td:nth-child(6)::before { content: '单价'; }
  #quoteSheetTbody td:nth-child(7)::before { content: '金额'; }
  #quoteSheetTbody td:nth-child(5),
  #quoteSheetTbody td:nth-child(7) { text-align: right !important; }
  #quoteSheetTbody td:nth-child(7) { font-weight: 600; }
  #quoteSheetTbody td:nth-child(8) {
    grid-column: 1 / -1;
    white-space: normal !important;
    word-break: normal;
    overflow-wrap: anywhere;
    color: #64748b;
  }
  #quoteSheetTbody td:nth-child(8)::before { content: '备注'; }
  #quoteSheetTbody td:nth-child(8):empty { display: none; }

  #quoteSheetContent .quote-sheet-table tfoot {
    position: sticky;
    bottom: 0;
    background: #f4f7fb;
    border-top: 1px solid #dce3ee;
  }
  #quoteSheetContent .quote-sheet-table tfoot tr {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    background: transparent !important;
  }
  #quoteSheetContent .quote-sheet-table tfoot td {
    display: block;
    border: 0 !important;
    padding: 10px 4px !important;
    white-space: nowrap;
  }
  #quoteSheetContent .quote-sheet-table tfoot td:last-child { display: none; }
}
