.daily-orders{max-width:1200px;margin:auto;padding:32px}.daily-orders header{margin-bottom:28px}.daily-orders .actions{display:flex;gap:16px;align-items:center;flex-wrap:wrap}.daily-orders input{max-width:420px;flex:1;min-width:200px}.daily-order{background:white;border:1px solid #d7e4df;border-radius:16px;padding:20px;margin:14px 0;display:grid;gap:12px}.daily-order header{margin:0;display:flex;gap:20px;justify-content:space-between}.daily-order p{margin:0}.daily-order button{min-height:44px}.daily-orders dialog{width:min(860px,94vw);max-height:85vh;overflow:auto;border:1px solid #cbded6;border-radius:16px;padding:24px}.daily-orders dialog::backdrop{background:#143f3566}.daily-orders table{width:100%;border-collapse:collapse}.daily-orders td,.daily-orders th{padding:10px;text-align:right;border-bottom:1px solid #e4ece8}.daily-orders .warning{color:#a04219}.daily-orders .actions button:first-of-type{background:#0e6658;color:white}.daily-orders button:disabled{opacity:.5}

#editor select{max-width:100%;padding:10px}#editor input[type=number]{min-width:80px;width:120px}#edit-options label{display:grid;gap:8px}#edit-message{color:#9c4319}
#editor .editor-suggestions{position:fixed;z-index:20;overflow:auto;background:white;border:1px solid #9abbb0;border-radius:8px;box-shadow:0 8px 24px #102f2930;padding:4px;text-align:right;font-size:13px}
#editor .editor-suggestion{padding:10px 12px;min-height:44px;cursor:pointer;border-radius:5px;white-space:normal;overflow-wrap:anywhere}
#editor .editor-suggestion:hover,#editor .editor-suggestion[aria-selected=true]{background:#e1f1ea;color:#084e3e}
#editor .editor-no-result{padding:14px;color:#60746f}
#editor input[role=combobox]{min-width:0;max-width:none;width:100%;cursor:text}
#editor .editor-grid input[role=combobox]{width:145px;text-align:right;direction:rtl;font-size:12px}
#editor .editor-product-bar{grid-template-columns:minmax(200px,1fr) auto}

.daily-orders #editor{width:calc(100vw - 32px);max-width:1800px;height:calc(100dvh - 32px);max-height:none;padding:0;overflow:hidden;border-radius:14px;color:var(--ink)}
#editor[open]{display:flex;flex-direction:column}
#editor .editor-toolbar{display:flex;align-items:center;gap:20px;margin:0;padding:16px 24px;border-bottom:1px solid var(--line);background:#f4f9f7;flex-shrink:0}
#editor h2{margin:0;font-size:22px}#editor h3{margin:0 0 14px;font-size:15px}#editor h3 small{font-size:11px;font-weight:400;color:var(--muted)}
.editor-eyebrow{font-size:11px;color:var(--muted)}.editor-badge{background:#e3efea;color:#245547;border-radius:20px;padding:5px 14px;font-size:12px;margin-inline-start:auto}
.editor-content{min-height:0;flex:1;overflow:auto;padding:20px;background:#f5f7f8}
.editor-header-grid{display:grid;grid-template-columns:minmax(0,3fr) minmax(250px,1fr);gap:16px;margin-bottom:16px}
.editor-section{background:white;border:1px solid var(--line);border-radius:10px;padding:18px;min-width:0}
#edit-info{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:14px 20px;margin-bottom:20px}
.editor-field{display:flex;flex-direction:column;gap:4px;min-width:0}.editor-field>span{font-size:11px;color:var(--muted)}.editor-field>strong{font-size:14px;font-weight:600;overflow-wrap:anywhere}
#edit-options{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:16px}#edit-options label{font-size:12px;font-weight:600}#editor select{border:1px solid #cadbd4;border-radius:8px;min-height:42px;background:white;color:var(--ink);font:inherit;width:100%}
#edit-credit{display:grid;gap:9px}#edit-credit .editor-field{flex-direction:row;justify-content:space-between;align-items:center;gap:14px}#edit-credit strong{font-variant-numeric:tabular-nums;white-space:nowrap}.editor-credit p{font-size:11px;color:var(--muted);margin-bottom:0}
.editor-section-title{display:flex;justify-content:space-between;align-items:center;gap:12px}.editor-section-title>span{font-size:11px;color:var(--muted);direction:rtl}
.editor-product-bar{display:grid;grid-template-columns:minmax(180px,1fr) minmax(200px,2fr) auto;gap:12px;align-items:end;margin:0 0 16px}.editor-product-bar label{display:grid;gap:5px;font-size:12px}#editor .editor-product-bar input{max-width:none;min-width:0;width:100%}
#edit-lines{overflow:auto;max-height:42vh;border:1px solid var(--line);border-radius:8px}#editor .editor-grid{min-width:1420px;width:100%;font-size:12px;border-collapse:separate;border-spacing:0}#editor .editor-grid th{position:sticky;top:0;z-index:1;background:#eaf2ee;color:#325b4e;white-space:nowrap;font-size:11px;padding:12px 10px}#editor .editor-grid td{padding:8px 10px;white-space:nowrap;font-variant-numeric:tabular-nums;border-bottom:1px solid var(--line)}#editor .editor-grid tr:nth-child(even){background:#fafcfb}#editor .editor-grid .product-name{min-width:220px;max-width:290px;white-space:normal;font-weight:600}#editor .editor-grid small{display:block;color:var(--muted);font-size:10px}#editor .editor-grid input{width:95px;min-width:80px;min-height:40px;padding:7px;text-align:center;direction:ltr;font-size:14px}#editor .editor-grid select{width:130px;min-height:40px;padding:5px;font-size:12px}#editor .editor-grid button{padding:6px 10px;font-size:12px;min-height:40px;background:#fff1ed;color:#9b3f25}.stock-warning [data-stock]{color:#a04023;font-weight:700}#editor input[aria-invalid=true]{border-color:#b43232;background:#fff2f2}
#edit-gifts{display:flex;flex-wrap:wrap;gap:8px;margin-top:12px}.gift-chip{background:#edf7ec;color:#31643a;padding:6px 12px;border-radius:8px;font-size:12px}
.editor-status{padding:12px 0;font-size:12px;color:#176047}.editor-status.stale{color:#8b5b15}#edit-warnings{color:#9c4319;font-size:12px}#edit-warnings p{margin:4px 0}
#edit-totals{display:grid;grid-template-columns:repeat(6,minmax(0,1fr));gap:12px;padding:16px;background:white;border:1px solid var(--line);border-radius:10px}#edit-totals .editor-field:last-child strong{font-size:21px;color:#0e6658}
.editor-footer{display:flex;align-items:center;justify-content:space-between;gap:20px;padding:14px 24px;border-top:1px solid var(--line);background:white;flex-shrink:0}.editor-footer p{margin:0;font-size:12px}.editor-footer small{font-size:10px;color:var(--muted)}.editor-footer-actions{display:flex;gap:10px;flex-shrink:0}.editor-footer button{white-space:nowrap}
@media(max-width:1000px){.editor-header-grid{grid-template-columns:1fr}.editor-credit #edit-credit{grid-template-columns:1fr 1fr}#edit-totals{grid-template-columns:repeat(3,minmax(0,1fr))}.editor-footer{align-items:stretch;flex-direction:column;gap:10px}.editor-footer-actions{justify-content:flex-end}}
@media(max-width:600px){.daily-orders #editor{width:100vw;height:100dvh;border-radius:0;border:0}#editor .editor-toolbar{padding:12px;gap:8px}#editor h2{font-size:17px}.editor-badge{font-size:10px;padding:4px 8px}.editor-content{padding:10px}.editor-section{padding:12px}#edit-info,#edit-options{grid-template-columns:1fr 1fr}.editor-product-bar{grid-template-columns:1fr}.editor-credit #edit-credit{grid-template-columns:1fr}.editor-footer{padding:10px}.editor-footer-actions button{flex:1;font-size:12px;padding:10px}.editor-section-title{align-items:start;flex-direction:column;margin-bottom:10px}}

/* Official discount accounts: amount in rials, percent of gross. */
#editor .editor-grid{min-width:1780px}#editor [data-discount]{background:#f2f8f5}#edit-totals{grid-template-columns:repeat(5,minmax(0,1fr))}@media(max-width:1000px){#edit-totals{grid-template-columns:repeat(3,minmax(0,1fr))}}@media(max-width:600px){#edit-totals{grid-template-columns:repeat(2,minmax(0,1fr))}}

/* Request register: selectable master rows with their item detail below. */
.daily-orders{max-width:none;padding:18px 24px;color:var(--ink,#183e35)}
.daily-orders .orders-heading{display:flex;justify-content:space-between;align-items:center;gap:16px;margin-bottom:16px}
.orders-heading h1{font-size:24px;margin:6px 0}.orders-heading a,.orders-context{font-size:12px;color:#496c61}
.orders-commandbar{display:flex;align-items:center;flex-wrap:wrap;gap:8px;background:white;border:1px solid var(--line,#d7e4df);border-radius:10px;padding:10px}
.orders-commandbar button{min-height:44px;padding:8px 18px;font-size:13px;border:1px solid #c8dbd2;background:white;color:#214f40;border-radius:7px}
.orders-commandbar #edit-request{background:#106858;color:white;border-color:#106858}.orders-commandbar #refresh{margin-inline-start:auto}.orders-commandbar .danger{color:#a33c2d}
.orders-commandbar button:disabled{opacity:1;background:#eff2f0;color:#697b74;border-color:#d8e2dd;cursor:not-allowed}
.orders-filter{display:flex;align-items:center;gap:14px;flex-wrap:wrap;padding:14px 0 0}.orders-filter label{font-size:13px}.daily-orders .orders-filter input{min-height:44px;font-size:13px;max-width:440px}.orders-filter #count{margin-inline-start:auto;font-size:13px}
.orders-note{font-size:12px;color:#77551b;margin:6px 0 14px}.daily-orders #message:empty{display:none}.daily-orders #message{color:#a04219;font-size:13px}
.orders-panel{border:1px solid #cbdcd4;border-radius:10px;overflow:hidden;background:white;margin-bottom:16px;min-width:0}
.panel-title{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:10px 14px;background:#f5f8f6;border-bottom:1px solid #d7e4df}.panel-title h2{font-size:14px;margin:0}.panel-title span{font-size:12px;color:#4c6a5f}
.orders-grid-scroll{overflow:auto;max-height:34vh;min-height:130px;scrollbar-gutter:stable}.detail-panel .orders-grid-scroll{max-height:38vh;min-height:190px}
.daily-orders .request-grid,.daily-orders .request-lines-grid{font-size:12px;white-space:nowrap;border-collapse:separate;border-spacing:0;width:100%;min-width:1250px}
.daily-orders .request-lines-grid{min-width:1450px}.daily-orders .request-grid th,.daily-orders .request-lines-grid th{position:sticky;top:0;z-index:1;background:#eaf2ee;padding:9px 12px;border-bottom:1px solid #bfd2c8;color:#315448}
.daily-orders .request-grid td,.daily-orders .request-lines-grid td{padding:9px 12px;border-bottom:1px solid #e3ebe6;border-inline-end:1px solid #edf1ee;font-variant-numeric:tabular-nums}
.request-grid th button{border:0;border-radius:0;background:transparent;color:inherit;font:inherit;font-weight:600;white-space:nowrap;padding:4px;min-height:32px}
.request-grid tbody tr{cursor:pointer}.request-grid tbody tr:nth-child(even),.request-lines-grid tbody tr:nth-child(even){background:#f8faf9}.request-grid tbody tr:hover{background:#edf5f1}.request-grid tbody tr.selected{background:#dceee6;box-shadow:inset -3px 0 #13735d}
.request-grid .row-select{border:0;background:transparent;color:#154c3b;padding:0 8px;min-height:32px;font:inherit;font-weight:700;text-decoration:underline;text-underline-offset:3px}
.daily-orders button:focus-visible,.orders-grid-scroll:focus-visible{outline:3px solid #2b8fba;outline-offset:-3px}
.orders-panel>footer{padding:9px 14px;font-size:12px;background:#f4f8f6;border-top:1px solid #d7e4df}.grid-empty{padding:28px;text-align:center;color:#50685e}.gift-row{color:#266a37}
@media(max-width:700px){.daily-orders{padding:12px}.orders-heading{align-items:start}.orders-context{display:none}.orders-commandbar button{flex:1 0 135px}.orders-commandbar #refresh{margin:0}.orders-filter input{width:100%;flex-basis:100%}.panel-title{align-items:start;flex-direction:column}.orders-grid-scroll{max-height:40vh}.orders-filter #count{margin:0}.orders-heading h1{font-size:21px}}

.daily-orders .column-filters th{top:51px;padding:5px 6px;background:#f2f7f4}.daily-orders .request-lines-grid .column-filters th{top:38px}.daily-orders .column-filters input{width:100%;min-width:85px;max-width:190px;min-height:34px;padding:5px 8px;border:1px solid #cbdcd4;border-radius:5px;font:inherit;background:white}.daily-orders tr[hidden]{display:none}

.daily-orders .request-grid input[type=checkbox]{width:20px;height:20px;min-width:20px;margin:6px;accent-color:#106858;cursor:pointer}.daily-orders .row-actions{white-space:nowrap;min-width:205px}.daily-orders .row-actions button{font:inherit;min-height:36px;padding:5px 10px;margin-inline-end:5px;border:1px solid #c8dbd2;background:white;color:#106858;border-radius:5px}.daily-orders .row-actions button:last-child{color:#a33c2d}.daily-orders .row-actions button:disabled{opacity:.5;cursor:default}.orders-commandbar #approve-selected{background:#106858;color:white}.orders-commandbar #approve-selected:disabled{background:#e4eee9;color:#63776d}

.orders-filter #request-status,.orders-filter #invoice-status{min-height:44px;max-width:100%;padding:8px 12px;border:1px solid #bccfca;border-radius:8px;background:#fff;color:#173f36;font:inherit}
.request-status-badge{display:inline-block;white-space:nowrap;padding:5px 9px;border-radius:6px;background:#eaf0ee;color:#274d43;font-weight:600}
.request-status-badge[data-status="awaiting_approval"],.request-status-badge[data-status="awaiting_transfer"],.request-status-badge[data-status="transferring"]{background:#fff3d6;color:#705000}
.request-status-badge[data-status="voucher"],.request-status-badge[data-status="invoiced"],.request-status-badge[data-status="transferred"]{background:#dff2e9;color:#14563e}
.request-status-badge[data-status="deleted"],.request-status-badge[data-status="erp_cancelled"],.request-status-badge[data-status="conversion_cancelled"]{background:#f7e9e6;color:#873b30}
.request-status-badge[data-status="transfer_uncertain"],.request-status-badge[data-status="erp_missing"],.request-status-badge[data-status="erp_unknown"]{background:#fff0df;color:#854500}

/* Keep transfer alongside the request even when the page toolbar is above the viewport. */
.daily-orders .row-actions{white-space:normal}.daily-orders .row-actions button{white-space:nowrap;margin-block:3px}.daily-orders .row-actions .row-transfer{display:block;background:#106858;color:#fff;border-color:#106858}.daily-orders .row-actions .row-transfer:disabled{background:#e4eee9;color:#63776d;opacity:1}

/* Full read-only saved request viewer, aligned with the editor. */
#preview .preview-toolbar{display:flex;align-items:center;justify-content:space-between;gap:16px;margin:0 0 16px}#preview h2{margin:0;font-size:21px}#preview-time{font-size:12px;color:var(--muted);margin:6px 0 0}#preview .preview-footer p{font-size:12px;line-height:1.9;margin:0}
.daily-orders #preview.saved-request-view{width:calc(100vw - 32px);max-width:1800px;height:calc(100dvh - 32px);max-height:none;padding:0;overflow:hidden;color:var(--ink)}
#preview.saved-request-view[open]{display:flex;flex-direction:column}#preview.saved-request-view .preview-toolbar{flex-shrink:0;padding:16px 24px;background:#f4f9f7;border-bottom:1px solid var(--line);margin:0}#preview.saved-request-view #close{flex-shrink:0;min-height:44px}
#preview.saved-request-view #preview-body{min-height:0;flex:1;overflow:auto;padding:20px;background:#f5f7f8;display:flex;flex-direction:column;gap:16px}#preview.saved-request-view #preview-body>section{flex-shrink:0}#preview.saved-request-view .preview-footer{flex-shrink:0;padding:12px 24px;border-top:1px solid var(--line);background:white}
#preview .saved-info{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:18px}#preview h3{font-size:15px;margin:0 0 16px}#preview .saved-lines{overflow:auto;max-height:45vh;border:1px solid var(--line);border-radius:8px}#preview .saved-grid{min-width:1650px;font-size:12px;border-collapse:separate;border-spacing:0}#preview .saved-grid th{position:sticky;top:0;background:#eaf2ee;color:#325b4e;white-space:nowrap;z-index:1}#preview .saved-grid td{white-space:nowrap;font-variant-numeric:tabular-nums;padding:14px 10px}#preview .saved-grid .product-name{min-width:250px;max-width:320px;white-space:normal;font-weight:600}#preview .saved-grid tr:nth-child(even){background:#fafcfb}#preview .saved-hint{font-size:11px;color:var(--muted);margin-bottom:0}#preview .saved-totals{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:16px;padding:18px;background:white;border:1px solid var(--line);border-radius:10px}#preview .saved-totals .editor-field:last-child strong{font-size:21px;color:#0e6658}
@media(max-width:800px){#preview .saved-info,#preview .saved-totals{grid-template-columns:repeat(2,minmax(0,1fr))}.daily-orders #preview.saved-request-view{width:100vw;height:100dvh;border:0;border-radius:0}#preview.saved-request-view .preview-toolbar,#preview.saved-request-view .preview-footer{padding:12px}#preview.saved-request-view #preview-body{padding:10px}#preview h2{font-size:17px}}

.saved-view-tabs{display:flex;gap:10px;flex-wrap:wrap}.saved-view-tabs button[aria-pressed=true]{background:#106858;color:white}.saved-view-tabs button{min-height:44px}
