:root {
    --bg: #f5f5f7;
    --panel: rgba(255,255,255,.92);
    --line: rgba(60,60,67,.16);
    --label: #111827;
    --muted: rgba(60,60,67,.62);
    --blue: #007aff;
    --green: #34c759;
    --orange: #ff9500;
    --red: #c1121f;
    --purple: #5856d6;
    --shadow: 0 14px 45px rgba(15,23,42,.10);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; min-height: 100%; }
body {
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: radial-gradient(circle at top left, rgba(0,122,255,.08), transparent 30%), var(--bg);
    color: var(--label);
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
}
[x-cloak] { display: none !important; }
button, input, textarea, select { font: inherit; }
button { touch-action: manipulation; }
.brand { font-family: "Baloo 2", Inter, sans-serif; color: var(--red); letter-spacing: -.03em; }
.glass { background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow); backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px); }
.soft { background: rgba(118,118,128,.11); border: 1px solid rgba(118,118,128,.13); }
.kbd {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 23px; height: 22px; padding: 0 7px; border-radius: 7px;
    background: rgba(118,118,128,.13); border: 1px solid rgba(118,118,128,.17);
    color: #4b5563; font-size: 11px; font-weight: 800;
}
.focus-ring:focus { outline: none; box-shadow: 0 0 0 4px rgba(0,122,255,.18); border-color: rgba(0,122,255,.35); }
.tap { transition: transform .12s ease, box-shadow .12s ease, background-color .12s ease; }
.tap:active { transform: scale(.975); }
.scan-ready { animation: scanPulse 1.45s ease-in-out infinite; }
@keyframes scanPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(0,122,255,.28); }
    50% { box-shadow: 0 0 0 10px rgba(0,122,255,0); }
}
.ok-flash { animation: okFlash .7s ease; }
@keyframes okFlash {
    0% { background: rgba(52,199,89,.20); }
    100% { background: transparent; }
}
.danger-flash { animation: dangerFlash .7s ease; }
@keyframes dangerFlash {
    0% { background: rgba(193,18,31,.17); }
    100% { background: transparent; }
}
.grid-shell {
    height: 100dvh;
    display: grid;
    grid-template-columns: 330px minmax(0, 1fr) 360px;
    gap: 14px;
    padding: calc(env(safe-area-inset-top,0px) + 14px) 14px calc(env(safe-area-inset-bottom,0px) + 14px);
}
.scroll { overflow: auto; scrollbar-width: thin; }
.scroll::-webkit-scrollbar { width: 7px; height: 7px; }
.scroll::-webkit-scrollbar-thumb { background: rgba(118,118,128,.30); border-radius: 99px; }
.order-card.active { background: rgba(0,122,255,.10); border-color: rgba(0,122,255,.24); box-shadow: inset 4px 0 0 var(--blue); }
.line-clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.row-active { background: rgba(0,122,255,.085) !important; box-shadow: inset 4px 0 0 var(--blue); }
.row-bad { background: rgba(193,18,31,.075); }
.row-warn { background: rgba(255,149,0,.11); }
.toast { position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom,0px) + 20px); transform: translateX(-50%); z-index: 90; }
.modal-backdrop { background: rgba(15,23,42,.42); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); }
.seg button.active { background: #111827; color: white; }
@media (max-width: 1220px) {
    .grid-shell { grid-template-columns: 310px minmax(0, 1fr); }
    .inspector { display: none; }
}
@media (max-width: 820px) {
    body { overflow: auto; }
    .grid-shell { height: auto; min-height: 100dvh; grid-template-columns: 1fr; padding: 10px; }
    .sidebar { order: 2; max-height: 42dvh; }
    .workspace { order: 1; min-height: 58dvh; }
    .mobile-inspector { display: block !important; }
}

/* =========================================================
   SAP-STYLE FULFILLMENT SCREEN
   ========================================================= */
:root {
    --sap-bg: #eef1f5;
    --sap-panel: #ffffff;
    --sap-panel-alt: #f8fafc;
    --sap-border: #cfd6df;
    --sap-border-dark: #aab4c0;
    --sap-text: #18202b;
    --sap-muted: #5f6b7a;
    --sap-blue: #0a6ed1;
    --sap-green: #107e3e;
    --sap-orange: #b25a00;
    --sap-red: #e00000;
    --sap-row: #ffffff;
    --sap-row-hover: #f3f8fe;
}
body {
    font-family: Arial, "Helvetica Neue", Helvetica, sans-serif;
    background: var(--sap-bg);
    color: var(--sap-text);
}
.sap-shell {
    height: 100dvh;
    display: grid;
    grid-template-columns: 292px minmax(0, 1fr);
    grid-template-rows: 56px minmax(0, 1fr);
    gap: 0;
    background: var(--sap-bg);
}
.sap-shell.print-open { grid-template-columns: 292px minmax(0, 1fr) 360px; }
.sap-shell.orders-collapsed { grid-template-columns: minmax(0, 1fr); }
.sap-shell.orders-collapsed.print-open { grid-template-columns: minmax(0, 1fr) 360px; }
.sap-topbar {
    grid-column: 1 / -1;
    min-width: 0;
    display: grid;
    grid-template-columns: auto minmax(240px, 1fr) auto;
    gap: 14px;
    align-items: center;
    padding: 8px 14px;
    background: var(--sap-panel);
    border-bottom: 1px solid var(--sap-border);
}
.sap-brand {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}
.sap-logo {
    font-family: "Baloo 2", Arial, sans-serif;
    color: #e00000;
    font-size: 31px;
    font-weight: 800;
    line-height: 1;
    letter-spacing: 0;
    white-space: nowrap;
}
.sap-title {
    min-width: 0;
    border-left: 1px solid var(--sap-border);
    padding-left: 12px;
}
.sap-title strong {
    display: block;
    font-size: 14px;
    font-weight: 700;
    white-space: nowrap;
}
.sap-title span {
    display: block;
    max-width: 320px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--sap-muted);
    font-size: 12px;
    margin-top: 2px;
}
.sap-searchbar {
    min-width: 0;
    display: grid;
    grid-template-columns: minmax(170px, 1fr) 42px;
    gap: 6px;
}
.sap-input {
    min-width: 0;
    height: 36px;
    border: 1px solid var(--sap-border-dark);
    border-radius: 3px;
    background: #fff;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 10px;
}
.sap-input input {
    width: 100%;
    min-width: 0;
    border: 0;
    outline: 0;
    background: transparent;
    font-size: 14px;
    color: var(--sap-text);
}
.sap-input:focus-within {
    border-color: var(--sap-blue);
    box-shadow: 0 0 0 2px rgba(10,110,209,.14);
}
.sap-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    flex-wrap: wrap;
}
.sap-btn {
    height: 36px;
    min-width: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    border: 1px solid var(--sap-border-dark);
    border-radius: 3px;
    background: #fff;
    color: var(--sap-text);
    padding: 0 12px;
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
    cursor: pointer;
    transition: background .16s ease, border-color .16s ease, color .16s ease, transform .12s ease, box-shadow .16s ease;
}
.sap-btn:hover { background: #f7f9fb; border-color: #8392a5; }
.sap-btn:active { transform: scale(.98); }
.sap-btn.primary { background: var(--sap-blue); color: #fff; border-color: var(--sap-blue); }
.sap-btn.success { background: var(--sap-green); color: #fff; border-color: var(--sap-green); }
.sap-btn.icon { padding: 0; width: 36px; }
.sap-btn:disabled { opacity: .48; cursor: not-allowed; }
.sap-orders {
    grid-row: 2;
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    background: var(--sap-panel);
    border-right: 1px solid var(--sap-border);
    overflow: hidden;
}
.sap-shell.orders-collapsed .sap-orders { display: none; }
.sap-shell.orders-collapsed .sap-main { grid-column: 1; }
.sap-shell.orders-collapsed .sap-print { grid-column: 2; }
.sap-panel-head {
    height: 43px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 0 12px;
    border-bottom: 1px solid var(--sap-border);
    background: #f7f9fb;
}
.sap-panel-head h2 {
    margin: 0;
    font-size: 13px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .02em;
}
.sap-list {
    min-height: 0;
    overflow: auto;
    padding: 8px;
}
.sap-order-card {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
    border: 1px solid transparent;
    border-radius: 3px;
    background: transparent;
    padding: 9px 8px;
    text-align: left;
    cursor: pointer;
    transition: background .16s ease, border-color .16s ease, transform .12s ease;
}
.sap-order-card:hover { background: var(--sap-row-hover); border-color: #dce8f6; }
.sap-order-card:active { transform: scale(.995); }
.sap-order-card.active {
    background: #eaf4ff;
    border-color: #b8d7f6;
    box-shadow: inset 3px 0 0 var(--sap-blue);
}
.sap-order-name {
    min-width: 0;
    font-size: 13px;
    font-weight: 800;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.sap-order-meta, .sap-muted {
    color: var(--sap-muted);
    font-size: 12px;
    line-height: 1.35;
}
.sap-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 48px;
    height: 22px;
    border-radius: 3px;
    padding: 0 7px;
    font-size: 11px;
    font-weight: 800;
    background: #edf1f5;
    color: #354052;
}
.sap-badge.open { background: #fff3d8; color: var(--sap-orange); }
.sap-badge.locked { background: #e8f5e9; color: var(--sap-green); }
.sap-main {
    grid-row: 2;
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.sap-work-head {
    background: var(--sap-panel);
    border-bottom: 1px solid var(--sap-border);
    padding: 10px 12px;
}
.sap-order-title {
    min-width: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    align-items: start;
}
.sap-order-title h1 {
    margin: 0;
    font-size: 20px;
    line-height: 1.18;
    font-weight: 800;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.sap-order-title p {
    margin: 3px 0 0;
    color: var(--sap-muted);
    font-size: 12px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.sap-metrics {
    display: grid;
    grid-template-columns: repeat(4, minmax(118px, 1fr));
    gap: 8px;
    margin-top: 10px;
}
.sap-metric {
    border: 1px solid var(--sap-border);
    border-radius: 3px;
    background: var(--sap-panel-alt);
    padding: 8px 9px;
    min-width: 0;
}
.sap-metric label {
    display: block;
    font-size: 11px;
    color: var(--sap-muted);
    font-weight: 700;
    margin-bottom: 3px;
}
.sap-metric b {
    display: block;
    font-size: 15px;
    line-height: 1.2;
    font-variant-numeric: tabular-nums;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.sap-tablebar {
    display: grid;
    grid-template-columns: auto minmax(210px, 1fr) auto;
    gap: 8px;
    align-items: center;
    margin-top: 10px;
}
.sap-segment {
    display: inline-flex;
    border: 1px solid var(--sap-border);
    background: #fff;
    border-radius: 3px;
    overflow: hidden;
}
.sap-segment button {
    height: 34px;
    border: 0;
    border-right: 1px solid var(--sap-border);
    background: #fff;
    padding: 0 10px;
    font-size: 12px;
    font-weight: 700;
    color: var(--sap-text);
    white-space: nowrap;
}
.sap-segment button:last-child { border-right: 0; }
.sap-segment button.active { background: #dcecff; color: #063f77; }
.sap-table-wrap {
    min-height: 0;
    overflow: auto;
    background: #fff;
}
.sap-table {
    width: 100%;
    min-width: 1040px;
    border-collapse: collapse;
    table-layout: fixed;
    font-size: 13px;
}
.sap-table th {
    position: sticky;
    top: 0;
    z-index: 5;
    height: 34px;
    background: #edf1f5;
    border-bottom: 1px solid var(--sap-border-dark);
    border-right: 1px solid var(--sap-border);
    color: #384454;
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .02em;
    padding: 0 8px;
    text-align: left;
    user-select: none;
}
.col-resizer {
    position: absolute;
    top: 0;
    right: -4px;
    width: 8px;
    height: 100%;
    cursor: col-resize;
    touch-action: none;
    z-index: 12;
}
.col-resizer::after {
    content: '';
    position: absolute;
    top: 8px;
    bottom: 8px;
    left: 3px;
    width: 2px;
    background: transparent;
}
.col-resizer:hover::after { background: var(--sap-blue); }
.sap-table td {
    height: 44px;
    border-bottom: 1px solid #e5e9ef;
    border-right: 1px solid #eef1f5;
    padding: 6px 8px;
    vertical-align: middle;
    overflow: hidden;
}
.sap-table tr {
    background: var(--sap-row);
    transition: background .18s ease, box-shadow .18s ease;
}
.sap-table tr:hover { background: var(--sap-row-hover); }
.sap-table tr.active { background: #eaf4ff; box-shadow: inset 3px 0 0 var(--sap-blue); }
.sap-table tr.bad { background: #ffe7e7; }
.sap-table tr.warn { background: #fff4cf; }
.sap-table th:last-child,
.sap-table td:last-child {
    position: sticky;
    right: 0;
    z-index: 6;
    background: inherit;
    box-shadow: -1px 0 0 var(--sap-border);
}
.sap-table th:last-child {
    z-index: 8;
    background: #edf1f5;
}
.sap-table td:last-child { padding-left: 5px; padding-right: 5px; }
.sap-cell-title {
    min-width: 0;
    font-weight: 800;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.sap-cell-sub {
    margin-top: 2px;
    color: var(--sap-muted);
    font-size: 11px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.sap-num { text-align: right; font-variant-numeric: tabular-nums; }
.sap-qty {
    display: inline-grid;
    grid-template-columns: 28px 54px 28px;
    gap: 5px;
    align-items: center;
    justify-content: end;
}
.qty-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px solid var(--sap-border-dark);
    background: #fff;
    color: var(--sap-blue);
    font-size: 16px;
    line-height: 1;
    font-weight: 900;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background .16s ease, border-color .16s ease, transform .12s ease;
}
.qty-btn:active { transform: scale(.9); }
.sap-qty input, .sap-price-input {
    height: 30px;
    border: 1px solid var(--sap-border);
    border-radius: 3px;
    background: #fff;
    font-size: 13px;
    font-weight: 700;
    text-align: right;
    padding: 0 7px;
    width: 100%;
}
.sap-qty input { text-align: center; }
.sap-row-actions { display: flex; justify-content: center; gap: 4px; }
.sap-row-actions .sap-btn.icon { width: 28px; height: 28px; }
.sap-row-actions .sap-btn.danger { color: var(--sap-red); }
.sap-print {
    grid-row: 2;
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    background: var(--sap-panel);
    border-left: 1px solid var(--sap-border);
    animation: panelSlide .18s ease-out;
}
.sap-print-body { padding: 12px; min-height: 0; overflow: auto; }
.sap-print-card {
    border: 1px solid var(--sap-border);
    border-radius: 3px;
    background: var(--sap-panel-alt);
    padding: 12px;
}
.sap-field {
    display: grid;
    gap: 4px;
    margin-bottom: 10px;
    font-size: 12px;
    font-weight: 800;
    color: #3c4655;
}
.sap-field input, .sap-field select, .sap-field textarea {
    height: 36px;
    border: 1px solid var(--sap-border-dark);
    border-radius: 3px;
    padding: 0 9px;
    background: #fff;
    color: var(--sap-text);
    font-size: 14px;
    font-weight: 600;
    min-width: 0;
}
.sap-field textarea { min-height: 110px; padding: 8px 9px; resize: vertical; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.sheet-overlay {
    position: fixed;
    inset: 0;
    z-index: 50;
    background: rgba(17,24,39,.42);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 12px;
}
.sheet-panel {
    width: min(1040px, 100%);
    max-height: min(84dvh, 820px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-radius: 8px 8px 0 0;
    background: #fff;
    box-shadow: 0 -20px 70px rgba(15,23,42,.28);
    border: 1px solid var(--sap-border);
    animation: sheetRise .2s ease-out;
}
.sheet-panel.product-sheet {
    height: 75dvh;
    max-height: 75dvh;
}
.dialog-overlay {
    position: fixed;
    inset: 0;
    z-index: 60;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(17,24,39,.42);
}
.quick-print-dialog {
    width: min(760px, 100%);
    overflow: hidden;
    border: 1px solid var(--sap-border-dark);
    border-radius: 6px;
    background: #fff;
    box-shadow: 0 26px 86px rgba(15,23,42,.32);
    animation: dialogIn .18s ease-out;
}
.quick-print-head {
    min-height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--sap-border);
    background: #f7f9fb;
}
.quick-print-head h3 {
    margin: 0;
    font-size: 17px;
    font-weight: 900;
}
.quick-print-body {
    padding: 14px;
}
.quick-print-summary {
    border: 1px solid var(--sap-border);
    border-radius: 3px;
    background: var(--sap-panel-alt);
    padding: 12px;
    margin-bottom: 12px;
}
.quick-print-qty {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 176px;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    padding: 10px 12px;
    border: 1px solid var(--sap-border);
    border-radius: 3px;
    background: #fff;
}
.quick-print-qty label {
    color: var(--sap-muted);
    font-size: 12px;
    font-weight: 900;
}
.quick-print-qty-control {
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr) 36px;
    gap: 6px;
}
.quick-print-qty-control .qty-btn {
    width: 36px;
    height: 36px;
}
.quick-print-qty-control input {
    width: 100%;
    height: 36px;
    border: 1px solid var(--sap-border-dark);
    border-radius: 3px;
    background: #fff;
    text-align: center;
    font-size: 15px;
    font-weight: 900;
}
.quick-print-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}
.quick-print-option {
    min-height: 116px;
    border: 1px solid var(--sap-border-dark);
    border-radius: 4px;
    background: #fff;
    color: var(--sap-text);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 7px;
    text-align: center;
    padding: 12px 8px;
    cursor: pointer;
    transition: background .16s ease, border-color .16s ease, transform .12s ease, box-shadow .16s ease;
}
.quick-print-option:hover {
    background: #f3f8fe;
    border-color: var(--sap-blue);
    box-shadow: inset 0 0 0 1px rgba(10,110,209,.18);
}
.quick-print-option:active { transform: scale(.98); }
.quick-print-option i {
    font-size: 26px;
    color: var(--sap-blue);
}
.quick-print-option span {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 14px;
    font-weight: 900;
}
.quick-print-option small {
    color: var(--sap-muted);
    font-size: 11px;
    font-weight: 800;
}
.quick-print-option.other i { color: var(--sap-muted); }
.sheet-head, .sheet-foot {
    min-height: 52px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--sap-border);
    background: #f7f9fb;
}
.sheet-head h3 { margin: 0; font-size: 16px; font-weight: 900; }
.sheet-body { min-height: 0; overflow: auto; padding: 14px; }
.sheet-body.product-sheet-body {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.sheet-foot { border-top: 1px solid var(--sap-border); border-bottom: 0; }
.product-result {
    width: 100%;
    display: grid;
    grid-template-columns: minmax(0,1fr) auto;
    gap: 10px;
    align-items: center;
    border: 1px solid var(--sap-border);
    border-radius: 3px;
    background: #fff;
    padding: 10px;
    text-align: left;
    transition: background .16s ease, border-color .16s ease, transform .12s ease;
}
.product-result:hover { background: var(--sap-row-hover); border-color: #b8d7f6; }
.product-result.selected {
    background: #eaf4ff;
    border-color: #86bff3;
    box-shadow: inset 3px 0 0 var(--sap-blue);
}
.product-result:active { transform: scale(.995); }
.product-add-grid {
    min-height: 0;
    flex: 1;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 12px;
}
.product-result-list,
.product-selection-panel {
    min-height: 0;
    overflow: auto;
    border: 1px solid var(--sap-border);
    border-radius: 3px;
    background: #fff;
}
.product-result-list {
    display: grid;
    align-content: start;
    gap: 8px;
    padding: 8px;
}
.product-selection-panel {
    display: flex;
    flex-direction: column;
}
.product-selection-head {
    min-height: 42px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 10px;
    border-bottom: 1px solid var(--sap-border);
    background: #f7f9fb;
    font-size: 12px;
    font-weight: 900;
}
.product-selection-list {
    min-height: 0;
    overflow: auto;
    padding: 8px;
    display: grid;
    align-content: start;
    gap: 8px;
}
.selected-product-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 70px 84px 30px;
    gap: 6px;
    align-items: center;
    border: 1px solid var(--sap-border);
    border-radius: 3px;
    padding: 8px;
    background: var(--sap-panel-alt);
    animation: rowIn .16s ease-out;
}
.selected-product-row input {
    height: 30px;
    min-width: 0;
    border: 1px solid var(--sap-border-dark);
    border-radius: 3px;
    padding: 0 7px;
    text-align: right;
    font-weight: 800;
}
.print-type-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}
.print-group-label {
    margin: 12px 0 8px;
    color: var(--sap-muted);
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: .02em;
}
.print-type-btn {
    min-height: 52px;
    border: 1px solid var(--sap-border);
    border-radius: 3px;
    background: #fff;
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 8px;
    text-align: left;
    font-weight: 800;
    transition: background .16s ease, border-color .16s ease, transform .12s ease;
}
.print-type-btn i { color: var(--sap-blue); font-size: 18px; }
.print-type-btn.active {
    background: #eaf4ff;
    border-color: #86bff3;
    box-shadow: inset 3px 0 0 var(--sap-blue);
}
.print-type-btn:active { transform: scale(.985); }
.print-qty-row {
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr) 36px 54px;
    gap: 6px;
    align-items: center;
}
.print-log {
    max-height: 180px;
    overflow: auto;
    display: grid;
    gap: 6px;
}
.print-log-row {
    display: grid;
    grid-template-columns: 22px minmax(0, 1fr);
    gap: 8px;
    align-items: start;
    font-size: 12px;
}
.print-log-row.ok i { color: var(--sap-green); }
.print-log-row.err i { color: var(--sap-red); }
#barcodeModal {
    position: fixed; inset: 0;
    background: black;
    z-index: 2000;
    display: none;
    flex-direction: column;
}
#barcodeModal.visible { display: flex; }
#barcodeVideo { flex: 1; width: 100%; object-fit: cover; background: black; }
.camera-frame {
    position: absolute;
    inset: 32% 8%;
    border: 2px solid rgba(255,255,255,0.85);
    border-radius: 8px;
    box-shadow: 0 0 0 9999px rgba(0,0,0,0.5);
    pointer-events: none;
}
.camera-frame::before, .camera-frame::after {
    content: ''; position: absolute;
    width: 24px; height: 24px;
    border: 3px solid var(--sap-orange);
}
.camera-frame::before { top: -3px; left: -3px; border-right: none; border-bottom: none; }
.camera-frame::after { bottom: -3px; right: -3px; border-left: none; border-top: none; }
.camera-laser {
    position: absolute; left: 0; right: 0; top: 0;
    height: 2px;
    background: var(--sap-red);
    box-shadow: 0 0 12px var(--sap-red);
    animation: laser 1.8s linear infinite;
}
@keyframes laser {
    0% { top: 0; opacity: 1; }
    50% { top: calc(100% - 2px); opacity: 1; }
    50.1% { opacity: 0; }
    51% { top: 0; opacity: 0; }
    51.1% { opacity: 1; }
    100% { top: calc(100% - 2px); opacity: 1; }
}
.camera-overlay {
    position: absolute;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 24px);
    left: 0; right: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    pointer-events: none;
}
.camera-overlay > * { pointer-events: auto; }
.zoom-row { display: flex; gap: 8px; }
.zoom-btn, .camera-close {
    border: 1px solid rgba(255,255,255,.18);
    background: rgba(0,0,0,.52);
    color: #fff;
    backdrop-filter: blur(10px);
    cursor: pointer;
}
.zoom-btn {
    width: 44px; height: 44px;
    border-radius: 50%;
    font-size: 14px;
    font-weight: 800;
}
.zoom-btn.active { color: #ffb84d; border-color: #ffb84d; }
.camera-close {
    min-width: 126px;
    height: 44px;
    border-radius: 999px;
    font-weight: 800;
}
.camera-status {
    position: absolute;
    top: calc(env(safe-area-inset-top,0px) + 18px);
    left: 50%;
    transform: translateX(-50%);
    z-index: 2;
    max-width: min(520px, calc(100% - 32px));
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,.18);
    background: rgba(0,0,0,.52);
    color: white;
    padding: 12px 14px;
    font-size: 13px;
    font-weight: 800;
    text-align: center;
}
.toast {
    position: fixed;
    z-index: 90;
    left: 50%;
    bottom: calc(env(safe-area-inset-bottom,0px) + 18px);
    transform: translateX(-50%);
}
.toast > div {
    border-radius: 3px !important;
    box-shadow: 0 12px 38px rgba(15,23,42,.24);
}
.ok-flash { animation: okFlash .65s ease; }
@keyframes okFlash { 0% { background:#dff6dd; } 100% { background: inherit; } }
@keyframes sheetRise {
    from { transform: translateY(18px); opacity: .88; }
    to { transform: translateY(0); opacity: 1; }
}
@keyframes dialogIn {
    from { transform: translateY(10px) scale(.985); opacity: .86; }
    to { transform: translateY(0) scale(1); opacity: 1; }
}
@keyframes panelSlide {
    from { transform: translateX(20px); opacity: .88; }
    to { transform: translateX(0); opacity: 1; }
}
@keyframes rowIn {
    from { transform: translateY(4px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
@media (max-width: 1180px) {
    .sap-shell,
    .sap-shell.print-open { grid-template-columns: 260px minmax(0,1fr); }
    .sap-shell.orders-collapsed,
    .sap-shell.orders-collapsed.print-open { grid-template-columns: minmax(0,1fr); }
    .sap-print {
        position: fixed;
        top: 56px;
        right: 0;
        bottom: 0;
        width: min(360px, 92vw);
        z-index: 30;
        box-shadow: -18px 0 44px rgba(15,23,42,.18);
    }
    .sap-metrics { grid-template-columns: repeat(2, minmax(120px,1fr)); }
    .sap-tablebar { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
    body { overflow: auto; }
    .sap-shell,
    .sap-shell.print-open,
    .sap-shell.orders-collapsed,
    .sap-shell.orders-collapsed.print-open {
        height: auto;
        min-height: 100dvh;
        grid-template-columns: 1fr;
        grid-template-rows: auto auto auto;
    }
    .sap-topbar {
        grid-template-columns: 1fr;
        align-items: stretch;
        position: sticky;
        top: 0;
        z-index: 20;
    }
    .sap-actions { justify-content: flex-start; }
    .sap-orders {
        grid-row: auto;
        max-height: 38dvh;
        border-right: 0;
        border-bottom: 1px solid var(--sap-border);
    }
    .sap-shell.orders-collapsed .sap-orders { display: none; }
    .sap-main { grid-row: auto; min-height: 68dvh; }
    .sap-order-title { grid-template-columns: 1fr; }
    .sap-metrics { grid-template-columns: repeat(2, minmax(0,1fr)); }
    .sap-table { min-width: 1040px; }
    .product-add-grid { grid-template-columns: 1fr; }
    .product-selection-panel { max-height: 28dvh; }
    .sheet-overlay { padding: 0; }
    .sheet-panel { width: 100%; max-height: 90dvh; border-radius: 12px 12px 0 0; }
    .sheet-panel.product-sheet { height: 75dvh; max-height: 75dvh; }
    .quick-print-dialog { width: 100%; }
    .quick-print-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
}

/* =========================================================
   SAP COMPACT UI CORRECTION
   ========================================================= */
:root {
    --sap-bg: #eef1f5;
    --sap-panel: #ffffff;
    --sap-panel-alt: #f7f9fb;
    --sap-border: #cfd6df;
    --sap-border-dark: #aab4c0;
    --sap-text: #18202b;
    --sap-muted: #5f6b7a;
    --sap-blue: #0a6ed1;
    --sap-green: #107e3e;
    --sap-orange: #b25a00;
    --sap-red: #d20a0a;
    --sap-row-hover: #f3f8fe;
}

body {
    background: var(--sap-bg);
    font-family: Arial, "Helvetica Neue", Helvetica, sans-serif;
}

.sap-shell {
    grid-template-columns: 300px minmax(0, 1fr);
    grid-template-rows: 56px minmax(0, 1fr);
}

.sap-shell.print-open {
    grid-template-columns: 300px minmax(0, 1fr) 360px;
}

.sap-topbar {
    min-height: 56px;
    height: 56px;
    padding: 8px 12px;
    gap: 12px;
    grid-template-columns: auto minmax(240px, 1fr) auto;
    border-bottom: 1px solid var(--sap-border);
    box-shadow: none;
}

.sap-logo {
    color: #e00000;
    font-size: 29px;
    line-height: 1;
    white-space: nowrap;
}

.sap-title {
    min-width: 0;
    padding-left: 8px;
}

.sap-title strong {
    font-size: 14px;
    line-height: 1.1;
}

.sap-title span {
    max-width: 280px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 12px;
}

.sap-shell-status,
.sap-order-amounts {
    display: none !important;
}

.sap-searchbar {
    grid-template-columns: minmax(170px, 1fr) 36px;
    gap: 6px;
}

.sap-input,
.sap-select,
.sap-price-input,
.sap-qty input {
    border-color: var(--sap-border-dark);
    border-radius: 3px;
    background: #fff;
    box-shadow: none;
}

.sap-input,
.sap-select {
    height: 36px;
}

.sap-btn {
    min-height: 36px;
    height: 36px;
    min-width: 36px;
    border-radius: 3px;
    border-color: var(--sap-border-dark);
    padding: 0 10px;
    font-size: 13px;
    box-shadow: none;
}

.sap-btn.icon {
    width: 36px;
    min-width: 36px;
    padding: 0;
}

.sap-btn.primary,
.sap-btn.success {
    background: var(--sap-blue);
    border-color: var(--sap-blue);
}

.sap-btn.ghost {
    background: #fff;
}

.sap-orders {
    background: #f8fafc;
    border-right: 1px solid var(--sap-border);
}

.sap-panel-head {
    height: 43px;
    padding: 0 12px;
    border-bottom: 1px solid var(--sap-border);
    background: #fff;
}

.sap-list {
    padding: 8px;
}

.sap-order-card {
    margin-bottom: 2px;
    padding: 9px 8px;
    border: 1px solid transparent;
    border-radius: 3px;
    background: transparent;
    box-shadow: none;
}

.sap-order-card:hover {
    background: #f0f6fc;
}

.sap-order-card.active {
    background: #eaf4ff;
    border-color: #b8d7f6;
    box-shadow: inset 3px 0 0 var(--sap-blue);
}

.sap-order-name {
    font-size: 13px;
    line-height: 1.25;
}

.sap-main {
    min-width: 0;
}

.sap-work-head {
    padding: 10px 12px;
    background: #fff;
    border-bottom: 1px solid var(--sap-border);
    box-shadow: none;
}

.sap-order-title {
    align-items: flex-start;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
}

.sap-order-title h1 {
    font-size: 20px;
    line-height: 1.2;
    letter-spacing: 0;
}

.sap-order-title .sap-actions {
    align-items: center;
    gap: 6px;
}

.sap-order-title .sap-actions .sap-btn:nth-child(1) { order: 1; }
.sap-order-title .sap-actions .sap-btn:nth-child(3) { order: 2; }
.sap-order-title .sap-actions .sap-btn:nth-child(4) { order: 3; }
.sap-order-title .sap-actions .sap-btn:nth-child(2) { order: 4; min-width: 124px; }

.sap-metrics {
    grid-template-columns: repeat(4, minmax(108px, 1fr));
    gap: 8px;
    margin-top: 10px;
}

.sap-metric {
    padding: 8px 9px;
    border-color: var(--sap-border);
    border-radius: 3px;
    background: var(--sap-panel-alt);
    box-shadow: none;
}

.sap-metric label {
    color: var(--sap-muted);
    font-size: 11px;
    letter-spacing: 0;
    text-transform: none;
}

.sap-metric b {
    font-size: 18px;
    line-height: 1.2;
}

.sap-tablebar {
    margin-top: 10px;
    gap: 8px;
    grid-template-columns: auto minmax(210px, 330px) auto;
    align-items: center;
}

.sap-segment {
    height: 36px;
    padding: 0;
    border: 1px solid var(--sap-border);
    border-radius: 3px;
    background: #f7f9fb;
    overflow-x: auto;
}

.sap-segment button {
    min-height: 34px;
    padding: 0 12px;
    border-radius: 2px;
    font-weight: 700;
}

.sap-segment button.active {
    background: var(--sap-blue);
    color: #fff;
    box-shadow: none;
}

.sap-table-wrap {
    padding: 0;
    overflow-x: hidden;
    overflow-y: auto;
    background: #fff;
}

.sap-table {
    width: 100%;
    min-width: 0;
    border: 0;
    border-radius: 0;
    border-collapse: collapse;
    border-spacing: 0;
    background: #fff;
    table-layout: fixed;
}

.sap-table th {
    position: sticky;
    top: 0;
    z-index: 2;
    height: 38px;
    background: #f7f9fb;
    border-bottom: 1px solid var(--sap-border);
}

.sap-table td {
    height: 48px;
    min-height: 48px;
    padding: 7px 6px;
    overflow: hidden;
}

.sap-table tbody tr {
    border-left: 0;
}

.sap-table tbody tr:hover {
    background: var(--sap-row-hover);
}

.sap-table tbody tr.active {
    background: #eaf4ff !important;
    box-shadow: inset 4px 0 0 var(--sap-blue);
}

.sap-table tbody tr.bad {
    background: #fffafa;
    box-shadow: inset 4px 0 0 var(--sap-red);
}

.sap-table tbody tr.warn {
    background: #fffaf0;
    box-shadow: inset 4px 0 0 var(--sap-orange);
}

.sap-cell-title {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 13px;
    line-height: 1.25;
}

.sap-cell-sub {
    font-size: 11px;
}

.sap-badge {
    min-width: 48px;
    border-radius: 3px;
}

.sap-qty {
    grid-template-columns: 28px minmax(38px, 1fr) 28px;
    gap: 4px;
}

.qty-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #fff;
    font-size: 15px;
}

.sap-qty input,
.sap-price-input {
    height: 28px;
    border-radius: 3px;
    font-size: 13px;
}

.sap-row-actions {
    gap: 4px;
    flex-wrap: nowrap;
}

.sap-row-actions .sap-btn.icon {
    width: 28px;
    min-width: 28px;
    min-height: 28px;
    height: 28px;
}

.sap-print {
    background: #fff;
    box-shadow: none;
    border-left: 1px solid var(--sap-border);
}

.sap-print-body {
    padding: 12px;
}

.sap-print-card {
    border-color: var(--sap-border);
    border-radius: 3px;
    background: var(--sap-panel-alt);
    box-shadow: none;
}

.print-type-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
}

.print-type-btn {
    min-height: 38px;
    border-radius: 3px;
    background: #fff;
}

.print-type-btn.active {
    background: #eaf4ff;
    border-color: var(--sap-blue);
    color: var(--sap-blue);
}

.print-favorite-actions {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid var(--sap-border);
}

.print-qty-row {
    grid-template-columns: 36px minmax(0, 1fr) 36px 52px;
}

.print-qty-row input {
    height: 36px;
    border-radius: 3px;
}

.sheet-overlay,
.dialog-overlay {
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
}

.sheet-panel {
    border-radius: 8px 8px 0 0;
    box-shadow: 0 -18px 60px rgba(16,24,40,.22);
}

.sheet-head,
.sheet-foot {
    min-height: 52px;
}

.product-result,
.quick-print-dialog,
.quick-print-option {
    border-radius: 4px;
}

.quick-print-option {
    min-height: 108px;
}

.toast > div {
    border-radius: 4px !important;
}

@media (max-width: 1180px) {
    .sap-shell,
    .sap-shell.print-open {
        grid-template-columns: 290px minmax(0,1fr);
    }

    .sap-shell.print-open .sap-print {
        position: fixed;
        top: 56px;
        right: 0;
        bottom: 0;
        z-index: 50;
        width: min(360px, 92vw);
        border-left: 1px solid var(--sap-border);
    }

    .sap-title span,
    .sap-topbar .sap-actions .sap-btn span {
        display: none;
    }
}

@media (max-width: 900px) {
    html,
    body {
        overflow-x: hidden;
        background: var(--sap-bg);
    }

    .sap-shell,
    .sap-shell.print-open,
    .sap-shell.orders-collapsed,
    .sap-shell.orders-collapsed.print-open {
        grid-template-columns: 1fr;
        grid-template-rows: auto minmax(0, 1fr);
        min-height: 100dvh;
    }

    .sap-shell:not(.orders-collapsed)::before {
        content: '';
        position: fixed;
        inset: 0;
        z-index: 50;
        background: rgba(15, 23, 42, .34);
    }

    .sap-topbar {
        position: sticky;
        top: 0;
        z-index: 70;
        height: auto;
        min-height: 54px;
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 7px 8px;
        padding: 7px 8px;
        background: #fff;
    }

    .sap-brand {
        min-width: 0;
        gap: 8px;
    }

    .sap-brand .sap-btn.icon {
        width: 34px;
        min-width: 34px;
        height: 34px;
        min-height: 34px;
    }

    .sap-logo {
        font-size: 23px;
        max-width: 128px;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .sap-title {
        padding-left: 6px;
    }

    .sap-title strong {
        font-size: 13px;
    }

    .sap-title span {
        display: none;
    }

    .sap-topbar > .sap-searchbar {
        grid-column: 1 / -1;
        grid-row: 2;
        width: 100%;
        grid-template-columns: minmax(0, 1fr) 36px;
    }

    .sap-topbar > .sap-actions {
        justify-content: flex-end;
        gap: 4px;
    }

    .sap-topbar > .sap-actions .sap-btn {
        width: 34px;
        min-width: 34px;
        height: 34px;
        min-height: 34px;
        padding: 0;
        overflow: hidden;
        font-size: 0;
    }

    .sap-topbar > .sap-actions .sap-btn i {
        margin: 0;
        font-size: 16px;
    }

    .sap-topbar .sap-input,
    .sap-topbar .sap-select {
        height: 36px;
    }

    .sap-orders {
        position: fixed;
        top: 104px;
        left: 0;
        bottom: 0;
        z-index: 60;
        width: min(330px, 88vw);
        max-height: none;
        border-right: 1px solid var(--sap-border);
        border-bottom: 0;
        background: #fff;
        box-shadow: 18px 0 42px rgba(15, 23, 42, .22);
        transform: translateX(0);
        transition: transform .18s ease;
    }

    .sap-shell.orders-collapsed .sap-orders {
        display: block;
        transform: translateX(-105%);
        box-shadow: none;
    }

    .sap-main {
        grid-row: 2;
        min-width: 0;
        min-height: 0;
    }

    .sap-work-head {
        padding: 8px;
        background: #fff;
        border-bottom: 1px solid var(--sap-border);
    }

    .sap-order-title {
        grid-template-columns: 1fr;
        gap: 7px;
        align-items: stretch;
    }

    .sap-order-title .sap-muted {
        display: none;
    }

    .sap-order-title h1 {
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        font-size: 18px;
        line-height: 1.15;
    }

    .sap-order-title p {
        margin-top: 2px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        font-size: 11px;
    }

    .sap-order-title .sap-actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 6px;
    }

    .sap-order-title .sap-actions .sap-btn {
        width: 100%;
        min-width: 0;
        height: 36px;
        min-height: 36px;
        justify-content: center;
        padding: 0 8px;
        font-size: 12px;
    }

    .sap-metrics {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 6px;
        margin-top: 8px;
    }

    .sap-metric {
        min-height: 45px;
        padding: 6px 8px;
    }

    .sap-metric label {
        font-size: 10px;
    }

    .sap-metric b {
        font-size: 15px;
    }

    .sap-tablebar {
        grid-template-columns: 1fr;
        gap: 6px;
        margin-top: 8px;
    }

    .sap-segment {
        width: 100%;
        height: 34px;
    }

    .sap-segment button {
        min-height: 32px;
        padding: 0 9px;
        font-size: 12px;
    }

    .sap-tablebar > .sap-searchbar {
        width: 100%;
        grid-template-columns: minmax(0, 1fr) 36px;
    }

    .sap-tablebar .sap-muted {
        text-align: left;
        font-size: 11px;
    }

    .sap-print {
        position: fixed;
        top: auto !important;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 80;
        width: 100% !important;
        max-height: 78dvh;
        border-top: 1px solid var(--sap-border);
        border-left: 0;
        border-radius: 8px 8px 0 0;
        box-shadow: 0 -18px 46px rgba(15, 23, 42, .24);
    }

    .quick-print-dialog {
        width: min(94vw, 520px);
    }

    .quick-print-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }

    .quick-print-option {
        min-height: 96px;
    }
}

@media (max-width: 720px) {
    .sap-table-wrap {
        padding: 8px;
        overflow-x: hidden;
        overflow-y: auto;
        background: var(--sap-bg);
    }

    .sap-table {
        display: block;
        width: 100%;
        min-width: 0 !important;
        border: 0;
        background: transparent;
    }

    .sap-table colgroup,
    .sap-table thead {
        display: none;
    }

    .sap-table tbody {
        display: grid;
        gap: 8px;
    }

    .sap-table tr {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 7px 8px;
        padding: 10px;
        border: 1px solid var(--sap-border);
        border-left: 4px solid transparent;
        border-radius: 5px;
        background: #fff;
        box-shadow: none;
    }

    .sap-table tr.active {
        background: #f4f9ff !important;
        border-left-color: var(--sap-blue);
        box-shadow: none;
    }

    .sap-table tr.bad {
        border-left-color: var(--sap-red);
    }

    .sap-table tr.warn {
        border-left-color: var(--sap-orange);
    }

    .sap-table td {
        display: block;
        min-height: 0;
        height: auto;
        padding: 0;
        border: 0;
        overflow: visible;
        text-align: left !important;
    }

    .sap-table td::before {
        display: block;
        margin-bottom: 2px;
        color: var(--sap-muted);
        font-size: 10px;
        font-weight: 800;
        line-height: 1.1;
        text-transform: uppercase;
    }

    .sap-table td:nth-child(1) {
        display: none;
    }

    .sap-table td:nth-child(2) {
        grid-column: 1 / -1;
        padding-bottom: 7px;
        border-bottom: 1px solid #edf1f5;
    }

    .sap-table td:nth-child(2)::before {
        display: none;
    }

    .sap-table td:nth-child(3) {
        grid-column: 1 / -1;
        overflow: hidden;
        color: var(--sap-muted);
        font-size: 11px;
    }

    .sap-table td:nth-child(3)::before { content: 'Barkod'; }
    .sap-table td:nth-child(4)::before { content: 'Stok'; }
    .sap-table td:nth-child(5)::before { content: 'Sipariş'; }
    .sap-table td:nth-child(7)::before { content: 'Fiyat'; }
    .sap-table td:nth-child(8)::before { content: 'Tutar'; }

    .sap-table td:nth-child(4),
    .sap-table td:nth-child(5),
    .sap-table td:nth-child(7),
    .sap-table td:nth-child(8) {
        min-width: 0;
        padding: 6px;
        border: 1px solid #edf1f5;
        border-radius: 3px;
        background: #f8fafc;
        font-size: 13px;
    }

    .sap-table td:nth-child(6) {
        grid-column: 1 / -1;
        display: grid;
        grid-template-columns: 48px minmax(0, 1fr);
        align-items: center;
        gap: 8px;
        padding: 7px 0;
    }

    .sap-table td:nth-child(6)::before {
        content: 'Gelen';
        margin: 0;
    }

    .sap-table td:nth-child(9) {
        grid-column: 1 / -1;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
        padding-top: 8px;
        border-top: 1px solid #edf1f5;
    }

    .sap-table td:nth-child(9)::before {
        content: 'İşlem';
        margin: 0;
    }

    .sap-cell-title {
        white-space: normal;
        font-size: 14px;
        line-height: 1.25;
    }

    .sap-cell-sub {
        font-size: 11px;
    }

    .sap-qty {
        grid-template-columns: 42px minmax(0, 1fr) 42px;
        width: 100%;
    }

    .qty-btn {
        width: 42px;
        height: 42px;
    }

    .sap-qty input,
    .sap-price-input {
        height: 42px;
        font-size: 15px;
    }

    .sap-row-actions {
        margin-left: auto;
        justify-content: flex-end;
    }

    .sap-row-actions .sap-btn.icon {
        width: 42px;
        min-width: 42px;
        min-height: 42px;
        height: 42px;
    }

    .quick-print-qty {
        grid-template-columns: 1fr;
    }

    .quick-print-qty-control {
        grid-template-columns: 42px minmax(0, 1fr) 42px;
    }

    .quick-print-qty-control .qty-btn,
    .quick-print-qty-control input {
        height: 42px;
    }

    .quick-print-qty-control .qty-btn {
        width: 42px;
    }
}

@media (max-width: 420px) {
    .sap-logo {
        max-width: none;
        font-size: 23px;
    }

    .sap-title {
        display: none;
    }

    .sap-topbar > .sap-actions .sap-btn {
        width: 32px;
        min-width: 32px;
    }

    .sap-order-title .sap-actions {
        grid-template-columns: 1fr 1fr;
    }

    .sap-metrics {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .sap-table tr {
        padding: 9px;
    }
}

/* Mobile table simplification: product cards should read like work items, not nested tables. */
@media (max-width: 720px) {
    .sap-metrics {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .sap-metric {
        min-height: 42px;
        padding: 5px 6px;
    }

    .sap-metric label {
        font-size: 9px;
        line-height: 1.05;
    }

    .sap-metric b {
        font-size: 13px;
        line-height: 1.15;
    }

    .sap-table-wrap {
        padding: 6px;
    }

    .sap-table tbody {
        gap: 6px;
    }

    .sap-table tr {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 6px 8px;
        padding: 9px;
        border-radius: 4px;
    }

    .sap-table td::before {
        display: inline;
        margin: 0 5px 0 0;
        font-size: 9px;
        line-height: 1;
    }

    .sap-table td:nth-child(2) {
        padding-bottom: 4px;
        border-bottom: 1px solid #edf1f5;
    }

    .sap-table td:nth-child(3) {
        grid-column: 1 / -1;
        padding-bottom: 2px;
        font-size: 10px;
        line-height: 1.25;
    }

    .sap-table td:nth-child(3)::before {
        content: 'Barkod';
    }

    .sap-table td:nth-child(4),
    .sap-table td:nth-child(5),
    .sap-table td:nth-child(8) {
        display: flex;
        align-items: center;
        justify-content: space-between;
        min-height: 24px;
        padding: 0;
        border: 0;
        background: transparent;
        font-size: 12px;
    }

    .sap-table td:nth-child(6) {
        grid-column: 1 / -1;
        grid-template-columns: 42px minmax(0, 1fr);
        gap: 6px;
        padding: 2px 0;
    }

    .sap-table td:nth-child(7) {
        display: grid;
        gap: 3px;
        padding: 0;
        border: 0;
        background: transparent;
    }

    .sap-table td:nth-child(9) {
        grid-column: 1 / -1;
        justify-content: flex-end;
        padding-top: 6px;
        border-top: 1px solid #edf1f5;
    }

    .sap-table td:nth-child(9)::before {
        display: none;
    }

    .sap-cell-title {
        font-size: 14px;
    }

    .sap-cell-sub {
        font-size: 10px;
    }

    .sap-qty {
        grid-template-columns: 36px minmax(0, 1fr) 36px;
        gap: 5px;
    }

    .qty-btn,
    .sap-row-actions .sap-btn.icon {
        width: 36px;
        min-width: 36px;
        height: 36px;
        min-height: 36px;
    }

    .sap-qty input,
    .sap-price-input {
        height: 36px;
        font-size: 14px;
    }

    .sap-row-actions {
        gap: 5px;
    }
}

@media (max-width: 360px) {
    .sap-metrics {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .sap-order-title .sap-actions .sap-btn {
        font-size: 11px;
    }
}

/* Mobile header compression pass. */
@media (max-width: 720px) {
    .sap-order-title .sap-actions {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 5px;
    }

    .sap-order-title .sap-actions .sap-btn {
        height: 34px;
        min-height: 34px;
        padding: 0 4px;
        gap: 3px;
        font-size: 0;
    }

    .sap-order-title .sap-actions .sap-btn i {
        margin: 0;
        font-size: 15px;
    }

    .sap-order-title .sap-actions .sap-btn::after {
        font-size: 11px;
        font-weight: 800;
        line-height: 1;
    }

    .sap-order-title .sap-actions .sap-btn:nth-child(1)::after { content: 'Ürün'; }
    .sap-order-title .sap-actions .sap-btn:nth-child(2)::after { content: 'ERP'; }
    .sap-order-title .sap-actions .sap-btn:nth-child(3)::after { content: 'Liste'; }
    .sap-order-title .sap-actions .sap-btn:nth-child(4)::after { content: 'Excel'; }

    .sap-metrics {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .sap-metric {
        min-height: 38px;
    }
}

@media (max-width: 360px) {
    .sap-metrics {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .sap-metric label {
        font-size: 8px;
    }

    .sap-metric b {
        font-size: 12px;
    }
}

@media (max-width: 720px) {
    .sap-order-title .sap-actions .sap-btn {
        min-width: 0 !important;
        overflow: hidden;
        white-space: nowrap;
    }
}

/* Mobile sticky filters and compact editable card controls. */
.sap-main > .sap-tablebar {
    margin-top: 0;
    padding: 10px 12px;
    border-bottom: 1px solid var(--sap-border);
    background: #fff;
}

@media (max-width: 900px) {
    .sap-main > .sap-tablebar {
        position: sticky;
        top: 0;
        z-index: 75;
        padding: 6px 8px;
        box-shadow: 0 2px 8px rgba(15, 23, 42, .08);
    }
}

@media (max-width: 720px) {
    .sap-table-wrap {
        padding-top: 6px;
    }

    .sap-table tr {
        gap: 5px 8px;
        padding: 8px;
    }

    .sap-table td:nth-child(2) {
        padding-bottom: 3px;
    }

    .sap-table td:nth-child(3) {
        padding-bottom: 0;
    }

    .sap-table td:nth-child(6) {
        grid-column: auto;
        display: grid;
        grid-template-columns: 1fr;
        align-content: start;
        gap: 3px;
        padding: 0;
    }

    .sap-table td:nth-child(6)::before {
        content: 'Gelen';
        display: block;
        margin: 0;
    }

    .sap-table td:nth-child(7) {
        display: grid;
        align-content: start;
        gap: 3px;
    }

    .sap-table td:nth-child(7)::before {
        content: 'Fiyat';
        display: block;
        margin: 0;
    }

    .sap-table td:nth-child(8) {
        min-height: 22px;
        font-size: 12px;
    }

    .sap-table td:nth-child(9) {
        grid-column: auto;
        align-items: end;
        justify-content: flex-end;
        padding-top: 0;
        border-top: 0;
    }

    .sap-qty {
        grid-template-columns: 30px minmax(0, 1fr) 30px;
        gap: 4px;
    }

    .qty-btn,
    .sap-row-actions .sap-btn.icon {
        width: 30px;
        min-width: 30px;
        height: 30px;
        min-height: 30px;
    }

    .sap-qty input,
    .sap-price-input {
        height: 30px;
        font-size: 13px;
    }

    .sap-row-actions {
        gap: 4px;
    }
}

@media (max-width: 720px) {
    .sap-table td:nth-child(2) { order: 1; }
    .sap-table td:nth-child(3) { order: 2; }
    .sap-table td:nth-child(4) { order: 3; }
    .sap-table td:nth-child(5) { order: 4; }
    .sap-table td:nth-child(7) { order: 5; }
    .sap-table td:nth-child(6) { order: 6; }
    .sap-table td:nth-child(8) { order: 7; }
    .sap-table td:nth-child(9) { order: 8; }
}

@media (max-width: 480px) {
    .sap-topbar {
        grid-template-columns: 36px minmax(0, 1fr);
        grid-template-rows: auto auto auto;
        gap: 6px;
    }

    .sap-brand {
        display: contents;
    }

    .sap-brand > .sap-btn.icon {
        grid-column: 1;
        grid-row: 2;
        width: 34px;
        min-width: 34px;
        height: 34px;
        min-height: 34px;
    }

    .sap-logo {
        grid-column: 1 / -1;
        grid-row: 1;
        max-width: none;
        overflow: visible;
        text-overflow: clip;
        white-space: nowrap;
        font-size: 24px;
    }

    .sap-title {
        display: none;
    }

    .sap-topbar > .sap-actions {
        grid-column: 2;
        grid-row: 2;
        width: 100%;
        justify-content: flex-start;
        flex-wrap: nowrap;
    }

    .sap-topbar > .sap-searchbar {
        grid-column: 1 / -1;
        grid-row: 3;
    }

    .sap-shell,
    .sap-main,
    .sap-work-head,
    .sap-main > .sap-tablebar,
    .sap-table-wrap,
    .sap-table,
    .sap-table tbody,
    .sap-table tr {
        max-width: 100vw;
        box-sizing: border-box;
    }

    .sap-main,
    .sap-work-head,
    .sap-main > .sap-tablebar,
    .sap-table-wrap {
        overflow-x: hidden;
    }

    .sap-table td,
    .sap-qty,
    .sap-price-input {
        min-width: 0;
    }
}

@media (max-width: 900px) {
    .sap-main > .sap-tablebar {
        top: 0 !important;
        z-index: 40 !important;
        overflow: visible !important;
    }

    .sap-main {
        overflow: visible !important;
    }

    .sheet-overlay,
    .dialog-overlay {
        z-index: 3000 !important;
    }

    body.filter-pinned .sap-main > .sap-tablebar {
        position: fixed;
        top: 0 !important;
        left: 0;
        right: 0;
        z-index: 40 !important;
        width: 100vw;
        margin: 0;
        border-top: 0;
        box-shadow: 0 2px 10px rgba(15, 23, 42, .14);
    }

    body.filter-pinned .sap-table-wrap {
        padding-top: 92px;
    }
}

/* Mobile readability pass: larger table text and editable values. */
@media (max-width: 720px) {
    .sap-table {
        font-size: 14px;
    }

    .sap-cell-title {
        font-size: 16px;
        font-weight: 900;
    }

    .sap-cell-sub,
    .sap-table td:nth-child(3) {
        font-size: 12px;
    }

    .sap-table td::before {
        font-size: 10px;
        font-weight: 900;
    }

    .sap-table td:nth-child(4),
    .sap-table td:nth-child(5),
    .sap-table td:nth-child(8) {
        font-size: 14px;
        font-weight: 900;
    }

    .sap-qty {
        grid-template-columns: 34px minmax(0, 1fr) 34px;
    }

    .qty-btn,
    .sap-row-actions .sap-btn.icon {
        width: 34px;
        min-width: 34px;
        height: 34px;
        min-height: 34px;
        font-size: 16px;
    }

    .sap-qty input,
    .sap-price-input {
        height: 34px;
        font-size: 16px;
        font-weight: 900;
    }
}
