/* ==========================================================
   KIRAN OMS — Phase 10.7
   Approved compact horizontal New Order composer
   ========================================================== */
:root{
  --p105-blue:#2467dc;
  --p105-blue2:#1f5dca;
  --p105-border:#d7e1ee;
  --p105-text:#172033;
  --p105-muted:#64748b;
  --p105-green:#13a447;
  --p105-bg:#ffffff;
  --p105-soft:#f7faff;
  --p105-shadow:0 24px 65px rgba(15,23,42,.24),0 5px 18px rgba(15,23,42,.10);
}

/* Source rows stay alive for original logic but are not shown. */
body.p105-composer-live #ow.np #p9-order-group-tr,
body.p105-composer-live #ow.np #ar-hint-tr,
body.p105-composer-live #ow.np #ar-chips-tr,
body.p105-composer-live #ow.np #ar-tr,
body.p105-composer-live #ow.np #ar-dup-warn,
body.p105-composer-live #ow.np #ar-topspacer{display:none!important}
#ow.np>table.ot>thead{display:table-header-group!important}
#ow.np{overflow:auto!important}

#p105-dock-slot{width:100%;display:block;margin:0 0 10px;position:relative;z-index:20}
#p105-dock-slot:empty{display:none}

#p10-order-float{
  display:none;
  flex-direction:column;
  background:var(--p105-bg);
  color:var(--p105-text);
  border:1px solid #b9c9dc;
  border-radius:13px;
  overflow:hidden;
  box-shadow:var(--p105-shadow);
  font-family:Inter,Segoe UI,Arial,sans-serif;
  box-sizing:border-box;
}
#p10-order-float.p10-open{display:flex}
#p10-order-float.p105-floating{
  position:fixed;
  z-index:28000;
  min-width:900px;
  min-height:230px;
  max-height:360px;
  resize:horizontal;
}
#p10-order-float.p105-docked{
  position:relative;
  width:100%;
  min-width:0;
  height:auto!important;
  max-height:none;
  border-radius:12px;
  box-shadow:0 6px 18px rgba(15,23,42,.10);
}
#p10-order-float.p105-min{height:45px!important;min-height:45px;max-height:45px;resize:none}
#p10-order-float.p105-min .p105-content{display:none!important}

