/* Compact inventory/waste cards. Presentation only; keep all table nodes and actions. */
@media screen {
  body[data-cafe-layout="modern"] #inventoryPage .inventory-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  body[data-cafe-layout="modern"] #inventoryPage .table-wrap:has(#productRows),
  body[data-cafe-layout="modern"] .table-wrap:has(#wasteSummaryRows),
  body[data-cafe-layout="modern"] .table-wrap:has(#materialsWasteRows) {
    overflow: visible;
    min-width: 0;
  }

  body[data-cafe-layout="modern"] #inventoryPage table:has(#productRows),
  body[data-cafe-layout="modern"] table:has(#wasteSummaryRows),
  body[data-cafe-layout="modern"] table:has(#materialsWasteRows) {
    display: block;
    width: 100%;
    min-width: 0;
    white-space: normal;
  }

  body[data-cafe-layout="modern"] #inventoryPage table:has(#productRows) > thead,
  body[data-cafe-layout="modern"] table:has(#wasteSummaryRows) > thead,
  body[data-cafe-layout="modern"] table:has(#materialsWasteRows) > thead {
    display: none;
  }

  body[data-cafe-layout="modern"] #inventoryPage #productRows {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: stretch;
    gap: 12px;
    padding: 12px;
    width: 100%;
  }

  body[data-cafe-layout="modern"] #inventoryPage #productRows .product-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: auto auto auto;
    position: relative;
    min-width: 0;
    padding: 0;
    gap: 0;
    border: 1px solid #c8ae84;
    border-radius: 12px 9px 12px 9px;
    background: #fff9e9;
    box-shadow: 0 2px 0 #98724820;
    overflow: hidden;
  }

  body[data-cafe-layout="modern"] #inventoryPage #productRows .product-row td {
    display: flex;
    position: static;
    align-items: center;
    min-width: 0;
    padding: 8px 10px;
    gap: 5px;
    border: 0;
    white-space: normal;
  }

  body[data-cafe-layout="modern"] #inventoryPage #productRows .product-row td:nth-child(2) {
    grid-column: 1;
    grid-row: 1;
    padding-right: 6px;
    border-bottom: 1px solid #e5d4b7;
  }

  body[data-cafe-layout="modern"] #inventoryPage #productRows .product {
    gap: 7px;
    min-width: 0;
    align-items: center;
  }

  body[data-cafe-layout="modern"] #inventoryPage #productRows .bread {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    font-size: 18px;
    flex: none;
  }

  body[data-cafe-layout="modern"] #inventoryPage #productRows .product-select-link {
    min-width: 0;
    min-height: 32px;
    font-size: 13px;
    line-height: 1.5;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  body[data-cafe-layout="modern"] #inventoryPage #productRows .product-row td:nth-child(3) {
    grid-column: 2;
    grid-row: 1;
    flex-direction: column;
    align-items: flex-end;
    justify-content: center;
    gap: 3px;
    background: #e9eddc;
    border-bottom: 1px solid #d4dabf;
  }

  body[data-cafe-layout="modern"] #inventoryPage #productRows .product-row td:nth-child(3)::before {
    content: '現在庫';
    position: static;
    flex: none;
    font-size: 10px;
    line-height: 1.4;
    color: #617053;
  }

  body[data-cafe-layout="modern"] #inventoryPage #productRows .stock-adjust {
    min-width: 0;
    max-width: 100%;
    flex-wrap: nowrap;
    justify-content: flex-end;
    gap: 3px;
  }

  body[data-cafe-layout="modern"] #inventoryPage #productRows .stock {
    min-width: 0;
    flex: 0 1 auto;
    font-size: 23px;
    line-height: 1.2;
    text-align: right;
    overflow-wrap: anywhere;
  }

  body[data-cafe-layout="modern"] #inventoryPage #productRows .stock-unit {
    font-size: 10px;
    flex: none;
  }

  body[data-cafe-layout="modern"] #inventoryPage #productRows .product-row td:nth-child(4),
  body[data-cafe-layout="modern"] #inventoryPage #productRows .product-row td:nth-child(5) {
    grid-row: 2;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 4px;
    background: #fbf3df;
  }

  body[data-cafe-layout="modern"] #inventoryPage #productRows .product-row td:nth-child(4) {grid-column: 1}
  body[data-cafe-layout="modern"] #inventoryPage #productRows .product-row td:nth-child(5) {grid-column: 2}

  body[data-cafe-layout="modern"] #inventoryPage #productRows .product-row td:nth-child(4)::before,
  body[data-cafe-layout="modern"] #inventoryPage #productRows .product-row td:nth-child(5)::before {
    position: static;
    flex: none;
    font-size: 10px;
    line-height: 1.5;
    color: #7b684f;
  }

  body[data-cafe-layout="modern"] #inventoryPage #productRows .product-row td:nth-child(4)::before {content: '基本準備数'}
  body[data-cafe-layout="modern"] #inventoryPage #productRows .product-row td:nth-child(5)::before {content: '基本納品数'}

  body[data-cafe-layout="modern"] #inventoryPage #productRows .iu-setting {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    flex: none;
    gap: 4px;
  }

  body[data-cafe-layout="modern"] #inventoryPage #productRows .iu-setting-line {width: 100%; gap: 4px}
  body[data-cafe-layout="modern"] #inventoryPage #productRows .iu-setting-line .prep-input {
    width: 48px;
    min-width: 0;
    flex: 1;
    height: 36px;
    min-height: 36px;
    padding: 3px 2px;
    font-size: 15px;
  }

  body[data-cafe-layout="modern"] #inventoryPage #productRows .iu-setting-arrows {
    grid-template-columns: repeat(2, 34px);
    gap: 3px;
  }

  body[data-cafe-layout="modern"] #inventoryPage #productRows .stock-stepper,
  body[data-cafe-layout="modern"] #inventoryPage #productRows .iu-arrow-column {gap: 3px; margin-left: 0; flex: none}

  body[data-cafe-layout="modern"] #inventoryPage #productRows .stock-stepper button,
  body[data-cafe-layout="modern"] #inventoryPage #productRows .iu-setting-step {
    width: 34px;
    min-width: 34px;
    height: 32px;
    min-height: 32px;
    padding: 0;
    border-radius: 7px;
  }

  body[data-cafe-layout="modern"] #inventoryPage #productRows .iu-inherit {
    min-height: 24px;
    padding: 3px 4px;
    font-size: 10px;
    line-height: 1.5;
  }

  body[data-cafe-layout="modern"] #inventoryPage #productRows .product-row td:first-child {
    grid-column: 1;
    grid-row: 3;
    justify-self: start;
    z-index: 1;
    padding: 5px 7px;
    background: transparent;
  }

  body[data-cafe-layout="modern"] #inventoryPage #productRows .drag-handle {
    width: 30px;
    min-width: 30px;
    height: 30px;
    min-height: 30px;
    padding: 0;
    font-size: 13px;
  }

  body[data-cafe-layout="modern"] #inventoryPage #productRows .product-row td:nth-child(6) {
    grid-column: 1;
    grid-row: 3;
    align-self: stretch;
    padding-left: 44px;
    border-top: 1px solid #e3d0af;
  }

  body[data-cafe-layout="modern"] #inventoryPage #productRows .tag {font-size: 10px; padding: 3px 7px; white-space: nowrap}

  body[data-cafe-layout="modern"] #inventoryPage #productRows .product-row td:nth-child(7) {
    grid-column: 2;
    grid-row: 3;
    justify-content: flex-end;
    padding: 5px 8px;
    border-top: 1px solid #e3d0af;
  }

  body[data-cafe-layout="modern"] #inventoryPage #productRows .product-manage {
    width: 30px;
    min-width: 30px;
    height: 30px;
    min-height: 30px;
    padding: 2px;
    font-size: 16px;
  }

  body[data-cafe-layout="modern"] #inventoryPage #productRows .product-row td:has(.iu-setting[hidden]) {display: none}
  body[data-cafe-layout="modern"] #inventoryPage #productRows .product-row.dragging {opacity: .35}
  body[data-cafe-layout="modern"] #inventoryPage #productRows .product-row.drop-target {outline: 3px solid #6c8d61; outline-offset: 2px}

  /* Size waste cards from their own panel, including the material report panel. */
  body[data-cafe-layout="modern"] .table-wrap:has(#wasteSummaryRows),
  body[data-cafe-layout="modern"] .table-wrap:has(#materialsWasteRows) {container-type: inline-size}

  body[data-cafe-layout="modern"] :is(#wasteSummaryRows, #materialsWasteRows) {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    width: 100%;
    gap: 10px;
    padding: 12px;
  }

  body[data-cafe-layout="modern"] :is(#wasteSummaryRows, #materialsWasteRows) > tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-content: center;
    position: relative;
    min-width: 0;
    min-height: 88px;
    padding: 10px 92px 10px 12px;
    border: 1px solid #ccb38d;
    border-radius: 10px 8px 11px 8px;
    background: #fff9e9;
    box-shadow: 0 2px 0 #9872481a;
  }

  body[data-cafe-layout="modern"] :is(#wasteSummaryRows, #materialsWasteRows) > tr > td {
    display: block;
    min-width: 0;
    padding: 0;
    border: 0;
    text-align: left;
    font-size: 11px;
    line-height: 1.5;
    white-space: normal;
  }

  body[data-cafe-layout="modern"] :is(#wasteSummaryRows, #materialsWasteRows) .waste-name-cell {display: block; min-width: 0}
  body[data-cafe-layout="modern"] :is(#wasteSummaryRows, #materialsWasteRows) .product {gap: 7px; min-width: 0; font-size: 12px; line-height: 1.5; overflow-wrap: anywhere}
  body[data-cafe-layout="modern"] :is(#wasteSummaryRows, #materialsWasteRows) .bread {width: 30px; height: 30px; flex: none; font-size: 17px; border-radius: 7px}
  body[data-cafe-layout="modern"] :is(#wasteSummaryRows, #materialsWasteRows) .product > div {min-width: 0}
  body[data-cafe-layout="modern"] :is(#wasteSummaryRows, #materialsWasteRows) .material-category {padding: 1px 5px; font-size: 9px; line-height: 1.5}
  body[data-cafe-layout="modern"] :is(#wasteSummaryRows, #materialsWasteRows) > tr > td:last-child {padding-top: 4px}
  body[data-cafe-layout="modern"] :is(#wasteSummaryRows, #materialsWasteRows) > tr > td:last-child::before {content: '廃棄'; margin-right: 6px; color: #8a775e; font-size: 10px}
  body[data-cafe-layout="modern"] :is(#wasteSummaryRows, #materialsWasteRows) .waste-count {font-size: 20px; line-height: 1.2; overflow-wrap: anywhere}
  body[data-cafe-layout="modern"] :is(#wasteSummaryRows, #materialsWasteRows) .quantity-arrow-pairs {position: absolute; top: 50%; right: 10px; transform: translateY(-50%); gap: 4px}
  body[data-cafe-layout="modern"] :is(#wasteSummaryRows, #materialsWasteRows) .waste-stepper {gap: 3px}
  body[data-cafe-layout="modern"] :is(#wasteSummaryRows, #materialsWasteRows) .waste-stepper button {width: 34px; min-width: 34px; height: 32px; min-height: 32px; padding: 0; border-radius: 7px}
  body[data-cafe-layout="modern"] #materialsWasteRows > tr:has(.empty) {grid-column: 1 / -1; padding: 18px; min-height: 0; text-align: center}
  body[data-cafe-layout="modern"] #materialsWasteRows > tr:has(.empty) > td::before {content: none}

  @container (min-width: 500px) {
    body[data-cafe-layout="modern"] :is(#wasteSummaryRows, #materialsWasteRows) {grid-template-columns: repeat(2, minmax(0, 1fr))}
  }

  @media (min-width: 980px) {
    body[data-cafe-layout="modern"] #inventoryPage #productRows {grid-template-columns: repeat(2, minmax(0, 1fr))}
    body[data-cafe-layout="modern"] #wastePage > .layout,
    body[data-cafe-layout="modern"] #materialsPage .materials-reports {grid-template-columns: minmax(0, 1fr); gap: 16px}
    body[data-cafe-layout="modern"] #wastePage #wasteForm .form-grid {grid-template-columns: minmax(160px, 1.4fr) minmax(140px, .9fr) minmax(145px, 1fr) auto; align-items: end; gap: 12px}
    body[data-cafe-layout="modern"] #wastePage #wasteForm .field.full {grid-column: auto}
    body[data-cafe-layout="modern"] #wastePage #wasteForm .submit {grid-column: auto; margin: 0; min-height: 44px; padding: 9px 12px; white-space: nowrap}
  }

  @media (min-width: 1320px) {
    body[data-cafe-layout="modern"] #inventoryPage #productRows .product-row {grid-template-columns: repeat(6, minmax(0, 1fr)); grid-template-rows: auto auto auto}
    body[data-cafe-layout="modern"] #inventoryPage #productRows .product-row td:nth-child(2) {grid-column: 1 / -1; grid-row: 1; padding: 8px 10px}
    body[data-cafe-layout="modern"] #inventoryPage #productRows .product-row td:nth-child(3) {grid-column: 1 / span 2; grid-row: 2; align-items: stretch; border-bottom: 0}
    body[data-cafe-layout="modern"] #inventoryPage #productRows .product-row td:nth-child(4) {grid-column: 3 / span 2; grid-row: 2}
    body[data-cafe-layout="modern"] #inventoryPage #productRows .product-row td:nth-child(5) {grid-column: 5 / span 2; grid-row: 2}
    body[data-cafe-layout="modern"] #inventoryPage #productRows .product-row td:first-child,
    body[data-cafe-layout="modern"] #inventoryPage #productRows .product-row td:nth-child(6) {grid-column: 1 / span 3}
    body[data-cafe-layout="modern"] #inventoryPage #productRows .product-row td:nth-child(7) {grid-column: 4 / span 3}
  }

  @media (max-width: 560px) {
    body[data-cafe-layout="modern"] #inventoryPage #productRows {grid-template-columns: minmax(0, 1fr); gap: 10px; padding: 10px}
    body[data-cafe-layout="modern"] #inventoryPage #productRows .product-row td:nth-child(2) {grid-column: 1 / -1; grid-row: 1; padding: 9px 10px}
    body[data-cafe-layout="modern"] #inventoryPage #productRows .product-row td:nth-child(3) {grid-column: 1 / -1; grid-row: 2; flex-direction: row; justify-content: space-between; align-items: center; padding: 9px 10px}
    body[data-cafe-layout="modern"] #inventoryPage #productRows .product-row td:nth-child(4),
    body[data-cafe-layout="modern"] #inventoryPage #productRows .product-row td:nth-child(5) {grid-column: 1 / -1; flex-direction: row; align-items: center; justify-content: space-between; padding: 9px 10px; gap: 8px}
    body[data-cafe-layout="modern"] #inventoryPage #productRows .product-row td:nth-child(4) {grid-row: 3}
    body[data-cafe-layout="modern"] #inventoryPage #productRows .product-row td:nth-child(5) {grid-row: 4}
    body[data-cafe-layout="modern"] #inventoryPage #productRows .product-row td:first-child,
    body[data-cafe-layout="modern"] #inventoryPage #productRows .product-row td:nth-child(6),
    body[data-cafe-layout="modern"] #inventoryPage #productRows .product-row td:nth-child(7) {grid-row: 5}
    body[data-cafe-layout="modern"] #inventoryPage #productRows .product-row td:nth-child(3)::before,
    body[data-cafe-layout="modern"] #inventoryPage #productRows .product-row td:nth-child(4)::before,
    body[data-cafe-layout="modern"] #inventoryPage #productRows .product-row td:nth-child(5)::before {font-size: 11px}
    body[data-cafe-layout="modern"] #inventoryPage #productRows .iu-setting {width: 154px; max-width: 154px; flex: none}
    body[data-cafe-layout="modern"] #inventoryPage #productRows .iu-setting-arrows {grid-template-columns: repeat(2, 40px); gap: 4px}
    body[data-cafe-layout="modern"] #inventoryPage #productRows .stock-stepper button,
    body[data-cafe-layout="modern"] #inventoryPage #productRows .iu-setting-step {width: 40px; min-width: 40px; height: 36px; min-height: 36px}
    body[data-cafe-layout="modern"] #inventoryPage #productRows .iu-setting-line .prep-input {height: 44px; min-height: 44px; font-size: 16px}
    body[data-cafe-layout="modern"] #inventoryPage #productRows .drag-handle,
    body[data-cafe-layout="modern"] #inventoryPage #productRows .product-manage {width: 36px; min-width: 36px; height: 36px; min-height: 36px}
    body[data-cafe-layout="modern"] #inventoryPage #productRows .product-row td:nth-child(6) {padding-left: 48px}
    body[data-cafe-layout="modern"] :is(#wasteSummaryRows, #materialsWasteRows) {gap: 8px; padding: 10px}
    body[data-cafe-layout="modern"] :is(#wasteSummaryRows, #materialsWasteRows) > tr {padding-right: 104px; min-height: 96px}
    body[data-cafe-layout="modern"] :is(#wasteSummaryRows, #materialsWasteRows) .waste-stepper button {width: 40px; min-width: 40px; height: 36px; min-height: 36px}
  }
}
