:root{font-family:Tahoma,"Vazirmatn","Segoe UI",Arial,sans-serif;color:#142341;font-synthesis:none;font-size:14px;--muted:#596784;--edge:rgba(255,255,255,.85);--ink:#13223d;--blue:#1267f2}
*{box-sizing:border-box}body{margin:0;min-height:100vh;direction:rtl;background:radial-gradient(circle at 85% 6%,#81b6fcaa 0,transparent 33%),radial-gradient(circle at 9% 65%,#f2a4e6a8 0,transparent 38%),radial-gradient(circle at 53% 95%,#70e0d3a3 0,transparent 36%),linear-gradient(145deg,#e7ecff,#ede6fc 46%,#ffe9f6);background-attachment:scroll;color:var(--ink)}
button,input,textarea{font:inherit}button{cursor:pointer}button:disabled{cursor:not-allowed;opacity:.48}button:focus-visible,a:focus-visible,input:focus-visible,textarea:focus-visible{outline:3px solid #4475ed;outline-offset:2px}a{text-decoration:none;color:inherit}[hidden]{display:none!important}
.app-shell{max-width:1520px;margin:auto;padding:28px 28px 16px}.glass{border:2px solid var(--edge);box-shadow:0 20px 46px #455b9a24;background:linear-gradient(135deg,#ffffff8c,#f1e8ff8c 55%,#ffecf895);backdrop-filter:blur(21px);-webkit-backdrop-filter:blur(21px)}
.top-nav{display:flex;align-items:center;justify-content:space-between;gap:18px;padding:14px 20px;border-radius:55px;min-height:72px;background:linear-gradient(105deg,#f6f8ffdc,#d3ecff91);box-shadow:0 14px 35px #526fbb28}
.brand{display:flex;gap:12px;align-items:center;font-weight:900;font-size:20px;white-space:nowrap}.brand-icon{background:linear-gradient(140deg,#4198ff,#045de4);width:42px;height:42px;border-radius:14px;display:grid;place-items:center;color:#fff;box-shadow:0 6px 12px #2778e54d}.brand-icon svg{width:25px;height:25px}
main{min-height:65vh}.page-heading{display:flex;justify-content:space-between;align-items:center;gap:15px;margin:36px 8px 27px}.page-heading h1{font-size:clamp(24px,3.5vw,36px);margin:0 0 14px;letter-spacing:-.5px}.page-heading p{margin:0;color:var(--muted);line-height:1.9;font-size:15px}.tiny-pill{flex-shrink:0;border:1px solid #fff;border-radius:35px;background:#ffffff9c;padding:11px 20px;font-weight:700;color:#966009}.tiny-pill.success{color:#047a58}
.workspace{display:grid;grid-template-columns:minmax(0,1fr) 320px;gap:24px;align-items:start}.main-card,.side-card{border-radius:36px;padding:30px}.main-card{min-width:0}.side-card h2,.main-card h2{font-size:20px;margin:0}.section-heading{display:flex;align-items:center;gap:15px;justify-content:space-between;margin-bottom:23px}.quiet-chip{border-radius:30px;background:#ffffff9a;color:#415271;padding:8px 14px;font-size:12px}.info-banner{margin:17px 0 24px;background:linear-gradient(90deg,#deebff,#e7f0ffb5);border:1px solid white;border-radius:20px;min-height:52px;padding:14px 18px;display:flex;align-items:center;gap:12px;line-height:1.7}.info-icon{display:inline-grid;place-items:center;flex-shrink:0;width:24px;height:24px;border:2px solid #247af0;border-radius:50%;color:#1467f3;font:700 16px Georgia,serif}

.drop-zone{border:2px dashed #b8c7eb;background:#ffffff62;border-radius:28px;min-height:250px;display:flex;flex-direction:column;justify-content:center;align-items:center;text-align:center;gap:13px;margin-bottom:20px;color:#606e8c;padding:20px;cursor:pointer;transition:background .2s,border-color .2s}.drop-zone:hover{background:#fff9;border-color:#377bfb}.drop-zone strong{color:#132f5f;font-size:18px}.drop-zone b{color:#186cea;font-weight:800}.upload-picture{width:74px;height:74px;border-radius:24px;background:linear-gradient(135deg,#d5e9ff,#dcd6ff);display:grid;place-items:center;color:#216ff1}.upload-picture svg{width:38px;height:38px}
.primary-btn,.secondary-btn{display:inline-flex;align-items:center;justify-content:center;gap:9px;border:1px solid white;border-radius:30px;text-align:center;padding:14px 23px;font-weight:800;min-height:52px}.primary-btn{background:linear-gradient(180deg,#448efc,#0660e2);color:white;box-shadow:0 8px 18px #1e6ef947}.primary-btn:hover:enabled{filter:brightness(1.06)}.secondary-btn{background:#ffffff9e;color:#24314c}.secondary-btn:hover{background:#fff}.wide{width:100%}.input-label{display:block;font-weight:700;margin:10px 0}.side-card{background:linear-gradient(140deg,#ffffff96,#fde0f7bb);position:sticky;top:15px}.step{display:flex;gap:12px;margin:22px 0;align-items:flex-start}.step>b{width:32px;height:32px;border-radius:12px;background:#e5edff;color:#1267f2;display:grid;place-items:center;flex-shrink:0}.step div{display:grid;gap:7px}.step strong{font-size:14px}.step span,.side-hint{font-size:12px;line-height:1.8;color:var(--muted)}.side-hint{border-top:1px solid white;padding-top:15px;margin-top:25px}
.meta-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:15px}.meta-grid>div{min-width:0;display:grid;gap:10px}.meta-grid span{color:#5a6784;font-size:13px}.meta-grid strong{display:block;text-align:center;padding:12px;border:1px solid #fff;border-radius:16px;background:#ffffff79;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;direction:ltr}
.review-labels,.item-row{display:grid;grid-template-columns:minmax(150px,1.3fr) minmax(150px,1.3fr) 78px 117px 146px;gap:12px;align-items:center}.review-labels{color:#52617e;font-weight:800;padding:10px 12px 17px;font-size:13px}.line-list{display:grid;gap:11px}.item-row{background:#ffffff72;border:1px solid #fff;border-radius:23px;padding:14px 12px;min-height:86px;box-shadow:0 4px 12px #8183a70d}.item-row .source{font-size:13px;line-height:1.9;overflow-wrap:anywhere}.item-row .proposed{font-size:13px;line-height:1.8;font-weight:700;overflow-wrap:anywhere}.item-row .smaller{display:block;font-size:11px;color:#64728c;font-weight:400;margin-top:4px}.quantity-box{display:flex;gap:4px;flex-wrap:wrap;justify-content:center}.quantity-box input{width:64px;padding:8px 3px;border-radius:12px;border:1px solid #dbe2fb;background:#fff9;text-align:center;direction:ltr}.quantity-box .small-save{font-size:12px;padding:7px 9px;background:#e7efff;color:#135fe4;border:1px solid #d6e7fc;border-radius:12px}.pill{display:inline-block;text-align:center;border-radius:24px;padding:9px 10px;font-size:12px;font-weight:800;white-space:nowrap}.pill.matched,.pill.confirmed{background:#dff6e9;color:#137047}.pill.needs_confirmation{background:#fff0c8;color:#966017}.pill.not_found{background:#ffe6eb;color:#be2948}
.actions{display:flex;flex-direction:column;align-items:stretch;gap:7px}.actions button{border-radius:18px;border:1px solid #d6e5ff;background:#e9f1ff;color:#1163ea;font-weight:800;font-size:12px;padding:9px 10px}.actions .danger{border-color:#ffd8df;background:#fff5f6;color:#d32b44}.actions .confirm{background:#e5f0ff}.suggestions-panel{grid-column:1/-1;display:grid;gap:8px;background:#f9fbffb0;border:1px solid white;padding:14px;border-radius:18px}.suggestions-panel h3{font-size:14px;margin:0 0 5px}.choice{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:10px;border:1px solid #dbe5fa;border-radius:14px;background:#fff8}.choice .choice-info{display:grid;gap:4px}.choice b{font-size:13px}.choice small{color:#60738f}.choice button{border:1px solid #c7daf8;background:#edf4ff;padding:9px 12px;border-radius:14px;color:#0d58d3;flex-shrink:0}.warning{font-size:11px;color:#a5620f}
#stats{display:grid;margin-top:25px}.stat{display:flex;justify-content:space-between;align-items:center;padding:18px 3px;border-bottom:1px solid #fff;font-size:13px}.stat b{font-size:23px}.summary-divider{height:16px}.review-guidance{font-size:13px;line-height:1.9;color:#495874;margin:8px 0 20px}.summary-card button{margin:7px 0}.error-box{margin:22px auto 8px;padding:16px 20px;border:1px solid #e5a9b2;background:#fff0f2;border-radius:18px;color:#a41b33;white-space:pre-line}.table-scroll{overflow-x:auto}.table-wrap{min-width:790px}.approved-table{width:100%;border-collapse:separate;border-spacing:0 9px;min-width:530px}.approved-table th{padding:15px;color:#576986;text-align:right}.approved-table td{padding:17px 13px;background:#ffffffa3;border-top:1px solid #fff;border-bottom:1px solid #fff}.approved-table td:first-child{border-radius:0 17px 17px 0}.approved-table td:last-child{border-radius:17px 0 0 17px}.bottom-actions{display:flex;gap:12px;flex-wrap:wrap;margin-top:24px}footer{text-align:center;color:#66728d;margin:36px auto 10px;font-size:12px}
@media(max-width:1150px){.workspace{grid-template-columns:minmax(0,1fr) 260px;gap:16px}.main-card,.side-card{padding:22px}.review-labels,.item-row{grid-template-columns:minmax(155px,1.2fr) minmax(155px,1.2fr) 70px 106px 125px;gap:9px}}
@media(max-width:850px){.app-shell{padding:14px}.workspace{display:flex;flex-direction:column}.main-card,.side-card{width:100%}.side-card{position:static;order:-1}.side-card.summary-card{order:1}.top-nav{border-radius:25px;flex-wrap:wrap;min-height:65px}.page-heading{margin:24px 4px;align-items:start}.page-heading p{font-size:13px}.main-card,.side-card{border-radius:26px;padding:19px}.meta-grid{gap:8px}}
@media(max-width:480px){.page-heading{flex-direction:column}.top-nav{gap:10px}.brand{font-size:17px}.brand-icon{width:35px;height:35px}.meta-grid{grid-template-columns:1fr}.info-banner{font-size:12px}.bottom-actions>*{width:100%}.quiet-chip{font-size:10px}}
@media print{body{background:white}.top-nav,.side-card,.page-heading p,.bottom-actions,footer,#new-btn,.actions,.error-box{display:none!important}.app-shell{max-width:none;padding:0}.main-card{border:0;box-shadow:none;background:white}}

/* FACTRO: document preview and smooth motion. */
.top-nav{position:relative;z-index:5;gap:18px}
.file-preview{
  padding:15px;border:1px solid #ffffffd9;border-radius:25px;margin:0 0 18px;
  background:linear-gradient(135deg,#ffffffa6,#eaf4ffb4);box-shadow:0 10px 32px #3f6da31f;
  animation:preview-appear .4s cubic-bezier(.22,1,.3,1) both;
}
.preview-header{display:flex;align-items:center;justify-content:space-between;gap:12px;margin:0 0 14px}
.preview-header h3{font-size:16px;margin:0 0 5px}
.preview-header p{color:#61718f;font-size:12px;margin:0;max-width:440px;overflow-wrap:anywhere;direction:ltr;text-align:right}
.preview-check{display:flex;align-items:center;gap:6px;color:#138658;background:#ddf9ec;border-radius:22px;padding:8px 11px;font-weight:700;font-size:12px;white-space:nowrap}
.preview-viewport{display:grid;place-items:center;overflow:hidden;min-height:180px;max-height:430px;background:linear-gradient(135deg,#f3f5fb,#e4effc);border:1px solid #eff5ff;border-radius:19px}
.preview-viewport img{display:block;width:100%;max-height:425px;object-fit:contain}
.preview-viewport iframe{display:block;width:100%;height:405px;border:0;background:#fff}
.preview-actions{display:flex;justify-content:space-between;align-items:center;gap:14px;padding:15px 3px 0;color:#63708a;font-size:12px;line-height:1.7}
.preview-change{border:1px solid #c6dcfc;background:#f0f6ff;color:#125bc9;font-weight:800;padding:10px 15px;border-radius:15px;white-space:nowrap}
.preview-change:hover{background:#e1edff}
.review-document{border-top:1px solid #fff;margin:16px 0 0;padding:16px 0 0}
.review-document summary{cursor:pointer;list-style:none;font-size:12px;font-weight:800;padding:11px 13px;border-radius:16px;background:#ffffff85;color:#2767d0;text-align:center}
.review-document summary::-webkit-details-marker{display:none}
.review-document summary::before{content:'▾';margin-left:8px}
.review-document[open] summary::before{content:'▴'}
.review-preview-viewport{margin-top:12px;border-radius:15px;overflow:hidden;background:#ffffffac;max-height:330px}
.review-preview-viewport img{display:block;width:100%;max-height:320px;object-fit:contain}
.review-preview-viewport iframe{display:block;width:100%;height:320px;border:0}
.summary-tip{padding:11px 13px;margin:12px 0;border-radius:14px;background:#e6eeff99;border:1px solid #ffffffb5;color:#315b9e}
.quiet-chip.online{background:#e7fff3b5;color:#147e58;border:1px solid #c3f6dc}
.quiet-chip.offline{background:#fff0f1;color:#ad2341}

/* Smooth, discreet transitions without distracting from product verification. */
.actions button,.choice button,.primary-btn,.secondary-btn,.preview-change,
.review-document summary{transition:transform .25s,background .25s,box-shadow .25s,opacity .25s,filter .25s}
.primary-btn:hover:enabled,.secondary-btn:hover:enabled,.actions button:hover:enabled,.choice button:hover:enabled{transform:translateY(-2px)}
.primary-btn:active:enabled,.secondary-btn:active:enabled,.actions button:active:enabled{transform:scale(.985)}
.view-enter{animation:page-enter .48s cubic-bezier(.22,1,.36,1) both}
.item-row{animation:row-enter .37s cubic-bezier(.22,1,.36,1) both;animation-delay:calc(var(--row-index,0) * 42ms);transition:background .22s,box-shadow .22s,transform .22s}
.item-row:hover{box-shadow:0 7px 23px #4e75bf24;background:#ffffff9a}
.info-banner{animation:soft-appear .48s ease both}
.button-spinner{width:17px;height:17px;display:inline-block;border:2px solid #ffffff80;border-top-color:#fff;border-radius:50%;animation:spin .65s linear infinite}
.confirm-dialog{
  width:min(92vw,470px);max-width:470px;padding:28px;
  border:2px solid #fff;border-radius:30px;color:var(--ink);text-align:center;
  background:linear-gradient(145deg,#f9fbff,#f9eafb);box-shadow:0 25px 80px #162e5a52;
  animation:modal-enter .28s cubic-bezier(.2,.7,.2,1) both;
}
.confirm-dialog::backdrop{background:#182c54a3;backdrop-filter:blur(7px)}
.modal-mark{width:56px;height:56px;display:grid;place-items:center;margin:0 auto 14px;border-radius:20px;color:#fff;font-size:30px;background:linear-gradient(140deg,#5197fc,#0c66e6)}
.confirm-dialog h2{font-size:23px;margin:0 0 13px}
.confirm-dialog p{color:#596783;line-height:2;font-size:14px;margin:0 0 22px}
.confirm-actions{display:flex;justify-content:center;gap:12px;flex-wrap:wrap}
.confirm-actions>*{flex:1}
@keyframes page-enter{from{opacity:0;transform:translateY(13px)}to{opacity:1;transform:translateY(0)}}
@keyframes preview-appear{from{opacity:0;transform:translateY(11px) scale(.985)}to{opacity:1;transform:translateY(0) scale(1)}}
@keyframes row-enter{from{opacity:0;transform:translateY(8px)}to{opacity:1;transform:translateY(0)}}
@keyframes soft-appear{from{opacity:0}to{opacity:1}}
@keyframes modal-enter{from{opacity:0;transform:translateY(16px) scale(.98)}to{opacity:1;transform:translateY(0) scale(1)}}
@keyframes spin{to{transform:rotate(360deg)}}
@media(max-width:850px){.top-nav{gap:12px}.stage-track{margin-inline-start:auto}}
@media(max-width:480px){.top-nav{padding:12px}.stage-track{width:100%;justify-content:center;gap:8px}.stage-step{padding:8px 10px;font-size:12px}.stage-dot{width:26px;height:26px}.preview-header,.preview-actions{align-items:flex-start;flex-wrap:wrap}.preview-viewport iframe{height:340px}.preview-viewport{max-height:350px}.confirm-actions{flex-direction:column}}
@media(prefers-reduced-motion:reduce){*,*::before,*::after{animation:none!important;transition:none!important;scroll-behavior:auto!important}}
@media print{.stage-track,.confirm-dialog,.review-document,.file-preview{display:none!important}}

/* Large-view preview for checking small handwritten details. */
#health{direction:ltr;unicode-bidi:isolate}
#preview-image,#review-preview-image{cursor:zoom-in}
#preview-image:focus-visible,#review-preview-image:focus-visible{outline:3px solid #4475ed;outline-offset:-3px}
.preview-dialog{border:1px solid white;border-radius:24px;padding:22px;background:#f6f8ff;color:var(--ink);max-width:94vw;max-height:92vh;box-shadow:0 30px 85px #2634595e;animation:modal-enter .26s ease both}
.preview-dialog::backdrop{background:#0c1834c4;backdrop-filter:blur(8px)}
.preview-dialog img{display:block;max-width:min(90vw,1400px);max-height:80vh;width:auto;height:auto;object-fit:contain;margin:0 auto;border-radius:12px}
.preview-dialog-close{display:block;margin:0 0 12px auto;border-radius:14px;border:1px solid #d4dff9;background:#fff;padding:8px 14px;color:#234c8e;font-weight:800}
@media print{.preview-dialog{display:none!important}}
/* Keep the upload/review form before the explanatory sidebar on narrow screens. */
@media(max-width:850px){.workspace .main-card{order:0}.workspace .side-card{order:1}}

/* Non-interactive progress strip: all actions live inside the page. */
.stage-track{display:flex;align-items:center;gap:12px;min-height:42px;user-select:none;pointer-events:none}
.stage-step{display:inline-flex;align-items:center;gap:9px;padding:10px 16px;border-radius:24px;
  color:#7583a0;font-weight:800;white-space:nowrap;border:1px solid #ffffff75;background:#ffffff55;
  transition:background .35s ease,color .35s ease,box-shadow .35s ease,transform .35s ease}
.stage-dot{display:grid;place-items:center;width:29px;height:29px;border-radius:50%;background:#ffffff95;color:#6980a8;
  transition:background .35s ease,color .35s ease}
.stage-step.current{color:#145fca;background:linear-gradient(120deg,#ffffffed,#e1edffb0);box-shadow:0 6px 17px #6188d72a;transform:translateY(-1px)}
.stage-step.current .stage-dot{background:linear-gradient(145deg,#418efe,#0d6ade);color:#fff}
.stage-step.completed{color:#218260;background:#e3f8eeac}
.stage-step.completed .stage-dot{background:#27ae86;color:white}
.stage-connector{height:2px;width:30px;border-radius:5px;background:#a4b9df80}
/* Selection is always immediately below the product title in an uncertain row. */
.proposed-cell{min-width:0;display:flex;align-items:flex-start;flex-direction:column;gap:9px}
.proposed-cell .product-name{max-width:100%;font-size:13px;line-height:1.8;font-weight:700;overflow-wrap:anywhere}
.proposed-cell .pick-open{align-self:flex-start;font-size:12px;border:1px solid #bcd2fa;border-radius:12px;
  background:linear-gradient(135deg,#ffffffeb,#e8f1ffed);color:#075dd0;padding:8px 14px;font-weight:800;
  box-shadow:0 4px 12px #2672bd19;transition:transform .22s,background .22s,box-shadow .22s}
.proposed-cell .pick-open:hover{transform:translateY(-2px);background:#e2efff;box-shadow:0 6px 14px #2672bd2a}
.proposed-cell .pick-open[aria-expanded="true"]{background:#d9eaff;color:#064da8}
.suggestions-panel{animation:preview-appear .3s cubic-bezier(.22,1,.36,1) both}
.suggestion-hint{margin:0 0 5px;color:#566783;font-size:12px;line-height:1.9}
.choice{transition:background .22s ease,box-shadow .22s ease}
.choice:hover{background:#fff;box-shadow:0 5px 14px #4276bf18}
.summary-card #finalize-btn{margin-top:10px}
@media print{.pick-open,.suggestions-panel,#finalize-btn{display:none!important}}

@media(prefers-reduced-motion:reduce){.stage-step,.stage-dot,.suggestions-panel,.choice,.pick-open{animation:none!important;transition:none!important}}

/* Main actions appear beneath the complete product review, not in the header. */
.review-footer{display:flex;align-items:center;gap:13px;flex-wrap:wrap;border-top:1px solid #ffffffb9;margin-top:24px;padding-top:20px}
.review-footer button{flex:1;min-width:190px}
@media(max-width:480px){.review-footer{flex-direction:column}.review-footer button{width:100%;min-width:0}}
@media print{.review-footer{display:none!important}}

.customer-name-input{width:100%;border:1px solid #cedbf3;background:#ffffffba;border-radius:16px;min-height:48px;padding:12px 16px;margin-bottom:17px;color:#13223d;max-width:100%}
.customer-name-input:focus-visible{outline:3px solid #8ab3f6;outline-offset:2px}

/* Employer entry stays in the footer; the two-step top bar is unchanged. */
.customer-footer{display:flex;align-items:center;justify-content:center;gap:20px;flex-wrap:wrap}
.employer-entry-link{display:inline-flex;align-items:center;justify-content:center;padding:8px 16px;border:1px solid #c8d6f1;background:#ffffffb8;color:#2a5eaf;border-radius:14px;text-decoration:none;font-weight:750;font-size:12px;transition:transform .2s ease,background .2s ease,box-shadow .2s ease}
.employer-entry-link:hover{transform:translateY(-2px);background:#fff;box-shadow:0 6px 20px #6689c52b}
.employer-entry-link:focus-visible{outline:3px solid #2673ec;outline-offset:2px}

/* FACTRO V8: user-provided logo and final-submit identity modal. */
.brand-logo{width:43px;height:43px;object-fit:contain;flex:none;border-radius:12px;box-shadow:0 4px 16px #496eae30}
#customer-final-form{display:grid;gap:8px;text-align:right;margin:14px 0 22px}
#customer-final-form label{font-size:13px;font-weight:800;color:#384767}
#customer-final-form input{width:100%;min-width:0;min-height:48px;border-radius:14px;border:1px solid #c4d6f3;background:#fff;padding:11px 14px;font:inherit;color:#1b2c49}
#customer-final-form input:focus-visible{outline:2px solid #2870dd;outline-offset:2px}
#final-customer-phone{font-family:Tahoma,Arial,sans-serif;text-align:left}
.required-mark{color:#d6435b}
.validation-note{background:#fff0f2;color:#a0293f;padding:9px;border:1px solid #f4b8c2;border-radius:11px;margin:4px 0;font-size:12px}

/* V9 additions */
.manual-search{border-radius:18px;margin:18px 0;padding:18px;border:1px solid #ffffffb0;background:#ffffff44;}
.manual-search label{display:block;margin-bottom:10px;font-weight:600}
.manual-search-row{display:flex;gap:10px;align-items:center}
.manual-search-row input{flex:1;min-width:0;border:1px solid #cfdbef;border-radius:14px;padding:12px;background:#fff9}
.manual-results{display:grid;gap:7px;margin-top:10px}
.manual-choice{display:flex;justify-content:space-between;gap:10px;align-items:center;border-radius:12px;padding:9px 12px;background:#ffffffa0}
.manual-choice span{flex:1}
@media(max-width:700px){.manual-search-row,.manual-choice{flex-direction:column;align-items:stretch}}

.preview-thumbs{display:flex;flex-wrap:wrap;gap:9px;margin:12px 0}
.preview-thumb{background:#ffffffa1;border:1px solid #cad5ef;border-radius:12px;padding:9px;color:#1a3673;font:inherit;cursor:pointer}
.preview-thumb.active{background:#e4f1ff;border-color:#377cdb;box-shadow:0 2px 10px #3465c62a}
@media print{.top-nav,.customer-footer,.review-footer,.bottom-actions,#tracking-info{display:none!important}}