.p105-titlebar{
  flex:0 0 45px;
  min-height:45px;
  display:flex;
  align-items:center;
  gap:12px;
  padding:0 10px 0 16px;
  color:#fff;
  background:linear-gradient(90deg,#2b70e6 0%,#286cdd 45%,#245fc7 100%);
  border-bottom:1px solid rgba(255,255,255,.2);
  user-select:none;
  cursor:move;
}
.p105-docked .p105-titlebar{cursor:default}
.p105-title-left{display:flex;align-items:center;gap:7px;font-size:13px;white-space:nowrap}
.p105-title-left b{font-size:14px;font-weight:850}
.p105-doc{width:20px;height:20px;border:1px solid rgba(255,255,255,.65);border-radius:5px;display:grid;place-items:center;font-size:10px}
.p105-dot{opacity:.65}
.p105-title-meta{display:flex;align-items:center;gap:6px;min-width:0;margin-left:4px}
.p105-title-meta span{font-size:9px;font-weight:700;color:#dceaff;border:1px solid rgba(255,255,255,.18);background:rgba(255,255,255,.08);padding:4px 7px;border-radius:999px;white-space:nowrap}
.p105-mode-actions{margin-left:auto;display:flex;align-items:center;gap:5px}
.p105-mode-actions i{width:1px;height:23px;background:rgba(255,255,255,.24);margin:0 5px}
.p105-mode-actions button{font-family:inherit;cursor:pointer}
.p105-mode-btn{
  height:29px;padding:0 10px;border:1px solid rgba(255,255,255,.30);border-radius:7px;
  background:rgba(255,255,255,.08);color:#f8fbff;font-size:10.5px;font-weight:800;display:flex;align-items:center;gap:5px
}
.p105-mode-btn:hover,.p105-mode-btn.on{background:#fff;color:#245fc7;border-color:#fff;box-shadow:0 2px 6px rgba(15,23,42,.12)}
.p105-win-btn{width:30px;height:29px;border:0;border-radius:7px;background:transparent;color:#fff;font-size:17px;display:grid;place-items:center}
.p105-win-btn:hover{background:rgba(255,255,255,.15)}
.p105-close:hover{background:#d9363e!important}
.p105-docked [data-act="min"],.p105-docked [data-act="center"]{display:none}

.p105-content{padding:12px 16px 10px;background:#fff;display:grid;gap:10px;overflow:auto}
.p105-main-row{
  display:grid;
  grid-template-columns:150px minmax(190px,1.65fr) minmax(155px,1.25fr) minmax(105px,.85fr) minmax(112px,.92fr) 100px minmax(105px,.9fr) 68px 86px minmax(160px,1.35fr);
  gap:9px;
  align-items:end;
  min-width:0;
}
.p105-field{display:grid;gap:5px;min-width:0;margin:0}
.p105-field>span{font-size:8.5px;line-height:1;font-weight:850;color:#42526a;letter-spacing:.025em;white-space:nowrap}
.p105-field input{
  width:100%;height:38px;box-sizing:border-box;border:1px solid #cbd8e8;border-radius:8px;background:#fbfdff;color:#172033;
  padding:0 9px;font:700 10.5px Inter,Segoe UI,sans-serif;outline:none;box-shadow:0 1px 1px rgba(15,23,42,.02)
}
.p105-field input:focus{border-color:#4a86ec;background:#fff;box-shadow:0 0 0 3px rgba(37,99,235,.10)}
.p105-order-box{height:38px;display:grid;grid-template-columns:1fr 34px;border:1px solid #cbd8e8;border-radius:8px;background:#f4f8ff;overflow:hidden}
.p105-order-box b{display:flex;align-items:center;padding:0 9px;color:#1d4ed8;font-size:11px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.p105-order-box button{border:0;border-left:1px solid #cbd8e8;background:#edf4ff;color:#2563eb;cursor:pointer;font-size:13px}
.p105-order-box button:hover{background:#dceaff}

.p105-advanced{display:none;grid-template-columns:150px 170px 105px auto;gap:9px;align-items:end;padding:9px 10px;border:1px dashed #bfd1e7;border-radius:9px;background:#f8fbff}
.p105-advanced-open .p105-advanced{display:grid}
.p105-adv-note{height:38px;border:1px solid #cfe1d5;background:#f3fff6;border-radius:8px;display:flex;flex-direction:column;align-items:center;justify-content:center}
.p105-adv-note span{font-size:8px;color:#64748b;font-weight:700}.p105-adv-note b{font-size:16px;color:#15803d}
.p105-finish{height:38px;border:1px solid #6fc488;border-radius:8px;background:#eefcf2;color:#137a37;font:800 10.5px Inter,Segoe UI,sans-serif;padding:0 15px;cursor:pointer}
.p105-finish:hover{background:#daf7e2}

.p105-bottom-row{
  display:grid;
  grid-template-columns:90px minmax(520px,1fr) 125px 110px auto;
  align-items:end;
  gap:12px;
  padding:8px 9px 9px;
  border:1px solid #dce6f2;
  border-radius:10px;
  background:linear-gradient(180deg,#fbfdff,#f6f9fd);
}
.p105-size-label{height:47px;display:flex;align-items:center;gap:8px;color:#1e3a68}
.p105-shoe{width:30px;height:30px;border-radius:8px;background:#eef5ff;display:grid;place-items:center;color:#1d4ed8;font-size:20px;font-weight:900}
.p105-size-label div{display:flex;flex-direction:column}.p105-size-label b{font-size:11px}.p105-size-label small{font-size:8.5px;color:#64748b;margin-top:2px}
.p105-sizes{display:grid;grid-template-columns:repeat(11,minmax(35px,1fr));gap:5px;min-width:0}
.p105-sizes label{display:grid;gap:4px;text-align:center;min-width:0}.p105-sizes label span{font-size:8px;font-weight:850;color:#334155}
.p105-sizes input{width:100%;height:34px;box-sizing:border-box;text-align:center;border:1px solid #cbd8e8;border-radius:7px;background:#fff;color:#172033;font:800 10px 'DM Mono',Consolas,monospace;outline:none;padding:0 2px}
.p105-sizes input:focus{border-color:#3b82f6;box-shadow:0 0 0 2px rgba(59,130,246,.11)}
.p105-rate{display:grid;gap:5px}.p105-rate span,.p105-total span{font-size:8px;font-weight:850;color:#42526a}
.p105-rate input{height:34px;border:1px solid #cbd8e8;border-radius:7px;background:#f3f7fc;padding:0 8px;text-align:right;font:800 10px Inter,Segoe UI,sans-serif;color:#172033;outline:none;box-sizing:border-box;width:100%}
.p105-rate input:focus{border-color:#3b82f6;background:#fff;box-shadow:0 0 0 2px rgba(59,130,246,.1)}
.p105-total{height:52px;border:1px solid #b9dfc4;border-radius:8px;background:#eaf8ee;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px}
.p105-total b{font-size:16px;color:#117f39;font-weight:900}
.p105-entry-actions{display:flex;align-items:end;justify-content:flex-end;gap:8px;padding-bottom:0;white-space:nowrap}
.p105-entry-actions button{height:39px;border-radius:8px;padding:0 12px;font:800 10.5px Inter,Segoe UI,sans-serif;cursor:pointer;white-space:nowrap}
.p105-copy{border:1px solid #7ca8ee;background:#fff;color:#2563eb}.p105-copy:hover{background:#f1f6ff}
.p105-save{border:1px solid #159947;background:#14a54a;color:#fff;box-shadow:0 4px 10px rgba(20,165,74,.16)}.p105-save:hover{background:#0f8b3d}
.p105-cancel{border:1px solid #d3dce7;background:#fff;color:#596579}.p105-cancel:hover{background:#f8fafc;color:#b4232b;border-color:#efb9bd}
.p105-shortcuts{display:flex;gap:14px;align-items:center;color:#7a899d;font-size:8.5px;min-height:14px}.p105-shortcuts span{white-space:nowrap}.p105-shortcuts b{color:#315f9f}

/* Prevent Orders toolbar from colliding under normal desktop widths. */
#pg-orders .mo-filter-row,#pg-orders .mo-filter-row-2-filters,#pg-orders .mo-action-wrap{min-width:0!important}
#pg-orders .mo-action-wrap{flex-wrap:wrap!important}

@media(max-width:1320px){
  #p10-order-float.p105-floating{min-width:760px}
  .p105-main-row{grid-template-columns:140px minmax(190px,1.5fr) minmax(150px,1.2fr) 105px 110px 92px 110px 66px 82px minmax(150px,1.2fr);gap:6px}
  .p105-content{padding-left:10px;padding-right:10px}.p105-bottom-row{grid-template-columns:78px minmax(500px,1fr) 105px 92px auto;gap:8px}
  .p105-entry-actions button{padding:0 9px}.p105-title-meta{display:none}
}
@media(max-width:1050px){
  #p10-order-float.p105-floating{left:8px!important;top:70px!important;width:calc(100vw - 16px)!important;min-width:0;max-height:65vh;resize:none}
  .p105-main-row{grid-template-columns:repeat(5,minmax(130px,1fr));overflow-x:auto;padding-bottom:3px}
  .p105-bottom-row{grid-template-columns:75px minmax(560px,1fr) 105px 90px auto;overflow-x:auto}
  .p105-shortcuts{display:none}.p105-mode-btn span{display:none}.p105-mode-btn{padding:0 8px}
}

[data-theme="dark"] #p10-order-float{background:#101827;border-color:#3b4b61}
[data-theme="dark"] .p105-content{background:#101827}
[data-theme="dark"] .p105-field>span,[data-theme="dark"] .p105-rate span,[data-theme="dark"] .p105-total span{color:#a7b4c5}
[data-theme="dark"] .p105-field input,[data-theme="dark"] .p105-sizes input,[data-theme="dark"] .p105-rate input{background:#111c2c;color:#e7eef8;border-color:#46566b}
[data-theme="dark"] .p105-bottom-row,[data-theme="dark"] .p105-advanced{background:#0d1726;border-color:#334155}


/* ==========================================================
   Phase 10.7 — Premium Smart Match suggestions
   Replaces browser-native datalist UI inside New Order composer.
   ========================================================== */
#p107-smart-list{
  position:fixed;z-index:32050;display:none;overflow:hidden;
  background:#fff;border:1px solid #cfdbea;border-radius:12px;
  box-shadow:0 18px 48px rgba(15,23,42,.20),0 4px 12px rgba(15,23,42,.08);
  color:#172033;font-family:Inter,Segoe UI,Arial,sans-serif;
}
#p107-smart-list.open{display:block}
.p107-smart-head{
  position:sticky;top:0;z-index:2;height:37px;box-sizing:border-box;padding:0 10px;
  display:flex;align-items:center;justify-content:space-between;gap:10px;
  background:linear-gradient(180deg,#f8fbff,#f1f6fd);border-bottom:1px solid #e3ebf5;
}
.p107-smart-head>div{display:flex;align-items:center;gap:7px;min-width:0}.p107-smart-head b{font-size:10.5px;color:#294666;white-space:nowrap}.p107-smart-head small{font-size:8.5px;color:#8291a5;white-space:nowrap}
.p107-smart-body{max-height:230px;overflow:auto;padding:5px}
.p107-smart-item{
  min-height:42px;padding:5px 8px;border-radius:8px;box-sizing:border-box;
  display:grid;grid-template-columns:28px minmax(0,1fr) auto;align-items:center;gap:8px;
  cursor:pointer;border:1px solid transparent;transition:background .10s ease,border-color .10s ease;
}
.p107-smart-item:hover,.p107-smart-item.is-active{background:#eef5ff;border-color:#cfe0fb}
.p107-smart-item.is-active{box-shadow:inset 3px 0 0 #2b70e6}
.p107-smart-icon{width:28px;height:28px;border-radius:8px;display:grid;place-items:center;background:#f2f6fb;color:#37689f;font-size:13px}
.p107-smart-copy{min-width:0;display:flex;flex-direction:column;gap:2px}
.p107-smart-copy b{font-size:11.5px;line-height:1.15;color:#172033;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.p107-smart-copy small{font-size:8.7px;color:#748397;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.p107-smart-copy mark{background:#dceaff;color:#1e4f9b;border-radius:3px;padding:0 1px}
.p107-chip{font-size:7.8px;font-weight:800;color:#2664bd;background:#edf4ff;border:1px solid #cfe0fb;border-radius:999px;padding:3px 6px}
.p107-smart-empty{padding:14px 11px;color:#718096;font-size:10px;line-height:1.45;text-align:center}
.p107-smart-foot{height:30px;padding:0 10px;display:flex;align-items:center;justify-content:space-between;background:#fbfcfe;border-top:1px solid #edf1f6;color:#8a98aa;font-size:8.4px}
.p107-smart-foot kbd{font:800 8px Inter,Segoe UI,sans-serif;color:#315f9f;background:#edf4ff;border:1px solid #cbdcf5;border-bottom-width:2px;border-radius:5px;padding:2px 6px}
.p105-field input.p107-smart-active{border-color:#3b7be5!important;background:#fff!important;box-shadow:0 0 0 3px rgba(37,99,235,.11)!important}
[data-theme="dark"] #p107-smart-list{background:#111c2c;border-color:#42536a;color:#e8eef7;box-shadow:0 20px 50px rgba(0,0,0,.5)}
[data-theme="dark"] .p107-smart-head{background:#172337;border-color:#334155}[data-theme="dark"] .p107-smart-head b{color:#d8e5f4}[data-theme="dark"] .p107-smart-item:hover,[data-theme="dark"] .p107-smart-item.is-active{background:#1c2c44;border-color:#3c5f8e}
[data-theme="dark"] .p107-smart-icon{background:#1d2a3e;color:#8db9ef}[data-theme="dark"] .p107-smart-copy b{color:#e8eef7}[data-theme="dark"] .p107-smart-foot{background:#121c2b;border-color:#334155}
