/* One compact phone-list pattern; desktop keeps the original tables. */
.mobile-compact-list { display: none; }
@media (max-width: 760px), (max-height: 500px) and (orientation: landscape) and (pointer: coarse) {
  .table-scroll.mobile-native-table-scroll { width: 100%; max-width: 100%; min-width: 0; overflow-x: auto !important; overflow-y: hidden; -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; }
  .table-scroll.mobile-native-table-scroll > table.mobile-native-table { display: table !important; width: max-content; min-width: max(100%, 720px); table-layout: auto; }
  .table-scroll.mobile-native-table-scroll > table.mobile-native-table th,
  .table-scroll.mobile-native-table-scroll > table.mobile-native-table td { padding: 6px 7px !important; }
  .table-scroll.mobile-compact-scroll { width: 100%; max-width: 100%; min-width: 0; overflow: visible !important; }
  .table-scroll table.data-table[data-mobile-compact-source="true"] { display: none !important; }
  .mobile-compact-list { display: block; width: 100%; min-width: 0; color: var(--text); }
  .mobile-compact-head, .mobile-compact-summary {
    display: grid;
    grid-template-columns: minmax(0, 1.65fr) repeat(var(--compact-metrics, 3), minmax(0, 1fr)) 48px;
    align-items: center;
    min-width: 0;
  }
  .mobile-compact-head {
    min-height: 35px;
    border-bottom: 1px solid var(--line);
    background: color-mix(in srgb, var(--surface-2) 75%, var(--ci-primary) 4%);
    color: var(--muted);
    font-size: var(--zkl-font-9, 9px);
    font-weight: 800;
    line-height: 1.3;
  }
  .mobile-compact-head > span { min-width: 0; padding: 8px 4px; overflow-wrap: anywhere; text-align: center; }
  .mobile-compact-head > span:first-child { padding-left: 8px; text-align: left; }
  .mobile-compact-row { min-width: 0; max-width: 100%; border-bottom: 1px solid var(--line); background: var(--surface); }
  .mobile-compact-row[hidden] { display: none !important; }
  .mobile-compact-row:last-child { border-bottom: 0; }
  .mobile-compact-summary { min-height: 62px; }
  .mobile-compact-summary > div { min-width: 0; max-width: 100%; padding: 8px 4px; }
  .mobile-compact-summary > div + div { border-left: 1px solid color-mix(in srgb, var(--line) 70%, transparent); }
  .mobile-compact-summary > .mobile-compact-identity { padding-left: 8px; font-size: var(--zkl-font-10_5, 10.5px); line-height: 1.35; overflow-wrap: anywhere; }
  .mobile-compact-identity strong, .mobile-compact-identity .buyer-name { display: block; color: var(--text); font-size: var(--zkl-font-11, 11px); font-weight: 820; line-height: 1.3; }
  .mobile-compact-identity small, .mobile-compact-identity .style-code { display: block; margin-top: 3px; color: var(--muted); font-size: var(--zkl-font-9, 9px); line-height: 1.3; }
  .mobile-compact-identity > .mobile-compact-value { display: block; max-width: 100%; }
  .mobile-compact-identity .record-id { display: block; }
  .mobile-compact-summary > .mobile-compact-metric {
    align-self: stretch;
    display: flex;
    align-items: center;
    justify-content: center;
    color: inherit;
    font-size: var(--zkl-font-10, 10px);
    font-weight: 750;
    font-variant-numeric: tabular-nums;
    line-height: 1.35;
    overflow-wrap: anywhere;
    white-space: normal;
    text-align: center;
  }
  .mobile-compact-summary > .mobile-compact-action { padding: 4px 2px; text-align: center; }
  .mobile-compact-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    min-width: 44px;
    min-height: 44px;
    padding: 3px;
    border: 1px solid color-mix(in srgb, var(--ci-primary) 23%, var(--line));
    border-radius: 10px;
    background: color-mix(in srgb, var(--ci-primary) 7%, var(--surface));
    color: var(--ci-primary);
    font: inherit;
    font-size: var(--zkl-font-9, 9px);
    font-weight: 800;
    cursor: pointer;
  }
  .mobile-compact-toggle:focus-visible { outline: 2px solid var(--ci-primary); outline-offset: 1px; }
  .mobile-compact-toggle[aria-expanded="true"] { background: var(--ci-primary); color: var(--surface); }
  .mobile-compact-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; min-width: 0; margin: 0; text-align: left; }
  .mobile-compact-field { min-width: 0; padding: 9px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); }
  .mobile-compact-field-wide { grid-column: 1 / -1; }
  .mobile-compact-field dt { margin: 0 0 5px; color: var(--muted); font-size: var(--zkl-font-9, 9px); font-weight: 800; line-height: 1.35; text-transform: uppercase; overflow-wrap: anywhere; }
  .mobile-compact-field dd { min-width: 0; margin: 0; color: var(--text); font-size: var(--zkl-font-12, 12px); font-weight: 700; line-height: 1.45; white-space: normal !important; text-align: left; overflow-wrap: anywhere; }
  .mobile-compact-field dd .mobile-compact-value { display: block; min-width: 0; }
  .mobile-compact-field .buyer-name, .mobile-compact-field .style-code { max-width: 100%; white-space: normal; overflow-wrap: anywhere; }
  .mobile-compact-field .button, .mobile-compact-field .icon-button { min-height: 44px !important; }
  .mobile-compact-field .production-row-actions, .mobile-compact-field .recipe-row-actions { display: flex; flex-wrap: wrap; justify-content: flex-start; gap: 8px; }
  .mobile-compact-detail-card { padding: 10px 0; }
  .mobile-compact-group { padding: 12px 7px; color: var(--ci-primary); font-size: var(--zkl-font-11, 11px); font-weight: 850; background: color-mix(in srgb, var(--ci-primary) 5%, var(--surface)); overflow-wrap: anywhere; }
  .mobile-compact-full-detail { display: grid; gap: 8px; }
  .mobile-compact-full-detail .mobile-compact-detail-card { padding: 10px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
  .mobile-compact-full-detail .mobile-compact-group { padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); color: var(--text); }
  .mobile-compact-full-detail .mobile-compact-detail-card:last-child { border-top: 1px solid var(--line); }
  .mobile-compact-metric.balance-negative, .mobile-compact-field dd.balance-negative { color: var(--danger, #dc2626); }
  .mobile-compact-metric.balance-positive, .mobile-compact-field dd.balance-positive { color: var(--success, #059669); }
}
@media (max-width: 360px) {
  .mobile-compact-head, .mobile-compact-summary { grid-template-columns: minmax(0, 1.55fr) repeat(var(--compact-metrics, 3), minmax(0, 1fr)) 46px; }
  .mobile-compact-summary > div { padding-right: 2px; padding-left: 2px; }
  .mobile-compact-summary > .mobile-compact-metric { font-size: var(--zkl-font-9, 9px); }
  .mobile-compact-identity strong, .mobile-compact-identity .buyer-name { font-size: var(--zkl-font-10, 10px); }
}
